Hard code model for sheel tool samples

This commit is contained in:
Tao Chen
2026-04-01 16:59:06 -07:00
Unverified
parent 0ed522cbee
commit 1347a00ca8
2 changed files with 14 additions and 2 deletions
@@ -18,6 +18,9 @@ This sample demonstrates implementing a local shell tool using get_shell_tool(fu
that wraps Python's subprocess module. Unlike the hosted shell tool (get_shell_tool()),
local shell execution runs commands on YOUR machine, not in a remote container.
Currently not all models support the shell tool. Refer to the OpenAI documentation for the
list of supported models: https://developers.openai.com/api/docs/models/
SECURITY NOTE: This example executes real commands on your local machine.
Only enable this when you trust the agent's actions. Consider implementing
allowlists, sandboxing, or approval workflows for production use.
@@ -53,7 +56,10 @@ async def main() -> None:
print("=== OpenAI Agent with Local Shell Tool Example ===")
print("NOTE: Commands will execute on your local machine.\n")
client = OpenAIChatClient()
# Currently not all models support the shell tool. Refer to the OpenAI
# documentation for the list of supported models:
# https://developers.openai.com/api/docs/models/
client = OpenAIChatClient(model="gpt-5.4-nano")
local_shell_tool = client.get_shell_tool(
func=run_bash,
)
@@ -17,6 +17,9 @@ for executing shell commands in a managed container environment hosted by OpenAI
The shell tool allows the model to run commands like listing files, running scripts,
or performing system operations within a secure, sandboxed container.
Currently not all models support the shell tool. Refer to the OpenAI documentation
for the list of supported models: https://developers.openai.com/api/docs/models/
"""
@@ -24,7 +27,10 @@ async def main() -> None:
"""Example showing how to use the shell tool with OpenAI Chat."""
print("=== OpenAI Chat Client Agent with Shell Tool Example ===")
client = OpenAIChatClient()
# Currently not all models support the shell tool. Refer to the OpenAI
# documentation for the list of supported models:
# https://developers.openai.com/api/docs/models/
client = OpenAIChatClient(model="gpt-5.4-nano")
# Create a hosted shell tool with the default auto container environment
shell_tool = client.get_shell_tool()