Coming soon. Current thinking, not a shipped contract. Today the only runtime is
claude; custom runtimes are the extensibility seam — claude itself is just the first runtime built on this contract.runtime: "<name>", and nothing else about the session changes.
The contract
The platform invokes your image once per turn and passes it (via env) the session id, the read cursor, the events API URL, and a fenced turn token. Per turn the image:- reads the new input from the event log at the cursor;
- drives its own agent loop;
- streams events back to the session over the authenticated events API — the turn token is fenced, so if the platform has superseded this instance its writes are rejected and a stale machine can’t corrupt the log;
- performs all side effects through the remote sandbox tools — it has no local disk or network of its own; the sandbox is the boundary;
- exits 0 when it has nothing left to do (yield, don’t block). A non-zero exit is treated as a crash, and the platform restarts the turn in place.
State and recovery
The image carries no durable state. The durable record is the event log plus the runtime’s on-box journal. Keep your resumable state in the journal directory the platform provides and you inherit the same durability asclaude: a crash restarts from the journal, an idle session hibernates and is checkpointed, and a lost machine is recreated and restored.
Models
The model is configuration, not part of the image. A runtime declares which providers it can drive; switching across providers needs an image that drives the target (the plannedopencode aims to drive all).
Distribution
You register a runtime withoc runtime push <image> and select it with runtime: "<name>". Runtimes are versioned and a session pins the version it runs, so pushing a new build never affects in-flight sessions — the same mechanism behind the prebuilt claude, codex, and opencode images.