Skip to main content
OpenAI’s Agents API runs the agent on OpenAI’s servers. With a self_hosted environment, its shell commands, file reads and patches run in a Mirage workspace, under the workspace’s profile and mount modes. No sandbox holds the files. The workspace connects through Codex’s exec-server relay, set up on the Codex page. The Agents API is in beta.

Install

Workspace

/workspace, where OpenAI’s examples work, is scratch space in memory. /redis keeps what the agent saves there after the workspace closes, which needs a Redis server and the redis package next to the CLI:
workspace.yaml

Create a session

Connect the workspace

Hand the session’s environment.id and environment.remote_url, with an environment key, to codex exec-server forward pointed at workspace demo. The agent’s commands then run in the workspace, and what it writes lands in its mounts.

Run a task

Open the session’s event stream, then send the task. The agent’s reply streams back while its commands run in the workspace:
The report stays in Redis after the session ends:

Example

examples/typescript/agents/openai_agents_api/redis_report.ts runs the whole flow: it seeds /workspace/orders.csv, starts mirage codex-exec and codex exec-server forward, sends the task and prints the report.