Watch product events
Product events report state changes in your Runtype organization that someone might need to act on, such as a failed run or an Agent that waits for approval. You read them by polling GET /v1/events with a cursor. A script, a coding agent, or a terminal monitor can react to them without a public webhook endpoint.
Event types
Runtype records the following event types. Each one accepts its own set of filters:
Each event has an eventId, a name, a timestamp, a cursor, and a data object. The data object holds resource IDs and short summaries, not full content. Error messages have secrets redacted and are truncated to 500 characters.
A failed run’s data carries runType, which is agent or flow.
On a host without MCP Tasks, delegated task events let an MCP host or script wait for a task that it started with delegate_to_runtype without holding a check_delegation call open. Treat each one as a wake-up signal: the event carries the taskId, the task page as taskUrl, and the question, summary, or error truncated as described above. To read the full result, call check_delegation or GET /v1/delegate-tasks/{taskId}. An API key needs DELEGATE_TASKS:READ or DELEGATE_TASKS:WRITE to read these events.
A fired signal’s data carries the executionId, agentId, signalSetId, the set version, the signal key, its confidence, the sample (uniform when the turn was drawn at random), and the run page as traceUrl. A choice signal also carries the chosen option as value. Other signal types carry no value, so the event never includes an extracted answer. When a later export of a trace corrects its built-in facts, only the keys that the correction newly fires produce an event. An API key needs SIGNALS:READ or SIGNALS:WRITE to read signal events.
An API key request’s data carries the requestId, the status (approved, declined, expired, or cancelled), and decidedAt. An approved request also carries claimExpiresAt. Redeem the key before that time, which is 10 minutes after the approval. The event never carries the requested key name, the reason, the key, or the PKCE challenge. An agent that filed a request can wait for the decision with wait_for_event, the name runtype.api_key_request.decided, the arguments { "requestId": "REQUEST_ID" }, and the cursor "0", so a decision recorded before the call is still returned. If no event arrives by the request’s expiresAt, read the request once with claim_api_key or GET /v1/api-keys/requests/{id} and stop waiting: that read records the expiry. A key with API_KEYS:READ reads the events for every request in the organization. Any other key reads only the events for the requests that it filed, the same requests that it can read with GET /v1/api-keys/requests/{id}.
A completed eval run’s data carries passRate and previousPassRate, both from 0 to 1. Its regressed field is true when passRate is lower than the pass rate of the suite’s previous completed run.
How the event log works
Runtype keeps one event log for each organization. Every event gets a cursor: a decimal string that increases with each event in the organization. You pass the last cursor that you received back to the API, and the API returns the events after it in order. If you store the cursor, a restarted poller resumes where it stopped and receives each event once.
The log keeps events for 7 days. Product events require an organization workspace. A request from an account without one returns 403.
Before you begin
To call the endpoints, you need a Runtype API key. For steps to create one, see Authentication.
An API key reads only the event types that its scopes cover. Each type lists these scopes in requiredScopes. For runtype.execution.failed, a key with AGENTS:READ gets failed Agent runs, and a key with FLOWS:READ gets failed flow runs. A key with both scopes gets both. Every key can read runtype.api_key_request.decided for the requests that it filed. A key that holds no other event scope must name that type in name; a read of every type by such a key returns 403.
Discover event types
To list the event types with their schemas, send a request to GET /v1/events/types:
Replace YOUR_API_KEY with your Runtype API key. Each entry in events has a name, a description, a delivery array (["poll"]), an inputSchema, and a payloadSchema. The inputSchema is the JSON Schema of the filters that the event accepts. The payloadSchema is the JSON Schema of its data.
Poll for events
To follow failed runs of one Agent, follow these steps:
-
Get the current cursor. Omit
after, so the read starts from now:cURLReplace
YOUR_AGENT_IDwith the ID of the Agent. The response returns no backlog, only the cursor for the current position: -
Pass the cursor as
after, and setwaitMs=50000to hold the request open:cURLThe request returns when a matching event exists. If none arrives within 50 seconds, it returns an empty
eventsarray. -
Store the
cursorfrom the response. The cursor moves past events that your filters exclude, so store it even wheneventsis empty. -
If
hasMoreistrue, send the next request right away. Otherwise, waitnextPollMsmilliseconds before the next request.
The response contains the following fields:
events: the matching events afterafter, oldest first.cursor: the value to pass asafteron the next request.truncated:truewhenafteris older than the 7-day retention window ormaxAgeMs, so the log skipped events.hasMore:truewhen more events matched thanmaxEventsallows.nextPollMs: the suggested wait before the next request, 5000 by default.
The following TypeScript loop runs the same steps with fetch:
To resume after a restart, persist cursor and load it before the loop starts.
Query parameters
GET /v1/events accepts the following query parameters:
Filter events
Each event type accepts only the filters in the event types table. A filter that the type doesn’t accept returns INVALID_EVENT_ARGUMENTS. When you omit name, the request accepts every filter.
Two filters change which events of a type you get, rather than matching an ID:
onlyRegressions=truekeeps only eval runs whereregressedistrue. If you omitname, events of other types still pass through.keykeeps only signal events for that signal key, such aspromised_followup. If you omitname, events of other types are dropped.minIntervalMsapplies to execution failures and fired signals only. For each Agent or flow anderrorClass, it keeps the first failure and drops repeats within that many milliseconds. For each Agent, signalkey, andvalue, it does the same for fired signals. It compares events within one response only, so a repeat in a later poll still arrives. The maximum is 86400000 (24 hours).
Handle errors
The endpoints return the following errors:
A truncated response isn’t an error. It means that your cursor was older than the oldest event in the log, and you missed the events in between. To find the runs that you missed, use List runs.
Watch events from MCP and the CLI
The same event log is available outside the REST API:
- The Runtype MCP server offers the
list_event_types,poll_events, andwait_for_eventtools. It also answers the draft MCP Events methods. For details, see Watch product events from MCP. - The
runtype events watchCLI command long-polls the log and prints one line per event. With--json, it prints one JSON object per line. For details, see Watch product events from the CLI.
Next steps
- Poll product events: review the endpoint’s full request and response schema
- Running an eval: start the eval runs that
runtype.eval.run_completedreports - Improving your agents from production traces: turn the failures that you find into eval cases