Skip to content

Commit e767264

Browse files
committed
docs: add shell tool + skills
1 parent cc2ace5 commit e767264

2 files changed

Lines changed: 51 additions & 1 deletion

File tree

docs/examples.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ Check out a variety of sample implementations of the SDK in the examples section
8282
- Web search and web search with filters
8383
- File search
8484
- Code interpreter
85+
- Hosted container shell with inline skills (`examples/tools/container_shell_inline_skill.py`)
86+
- Hosted container shell with skill references (`examples/tools/container_shell_skill_reference.py`)
8587
- Computer use
8688
- Image generation
8789
- Experimental Codex tool workflows (`examples/tools/codex.py`)

docs/tools.md

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ async def main():
4242
Local runtime tools execute in your environment and require you to supply implementations:
4343

4444
- [`ComputerTool`][agents.tool.ComputerTool]: implement the [`Computer`][agents.computer.Computer] or [`AsyncComputer`][agents.computer.AsyncComputer] interface to enable GUI/browser automation.
45-
- [`ShellTool`][agents.tool.ShellTool] or [`LocalShellTool`][agents.tool.LocalShellTool]: provide a shell executor to run commands.
45+
- [`ShellTool`][agents.tool.ShellTool]: the latest shell tool for both local execution and hosted container execution.
46+
- [`LocalShellTool`][agents.tool.LocalShellTool]: legacy local-shell integration.
4647
- [`ApplyPatchTool`][agents.tool.ApplyPatchTool]: implement [`ApplyPatchEditor`][agents.editor.ApplyPatchEditor] to apply diffs locally.
4748

4849
```python
@@ -85,6 +86,53 @@ agent = Agent(
8586
)
8687
```
8788

89+
### Hosted container shell + skills
90+
91+
`ShellTool` also supports OpenAI-hosted container execution. Use this mode when you want the model to run shell commands in a managed container instead of your local runtime.
92+
93+
```python
94+
from agents import Agent, Runner, ShellTool, ShellToolSkillReference
95+
96+
csv_skill: ShellToolSkillReference = {
97+
"type": "skill_reference",
98+
"skill_id": "skill_698bbe879adc81918725cbc69dcae7960bc5613dadaed377",
99+
"version": "1",
100+
}
101+
102+
agent = Agent(
103+
name="Container shell agent",
104+
model="gpt-5.2",
105+
instructions="Use the mounted skill when helpful.",
106+
tools=[
107+
ShellTool(
108+
environment={
109+
"type": "container_auto",
110+
"network_policy": {"type": "disabled"},
111+
"skills": [csv_skill],
112+
}
113+
)
114+
],
115+
)
116+
117+
result = await Runner.run(
118+
agent,
119+
"Use the configured skill to analyze CSV files in /mnt/data and summarize totals by region.",
120+
)
121+
print(result.final_output)
122+
```
123+
124+
To reuse an existing container in later runs, set `environment={"type": "container_reference", "container_id": "cntr_..."}`.
125+
126+
What to know:
127+
128+
- Hosted shell is available through the Responses API shell tool.
129+
- `container_auto` provisions a container for the request; `container_reference` reuses an existing one.
130+
- `environment.skills` accepts skill references and inline skill bundles.
131+
- With hosted environments, do not set `executor`, `needs_approval`, or `on_approval` on `ShellTool`.
132+
- `network_policy` supports `disabled` and `allowlist` modes.
133+
- See `examples/tools/container_shell_skill_reference.py` and `examples/tools/container_shell_inline_skill.py` for complete examples.
134+
- OpenAI platform guides: [Shell](https://platform.openai.com/docs/guides/tools-shell) and [Skills](https://platform.openai.com/docs/guides/tools-skills).
135+
88136
## Function tools
89137

90138
You can use any Python function as a tool. The Agents SDK will setup the tool automatically:

0 commit comments

Comments
 (0)