New Shell Tool for Agent Execution
OpenAI has extended the Responses API with a shell tool that allows models to propose and execute shell commands within an isolated container environment. Unlike the existing code interpreter which only supports Python, the shell tool enables execution of any Unix-based commands and programs—including Go, Java, Node.js, and standard utilities like grep, curl, and awk. This dramatically expands the types of workflows models can orchestrate.
Enhanced Agent Loop Architecture
The Responses API now orchestrates the complete agent loop without requiring developers to build custom execution infrastructure:
- Model proposes shell commands based on the task at hand
- API service forwards commands to the container runtime and streams output back
- Model inspects results and decides on next steps (additional commands or final response)
- Loop continues until the model completes the task
The API supports concurrent command execution across separate container sessions, allowing agents to parallelize work like file searching, data fetching, and validation simultaneously.
Context Management and Output Control
To prevent context window overflow during long-running tasks, the system implements intelligent output truncation. Developers can specify output caps per command, with the API preserving both the beginning and end of results while marking omitted content. This keeps agents focused on relevant information rather than overwhelming them with raw logs.
Practical Infrastructure for Production Agents
The hosted container environment provides:
- Isolated filesystem for inputs and outputs
- Optional structured storage like SQLite databases
- Restricted network access to avoid security issues
- Automatic timeout and retry handling
- Context compaction to preserve key details across extended agent runs
These capabilities address real pain points developers face when building agentic systems: managing intermediate files, handling large data tables without prompt bloat, securing network access, and maintaining context across complex workflows.
Availability
The shell tool is available in GPT-5.2 and later models, which are specifically trained to propose shell commands as part of the agentic workflow.