How it works
There are two ways to monitor agent performance through the Agent Platform:- Agent Platform SDK (Real-time monitoring): Subscribe to live updates as your agent runs. With our SDK, you can track event changes as they happen, status updates, and more.
- Agent Platform API (Post-run and real-time analysis): Use the trajectory endpoints to view your agent’s performance during and after it finishes running. You can retrieve a complete log of events, including thoughts, actions, answers, and screenshots associated with a specific trajectory ID. Use the
GET /api/v1/trajectories/{id}/changes
to retrieve new events.
View an event via SDK
The Agent Platform allows you to listen to events, check for status updates, and more. The following snippets show you how to monitor events using our Agent Platform SDK:Step 1: Start the task
UseexecuteWebTask()
to run your task. For example:
Step 2: Listen to events
Execute one of the following commands to view and/or monitor agent performance through events:Step 2a: Monitor real-time updates (Optional)
Step 2b: Track status changes (Optional)
Check when a task’s status changes (e.g., frompending
to running
, or completed
):
Step 2c: Handle errors (Optional)
Listen for task errors as they occur:View an event via API
A trajectory is the recorded sequence of actions taken by the agent during a task, including detailed event data. You can monitor and analyze an agent’s activity by retrieving a trajectory through the Agent Platform’s APIs. Each trajectory contains a list of time-stamped events that describe every action the agent performed during a task.Step 1: Identify the trajectory ID
After you start a task using the Agent Platform, you’ll receive a uniquetrajectory_id
. The trajectory ID is the task or agent’s “run” and you’ll need it to fetch event data.
Step 2: Retrieve the trajectory
Use thetrajectory_id
to make an API request and fetch the full execution data for the task:
Step 3: View the events
Theevents
array in the trajectory API response contains the full event log for the task — showing what the agent thought, did, and ultimately answered.
You can access it like this:
Event properties
The following table defines key event properties.Property | Type | Description |
---|---|---|
type | string | The high-level event category. For example: "ChatMessageEvent" , "AgentStartedEvent" , "AgentCompletionEvent" , "WebActionEvent" |
timestamp | string (ISO 8601) | When the event occurred, in UTC timestamp format. |
data | object | Details specific to the event type. For ChatMessageEvent , this includes a nested type , content , and other fields. |
data.type | string | A more specific sub-type of the event, for example "answer" , "thought" , "notes" , "screenshot" , "action" , "last_url" . |
data.content | string | The actual message, screenshot URL, user action description, or other content depending on data.type . |
data.sender_id | string | Identifies who produced the message ("agent" , "user" , etc.). Present in most ChatMessageEvent types. |
data.extra_content | object | (Optional) Additional structured data. Currently often empty ({} ), but can be used for extensibility. |
Event types
The following table defines key event types. The list of available event types may expand over time.Property | Type | Description |
---|---|---|
ChatMessageEvent | string | Triggered when a message is sent or received in a conversation. |
AgentStartedEvent | string | Indicates that an agent has been initialized and begun execution. |
AgentCompletionEvent | string | Signals that an agent has finished its task or produced a final response. |
WebActionEvent | string | Describe web actions with pre and post action screenshots in a structured manner. |