open source · self-hosted · OpenAI Agents API
An open-source, self-hosted implementation of the OpenAI Agents API. Run Codex, Claude Code or MiniMax Code with your own models, on your own machines, through the official OpenAI SDK.
$ curl -fsSL https://github.com/MiniMax-AI/OpenAgentCore/releases/latest/download/install.sh | bashLinux amd64 · Docker · Python 3.9+
An agent reads files, runs commands, waits for tests and asks for approval. A single model response is one step of that. Put it inside a product and a new set of questions appears.
?The user closed the tab. What happens to the work already submitted?
→A dropped connection is an observer leaving. The Turn keeps running; read its durable state.
?The request timed out. Send it again, or look up the original?
→Poll durable state. Supported submission paths are idempotent, so a lost response does not duplicate work.
?The user pressed Stop. Did the output stop, or the agent and everything it started?
→Cancellation has a receipt: Core confirms the Turn's execution and cleanup state.
?Which model and which machine ran this? Where are the files and the log?
→Sessions, Turns, Items, artifacts and usage are stored by Core and queryable through the API.
?Switching from Codex to Claude Code, or Docker to E2B. How much product code changes?
→Your code keeps the same API calls. The harness is a Session setting with a matching model provider, and the sandbox is the administrator's choice, behind a Sandbox Provider.
Between an agent that works in a terminal and an agent a product can call, there is a whole layer of engineering. OpenAgentCore is that layer.
They are three different decisions. Each Session names its harness, its model provider and its Environment; Core validates the combination before anything runs.
1from openai import OpenAI
2
3client = OpenAI() # OPENAI_BASE_URL → your Core
4
5session = client.beta.agents.sessions.create(
6 environment={"type": "openai_hosted"},
7 input="Fix the failing test and explain the change.",
8 extra_body={
9 "agent": {"model": MODEL, "x_agents_core": {"harness": "codex"}},
10 "x_agents_core": {"model_provider": {
11 "protocol": "responses",
12 "base_url": BASE_URL, "api_key": API_KEY,
13 }},
14 },
15)
The supported combinations are declared by each harness, not guessed. Harness capabilities →
Point the official OpenAI SDK, or plain HTTP, at your installation. No new client to learn.
Each Session runs a native harness: Codex, Claude Code or MiniMax Code, with the model provider you configure.
A managed sandbox (Docker, microsandbox or E2B), or your own Linux, macOS or Windows machine.
Sandboxes, harnesses and model providers plug in through defined protocols. Swap one without touching Core.
Core keeps durable execution state and schedules work. The Runtime prepares the Environment and starts the native harness. The harness calls the model and tools, and reports back through the Runtime.
A Session is a continuing piece of agent work; a Turn is one input executed inside it. Both have identities and durable state. Four rules decide what "running", "waiting", "cancelled" and "failed" mean.
Closing the stream only removes an observer. Submitted work stays with the execution system.
Supported submission paths carry a stable key, so a lost response never creates the work twice.
Closing output proves nothing. Core confirms the target Turn's execution and cleanup.
A Turn ending, the executor closing and the Environment being reclaimed are separate lifecycles.
!Recovery has limits, and they are explicit: an unknown outcome is never reported as success.
Web is the operator console: Sessions, node capacity, work waiting for the caller, errors, latency, tokens and tool calls, per Project.
Screenshot values are illustrative. Usage visibility depends on what each native harness reports.

| approach | fits when | you still own |
|---|---|---|
| Call a model API | One-off inference, or you want full control of the agent loop | Context, tool execution, the loop and the whole task lifecycle |
| Call a native CLI or SDK | Personal automation, or one integration around one harness | Session mapping, processes, resources and every engine's differences |
| Use a sandbox service | You need an isolated computer | The agent engine, execution, interaction, records and the product API |
| Use OpenAgentCore | Self-hosted, many native harnesses and environments behind one API | Business permissions, product experience, team orchestration and operating your installation |
State belongs to the infrastructure.Intelligence belongs to the harness.
The Runtime and the native harness run inside the Environment; Core holds the durable control plane. Native engines are reused as-is, so the Environment, native history and recovery still matter.
A capability one harness supports is not silently granted to another. Core checks each combination before running, rejects what is unsupported and records what is unverified.
Callers think in tasks, input, state and results. Machine connections, native executors and cleanup belong behind clear component boundaries. The interface is the product.
On a Linux amd64 host with Docker and Python 3.9+:
Use the Core key the installer created, then configure the domain and HTTPS.
Then issue a Project API key for your application.
A node, E2B, or your own machine.
With the official OpenAI SDK, against your own Core.
OpenAgentCore is pre-release; support is qualified per harness, environment and operation. The next layers we are working toward:
Run the agent loop on the server and tool execution on a local machine or a cloud sandbox, with enterprise authorization at the tool layer.
Separate compute from storage, restore state quickly and scale sandbox capacity on demand.
S3, OSS, shared file systems and agent-native file systems.
Keep building real products on the public API, the same way any application uses it.
21 pages, listed straight from the repository's docs.json. New guides appear here when they are added.
Products differ in interaction, model and engine. They can share one execution layer.