openai-agents-python — system architecture (Runner loop, model boundary, tools, sandbox)

openai-agents-python — system architecture (Runner loop, model boundary, tools, sandbox) An architecture diagram generated by Archify. Your application · calls Runner.run · Architecture component Your application calls Runner.run Agent · config dataclass · Architecture component Agent config dataclass LLM API · Responses · Chat Completions · Architecture component LLM API Responses · Chat Completions RunState · JSON pause point · Architecture component RunState JSON pause point Session · history store · Architecture component Session history store Runner · while True over NextStep · Run loop (run.py + run_internal/) Runner while True over NextStep run_single_turn · build input · call model · Run loop (run.py + run_internal/) run_single_turn build input · call model Model adapter · items in, items out · Architecture component Model adapter items in, items out turn_resolution · classify · pick NextStep · Run loop (run.py + run_internal/) turn_resolution classify · pick NextStep Tool execution · approve · guard · invoke · Architecture component Tool execution approve · guard · invoke MCP servers · stdio · SSE · HTTP · Architecture component MCP servers stdio · SSE · HTTP SandboxRuntime · prepare SandboxAgent · Architecture component SandboxRuntime prepare SandboxAgent Sandbox session · UnixLocal · Docker · E2B … · Architecture component Sandbox session UnixLocal · Docker · E2B … Runner.run() each turn resolve per turn get_response HTTP / WS ModelResponse tool calls call_tool NextStep interruption load · save prepare_agent create · resume exec · files Run loop (run.py + run_internal/) Legend Frontend Backend Database Cloud Security External