Documentation

Streaming

Consume text, MCP calls, tool progress, and terminal state from the Responses event stream.

Set stream: true when creating a Response. The SDK returns an async iterable of Responses events.

const stream = await rebyte.responses.create({
  model: process.env.REBYTE_AGENT_ID,
  input: "Write a concise market brief.",
  stream: true,
});

for await (const event of stream) {
  if (event.type === "response.output_text.delta") {
    process.stdout.write(event.delta);
  }
}

Text events

A completed text output follows this order:

response.created
response.in_progress
response.output_item.added
response.content_part.added
response.output_text.delta             zero or more
response.output_text.done
response.content_part.done
response.output_item.done
response.completed

MCP events

Configured MCP calls use standard Responses events:

response.output_item.added
response.mcp_call_arguments.delta      when arguments are non-empty
response.mcp_call_arguments.done
response.mcp_call.in_progress
response.mcp_call.completed            or response.mcp_call.failed
response.output_item.done

Rebyte tool progress

Rebyte adds optional execution detail that generic Responses clients may ignore:

response.rebyte_tool_call.started
response.rebyte_tool_call.progress
response.rebyte_tool_call.action_required
response.rebyte_tool_call.failed

Ordering and completion

Every JSON event has a strictly increasing sequence_number. The SSE stream ends with data: [DONE]. A terminal execution failure emits response.failed before [DONE].

The stream is a delivery channel, not the source of durable final state. After a disconnect, retrieve the Response by ID.