Durable sessions
Stream ordered events, switch harness mid-session, and pick up where you left off.
-
Send work and stream replies
Every event has a monotonic sequence number. Disconnects never stop a turn.
Read the docsawait client.sessions.events.send(session.id, { events: [{ type: "user.message", content: [{ type: "text", text: "Summarize the open ticket." }] }],}) for await (const event of await client.sessions.events.stream(session.id)) { if (event.type === "agent.message") console.log(event.content.map((b) => b.text).join("")) if (event.type === "session.status_idle" || event.type === "session.status_terminated") break}curl -N --fail-with-body "$CHECKFU_BASE_URL/v1/sessions/$SESSION_ID/events/stream" \ -H "Authorization: Bearer $CHECKFU_API_KEY"SESSION_ID=$(checkfu sessions create --agent "$AGENT_ID" --environment-id "$ENVIRONMENT_ID" --transform id -r)checkfu sessions connect "$SESSION_ID"{ "name": "sessions_sendSessionEvents", "arguments": { "path": { "session_id": "sess_123" }, "body": { "events": [{ "type": "user.message", "content": [{ "type": "text", "text": "Summarize the open ticket." }] }] } }}events: - type: user.message content: [{ type: text, text: "Summarize the open ticket." }] -
Resume from any cursor
Reopen a stream with after or Last-Event-ID to continue without missing events.
Read the docsfor await (const event of await client.sessions.events.stream(session.id, { after: lastSeq })) { if (event.type === "agent.message") console.log(event.content.map((b) => b.text).join("")) if (event.type === "session.status_idle") break}curl -N --fail-with-body "$CHECKFU_BASE_URL/v1/sessions/$SESSION_ID/events/stream" \ -H "Authorization: Bearer $CHECKFU_API_KEY" \ -H "Last-Event-ID: 42"checkfu sessions:events stream --session-id "$SESSION_ID" --after "$LAST_SEQ"{ "name": "sessions_listEvents", "arguments": { "path": { "session_id": "sess_123" }, "query": { "limit": 50 } }}after: 42 -
Switch harness mid-session
Pick another harness or model while idle. History, mounts, and files stay intact.
Read the docsawait client.sessions.selectRuntime(session.id, { harness: "codex", model: "gpt-5.4",})curl --fail-with-body -X POST "$CHECKFU_BASE_URL/v1/sessions/$SESSION_ID/runtime" \ -H "Authorization: Bearer $CHECKFU_API_KEY" \ -H "Content-Type: application/json" \ -d '{"harness":"codex","model":"gpt-5.4"}'checkfu sessions select-runtime \ --session-id "$SESSION_ID" \ --harness codex --model gpt-5.4{ "name": "sessions_selectRuntime", "arguments": { "path": { "session_id": "sess_123" }, "body": { "harness": "codex", "model": "gpt-5.4" } }}harness: codexmodel: gpt-5.4
Managed agents for any harness
Pick the harness and model. Checkfu runs everything around them.