1
Start a Tool Execution
First, execute a tool as you normally would. The initial Copy the
202 Accepted response will contain a stream_url. This is the endpoint we’ll use to receive live events.Response
stream_url for the next step.2
Connect to the Event Stream
Now, you can connect to the
stream_url using any SSE-compatible client. The connection will remain open, and the server will push events as they happen.In the JavaScript
EventSource example, we pass the API key as a query parameter. Our server is configured to accept the API key from either the X-API-KEY header or a query parameter named api_key for SSE connections, as EventSource does not support custom headers.3
Understanding the Events
As the tool executes, you will receive a series of JSON objects. Each object contains an
event_type and a data payload. Here are the main event types:tool_update: A general progress update. Thedatapayload often containsphaseandmessagefields to describe the current state.tool_partial_update: A chunk of streaming content. Thedatapayload contains acontentfield with the text.final_result: The final event of a successful execution, containing the completeoutputsin thedatapayload.tool_input_required: Sent when an interactive tool needs user input.error: Indicates that an error occurred during execution.
Example Event Stream

