← Back
OpenAI
OpenAI adds shell execution and container workspace to Responses API, enabling autonomous agents to run real-world tasks
OpenAI APIOpenAI · releasefeatureapiplatform · openai.com ↗

Shell Tool for Agent Execution

OpenAI has introduced a shell tool to the Responses API that allows AI models to propose and execute shell commands in an isolated container environment. Unlike the existing code interpreter limited to Python, the shell tool supports the full Unix toolchain—including grep, curl, awk, and other standard utilities—enabling agents to run arbitrary programs, start servers, and interact with system-level APIs.

Orchestrated Agent Loop

The Responses API now orchestrates an autonomous loop between the model and hosted container execution:

  1. The model receives a prompt and decides whether to execute shell commands
  2. The API forwards proposed commands to the container runtime
  3. Output streams back in near real-time to the model
  4. The model inspects results and either issues follow-up commands or returns a final answer

This tight feedback loop allows agents to handle complex, multi-step workflows without human intervention.

Concurrent Execution and Context Efficiency

The platform supports parallel command execution across separate container sessions, allowing agents to search files, fetch data, and validate results simultaneously. To prevent context window overload from large outputs, the API enforces configurable output caps per command while preserving both the beginning and end of truncated output—enabling agents to stay context-efficient during long-running tasks.

Solving Practical Agent Problems

OpenAI designed this system to address real challenges developers face when building agents:

  • Persistent storage: Filesystems and optional SQLite databases for intermediate data
  • Network access: Restricted, controlled API access without security headaches
  • Timeouts and retries: Built-in handling without requiring custom workflow frameworks
  • Context management: Output bounding and session handling to keep reasoning coherent across turns

The solution is available now through the Responses API for GPT-5.2 and later models trained on shell command execution.