Skip to content

Commit 980ca3f

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

1 file changed

Lines changed: 47 additions & 47 deletions

File tree

docs/tools.md

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,53 @@ async def main():
3737
print(result.final_output)
3838
```
3939

40+
### Hosted container shell + skills
41+
42+
`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.
43+
44+
```python
45+
from agents import Agent, Runner, ShellTool, ShellToolSkillReference
46+
47+
csv_skill: ShellToolSkillReference = {
48+
"type": "skill_reference",
49+
"skill_id": "skill_698bbe879adc81918725cbc69dcae7960bc5613dadaed377",
50+
"version": "1",
51+
}
52+
53+
agent = Agent(
54+
name="Container shell agent",
55+
model="gpt-5.2",
56+
instructions="Use the mounted skill when helpful.",
57+
tools=[
58+
ShellTool(
59+
environment={
60+
"type": "container_auto",
61+
"network_policy": {"type": "disabled"},
62+
"skills": [csv_skill],
63+
}
64+
)
65+
],
66+
)
67+
68+
result = await Runner.run(
69+
agent,
70+
"Use the configured skill to analyze CSV files in /mnt/data and summarize totals by region.",
71+
)
72+
print(result.final_output)
73+
```
74+
75+
To reuse an existing container in later runs, set `environment={"type": "container_reference", "container_id": "cntr_..."}`.
76+
77+
What to know:
78+
79+
- Hosted shell is available through the Responses API shell tool.
80+
- `container_auto` provisions a container for the request; `container_reference` reuses an existing one.
81+
- `environment.skills` accepts skill references and inline skill bundles.
82+
- With hosted environments, do not set `executor`, `needs_approval`, or `on_approval` on `ShellTool`.
83+
- `network_policy` supports `disabled` and `allowlist` modes.
84+
- See `examples/tools/container_shell_skill_reference.py` and `examples/tools/container_shell_inline_skill.py` for complete examples.
85+
- OpenAI platform guides: [Shell](https://platform.openai.com/docs/guides/tools-shell) and [Skills](https://platform.openai.com/docs/guides/tools-skills).
86+
4087
## Local runtime tools
4188

4289
Local runtime tools execute in your environment and require you to supply implementations:
@@ -86,53 +133,6 @@ agent = Agent(
86133
)
87134
```
88135

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-
136136
## Function tools
137137

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

0 commit comments

Comments
 (0)