OpenAI Agents
pip install isorun[openai]isorun_tools() returns a tuple of (tool_list, cleanup_fn). Pass
the tool list to Agent(tools=...) and call the cleanup function
when the agent loop is done. The tools share a single cached sandbox
so multi-turn state (cwd, env vars, files written by previous calls)
persists across tool invocations.
Example agent
from agents import Agent, Runnerfrom isorun.integrations.openai import isorun_tools
tools, cleanup = isorun_tools(image="python:3.12")
try: coder = Agent( name="coder", instructions=( "You are a senior Python developer. Use the code_interpreter " "tool to write and run Python that solves the user's task." ), tools=tools, ) result = Runner.run_sync(coder, "Compute 2**100 and explain the result.") print(result.final_output)finally: cleanup()What gets exposed
| Tool | What it does |
|---|---|
code_interpreter(code: str) | Executes Python in a Firecracker microVM with internet access, pip, and a full Python environment. Returns stdout/stderr. |
shell(command: str) | Executes a shell command in the same sandbox. Returns stdout/stderr. |
Both tools share the same underlying isorun sandbox, so state
created by shell (e.g. git clone, pip install) is visible to
subsequent code_interpreter calls and vice versa.
Custom config
tools, cleanup = isorun_tools( image="python:3.12", # any OCI image api_key="isorun_live_<region>_<id>_<hmac>", # default: ISORUN_API_KEY env var api_url="https://api.isorun.ai", sandbox_timeout=900, # auto-destroy after 15 min idle)