Session and Event

Updated at:

A Session is a running instance of an agent, bound to an agent snapshot and an environment, with its state machine driven by the platform. An Event is an atomic record inside a session, written by the client or pushed by the server through a subscription.

State machine

The session state field is status. State changes are pushed via the SSE session_status event — see Subscribe to Event SSE Stream.

State

Trigger

Next state

Allowed operations

idle

Session created, or the previous turn finished.

On message → running

Send message, archive, delete.

running

User message received; the agent has started processing.

On completion → idle; on unrecoverable error → terminated

Interrupt, approve a tool call, submit a function result.

terminated

Archive call, or an unrecoverable error.

Terminal state.

Query event history, delete the session.

Session operations

Operation

Endpoint

Description

Create Session

POST /sessions

Create a session, bound to an agent snapshot and a runtime environment; initial state is idle.

Retrieve Session

GET /sessions/{session_id}

Get session details, including the agent snapshot and current state.

List Sessions

GET /sessions

Paginated list of sessions under the workspace.

Update Session

POST /sessions/{session_id}

Update session metadata (title, metadata, and so on).

Archive Session

POST /sessions/{session_id}/archive

Soft archive; the session moves to the terminated terminal state.

Delete Session

DELETE /sessions/{session_id}

Hard delete; event history is removed and cannot be recovered.

Session resource operations

Operation

Endpoint

Description

Create Session Resource

POST /sessions/{session_id}/resources

Dynamically mount a file while the session is running; the server stores an internal copy. This operation does not produce a session event.

List Session Resources

GET /sessions/{session_id}/resources

Paginated list of resources currently mounted in the session.

Get Session Resource

GET /sessions/{session_id}/resources/{resource_id}

Get details of a single mounted resource in the session.

Delete Session Resource

DELETE /sessions/{session_id}/resources/{resource_id}

Unmount the specified resource from the session and remove its internal copy. This operation cannot be undone.

Event operations

Operation

Endpoint

Description

Send Event

POST /sessions/{session_id}/events

Inject an event into the session (user message, interrupt, tool approval, function result, and so on).

List Events

GET /sessions/{session_id}/events

Paginated list of event history in the session.

Subscribe to Event SSE Stream

GET /sessions/{session_id}/events/stream

Long-lived SSE connection that streams real-time events, including session_status state changes.