Agent Harness
The harness is the bounded execution loop for one session run. It is the closest thing to the “brain loop,” but it is still not the whole runtime. Use this page when you want to answer:- what one bounded run actually does
- where provider output becomes durable runtime progress
- why proactive continuation and learning capture belong here
- what stays outside the harness
What the harness does
For one bounded run, the harness:- loads the session
- reads pending session events
- loads the environment and attached resources
- loads session runtime memory
- assembles context
- calls the provider backend
- interprets the loop directive
- appends new session events
- updates session state and runtime memory
- orchestration
- provider runner
- sandbox and tool execution
- session storage
What the harness does not do
The harness does not own:- public scheduling APIs
- application-specific routing
- external publication semantics
- broader domain truth outside the session model
- reusable environment definitions
Relationship to orchestration
The public orchestration seam is:- should this session be run now
- should a bounded revisit be queued
- what this run means
- which events to append
- whether the session should sleep, reschedule, or pause for action
Proactive behavior lives here
The harness is where bounded proactive continuation becomes real runtime behavior. The provider does not directly schedule timers. Instead, the provider emits a loop directive, and the harness interprets that directive into durable queued wakes. That means the proactive loop is:- provider suggests
queuedWakes - harness validates and resolves them
- wake scheduling is written durably
- orchestration later consumes the due wake
- the same session runs again
Relationship to providers
Provider backends such as Codex or Claude are swappable brains behind the harness seam. That means:- provider-specific runners are implementation details
- the harness is the stable runtime contract
- the session model should survive brain swaps
Loop directive
The current harness expects the provider response to resolve into:- plain-text response
- durable summary
- sleep or continue
- optional queued wakes
- optional learnings
- optional custom tool pause
queuedWakes- proactive continuation
learnings- runtime improvement
Custom tool pause
The harness can pause a session for a custom tool result. That path works like this:- the agent requests a custom tool
- the harness emits
agent.custom_tool_use - the session moves to
requires_action - the runtime waits for
user.custom_tool_result - the next wake resumes the same session
Runtime memory
The harness writes session-local continuity into:checkpoint.jsonsession-state.mdworking-buffer.md
- scratch state stays local to the session
- reusable lessons survive across sessions
Learning capture lives here
The harness is also where runtime experience becomes durable learning. The learning loop is:- provider emits
learnings - harness normalizes and deduplicates them
- learnings are written into the agent-level learn store
- selected learnings may be promoted into shared
MEMORY.md
Design rule
If a change is about:- context assembly
- interpreting pending events
- turning one provider result into durable session progress
- public session APIs
- wake scheduling policy
- external routing or publication semantics