I would like to request better interoperability between the Hosted Shell tool and Code Interpreter in the Responses API.
At the moment, these two tools cannot be enabled together in the same request. If both are included, the API returns an error indicating that Hosted Shell and Code Interpreter cannot be used at the same time.
This becomes a practical limitation because the Python environments provided by the two tools are very different.
Code Interpreter comes with a large number of commonly used Python packages preinstalled, while Hosted Shell has a much more minimal Python environment by default.
Hosted Shell does support installing additional packages with pip, and packages can persist when reusing the same container. However, this does not fully solve the problem.
The main issue is cold-start latency.
For agents that need libraries such as pandas, scipy, openpyxl, matplotlib, scikit-learn, lxml, or other commonly used packages, installing several dependencies during the first turn can add significant latency before the agent can actually start working.
Container reuse helps on subsequent requests, but the first request still pays the installation cost.
This creates an awkward trade-off:
-
Code Interpreter provides a rich, ready-to-use Python environment.
-
Hosted Shell provides more general-purpose shell capabilities.
-
Developers currently have to choose one or the other.
-
Using Hosted Shell as a replacement for Code Interpreter can require installing many packages dynamically.
-
Installing those packages adds first-turn latency that Code Interpreter avoids.
Ideally, I think one of the following solutions would address the issue.
Option 1: Allow Hosted Shell and Code Interpreter to coexist
Allow both tools to be enabled in the same Responses API request:
tools=[
{
"type": "shell",
"environment": {
"type": "container_auto"
}
},
{
"type": "code_interpreter",
"container": {
"type": "auto"
}
}
]
It would be even better if both tools could optionally operate on the same underlying container or filesystem.
This would let the model use Code Interpreter for Python/data-analysis workloads while still using Hosted Shell when general shell access is required.
Option 2: Provide Python environment parity in Hosted Shell
If supporting both tools simultaneously is not desirable, another solution would be to make the default Python environment in Hosted Shell closer to the one provided by Code Interpreter.
For example, Hosted Shell could include the same commonly used Python packages that are already available in Code Interpreter.
This would make Hosted Shell a much more practical replacement without requiring agents to spend time installing dependencies at runtime.
Option 3: Support cached or preconfigured dependency sets
Another possible solution would be to allow developers to declare Python dependencies when creating a container, for example:
{
"type": "container_auto",
"python_packages": [
"pandas",
"scipy",
"openpyxl",
"matplotlib"
]
}
OpenAI could then prepare or cache an environment containing those dependencies instead of requiring pip install during the agent’s first execution.
This could provide most of the benefits of Code Interpreter’s preinstalled environment while still keeping Hosted Shell flexible.
Why this matters for agents
For interactive agents, first-turn latency is particularly important.
A human user notices immediately if the agent spends a significant amount of time installing dependencies before performing the requested task.
In many cases, the agent may also not know in advance exactly which Python packages it will need, so application-level preinstallation is not always straightforward.
Hosted Shell is extremely useful because of its general-purpose execution capabilities, but the current difference in preinstalled Python packages makes replacing Code Interpreter with Hosted Shell more costly than it initially appears.
Since the API currently prevents using both tools together, developers are effectively forced to choose between:
a richer Python environment
or
a more capable general-purpose shell environment.
It would be great if those capabilities could either coexist or if Hosted Shell could provide a Python environment closer to Code Interpreter.
Thanks for considering it.