Skip to main content

Stream events

GET /v1/sessions/{sessionId}/events
Server-Sent Events (SSE) stream of real-time agent activity. On connect, replays all past events from the session, then streams live events as the agent works.
api_key
string
required
OpenComputer API key (since EventSource can’t set headers)
user_id
string
Filter by user ownership

Example

const es = new EventSource(
  "https://api.opencomputer.dev/v1/sessions/session_abc123/events?api_key=osb_your_api_key"
);

es.onmessage = (event) => {
  const data = JSON.parse(event.data);
  console.log(data.type, data);
};

Event types

TypeDescription
assistantAgent response with message.content blocks (text, tool_use)
tool_use_summarySummary of a tool call (tool field)
turn_completeAgent finished processing the current message
resultFinal result of a turn
errorSomething went wrong
readyAgent process initialized
configuredAgent configured with tools/prompt

Example assistant event

{
  "type": "assistant",
  "message": {
    "content": [
      { "type": "text", "text": "I'll create a Next.js app with a todo list..." },
      { "type": "tool_use", "name": "bash", "input": { "command": "npx create-next-app@latest . --ts --tailwind --yes" } }
    ]
  },
  "session_id": "claude_session_xxx"
}