Agent Sessions
Session is the primary runtime object in the current Agent layer.
If you remember only one thing, remember this:
- the agent definition is durable
- the environment is reusable
- the session is what actually runs
- what a session really owns
- what wake semantics mean
- what remains isolated per session
- what can be shared across many sessions for the same Agent
What a session owns
A session owns:- one
sessionId - one
agentId - one
environmentId - one append-only event stream
- one isolated runtime memory directory
- one attached resource list
- one stop reason and status
- optional
parentSessionIdmetadata when it is a delegated child session
- broader domain truth outside the session model
- other sessions for the same agent
Status model
The current status model is:idlerunningreschedulingterminated
idlerequires_actionreschedulingterminated
requires_action is how the runtime pauses for custom tool results without inventing a separate approval system in the Agent core.
It now also covers managed tool confirmation requests for always_ask tools.
Event model
Each session has an append-onlyevents.jsonl.
Current event families:
user.messageuser.define_outcomeuser.interruptuser.tool_confirmationuser.custom_tool_resultsession.status_changedsession.status_idlespan.startedspan.completedagent.messageagent.tool_useagent.custom_tool_use
processedAt == null
user.interrupt is the redirect seam.
When it arrives before the next wake, the runtime clears blocked confirmation/custom-tool state and drops queued revisits before continuing the bounded run.
This is the reason wake(sessionId) can stay small.
Orchestration does not need to carry the whole prompt payload because the session already contains the unprocessed work.
The current runtime also treats the session as an interrogable context object.
That means the harness can:
- reread recent processed history
- rewind around a specific anchor event
- query only selected event families
- reopen other sessions for the same agent through managed tools
Storage layout
Each session lives here:session.json- canonical durable state
events.jsonl- append-only event journal
runtime/- local continuity for the harness
wake-queue.jsonl- internal revisit scheduling
Session isolation
Multiple sessions can exist for the same agent. That is important because:- one agent may have many distinct threads of work
- context isolation matters
- one bad thread should not contaminate another
- learnings can be shared at the agent level without sharing runtime scratch state
- event history
- runtime memory
- pending custom-tool request
- pending tool-confirmation request
- wake queue
- child-session execution context
- workspace substrate
- agent definition
- agent-level learnings
- vault references
session_delegate- creates a direct child session
session_list_children- enumerates direct children for a parent session
session_run_child- advances one direct child for a few bounded cycles
.openboa-runtime/session-relations.json.
Event ingress and wake semantics
The public ingress surface is the session event log. That means external callers should:- append a
user.message,user.interrupt,user.tool_confirmation, oruser.custom_tool_result - let orchestration consume that pending work
wake(sessionId) is still public, but it is the low-level execution seam, not the primary registration surface.
The execution seam is:
- load the session
- read pending events
- if nothing is pending and no revisit is due, do nothing
- otherwise run one bounded harness cycle
- provider-specific logic
- application-specific routing semantics
- exact context assembly rules
Proactive revisits
Sessions are not only passive containers for incoming work. The current runtime also lets a session request its own later revisit through queued wakes. That means:- one bounded run can ask for another bounded run later
- revisit scheduling is stored durably in
wake-queue.jsonl - the same session remains the truth-bearing object across those revisits
- new session events act like immediate activations
- queued wakes act like delayed activations
- a worker loop consumes both without changing the session-first model
- a hidden background process invents new state outside the session
- a second secret coordination system exists outside the event log
Learning versus session state
Sessions also produce experience, but that experience should not all remain as session-local scratch state. The runtime distinguishes:- session-local continuity
- checkpoint, session-state, working-buffer
- agent-level learning
- lesson, correction, error capture
- shared memory promotion
- selected durable learnings promoted into
MEMORY.md
- selected durable learnings promoted into
- session-local continuity should stay thread-specific
- learnings should be reusable across sessions
- promoted memory should remain curated instead of becoming a transcript dump
CLI
Create a session:environment_describevault_listpermissions_describesession_listsession_list_childrensession_get_snapshotsession_get_eventssession_get_tracesession_run_childmemory_listoutcome_readoutcome_define
checkpoint, shell_state, session_state, and working_buffer, so the model can discover durable session memory without guessing fixed filenames.
Session events now also carry an optional wakeId, which lets the runtime reread one bounded harness run as a trace instead of only as positional slices.
session_get_trace now returns the full wake-bounded trace by default unless the caller explicitly applies a limit.
Wake traces also carry span.started and span.completed records for wake-level and tool-level execution.
If a bounded run fails unexpectedly, the runtime now still closes the wake trace with span.completed result=error and records a failure-flavored session.status_idle summary instead of leaving the session stuck in running.
Design rule
Any new Agent feature should answer this first: Does this belong on the session, or does it belong above the Agent layer? If it is:- transient runtime continuity
- pending execution work
- bounded tool pause/resume
- per-thread execution history
- broader coordination across many sessions
- external publication or delivery semantics
- governance or observation across many sessions