From 1347a00ca807c7a1f3299e783b3a136ae9228568 Mon Sep 17 00:00:00 2001 From: Tao Chen Date: Wed, 1 Apr 2026 16:59:06 -0700 Subject: [PATCH] Hard code model for sheel tool samples --- .../02-agents/providers/openai/client_with_local_shell.py | 8 +++++++- .../02-agents/providers/openai/client_with_shell.py | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/python/samples/02-agents/providers/openai/client_with_local_shell.py b/python/samples/02-agents/providers/openai/client_with_local_shell.py index f4829cc5e7..1de710c9d4 100644 --- a/python/samples/02-agents/providers/openai/client_with_local_shell.py +++ b/python/samples/02-agents/providers/openai/client_with_local_shell.py @@ -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, ) diff --git a/python/samples/02-agents/providers/openai/client_with_shell.py b/python/samples/02-agents/providers/openai/client_with_shell.py index 5043d8e4a1..6a501dea81 100644 --- a/python/samples/02-agents/providers/openai/client_with_shell.py +++ b/python/samples/02-agents/providers/openai/client_with_shell.py @@ -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()