POST when something changes in your org’s sessions and tasks, including the browser and computer tasks your agents start in conversations, and when a conversation asks for an approval or an answer. Each org has one endpoint.
A reply doesn’t send webhooks: it’s the answer to your /responses call, and you follow a long one by streaming or with GET /v1/responses/{response_id}?wait_ms=. What a conversation asks does. Every question and approval is asked in a conversation (a task’s too: every task has one), so conversation.approval_required and conversation.question_asked are a good way to hear that something is waiting for your team, and conversation.approval_decided and conversation.question_answered that it was decided. The tasks a conversation starts send task.* webhooks, with the conversation_id and response_id in task.metadata.
Set the endpoint
Set it in the console (Settings → API → Webhooks), or withPUT /v1/webhook. Leave events empty to get every type, or list the ones you want; an unknown type is a 400. Only the fields you send change: leave out url to keep the endpoint, leave out events to keep the filter, and send { "url": null } to remove the endpoint. It needs the admin role or an API key.
Response
- To rotate the secret, send
{ "rotate_secret": true }(the URL and events stay as they are). The old secret stops working at once, so deploy the new one to your receiver first or accept both for a moment. - To remove the endpoint, send
{"url": null}. GET /v1/webhookreturns the currenturl,events,has_secretand the list ofevent_types.
Public HTTPS only
The URL must usehttps and resolve to a public address. Private and local addresses (10.x, 127.x, 172.16–31.x, 192.168.x, localhost, *.local, *.internal and the like) are refused with 400 invalid_request, and the check runs again on every delivery. Redirects are not followed. For local development, expose your receiver through a tunnel with a public HTTPS URL.
Event types
Each question or approval sends its pair of events, however many a conversation asks. An endpoint whose filter was saved with the older task types (
task.waiting_for_approval, task.approval_decided, task.waiting_for_user, task.question_answered) gets their conversation.* replacements, and reads and saves them under the new names. In auto mode a task’s steps are approved without asking, so they send none; nor does a request the agent’s guardrails decide as it’s asked (auto or unattended mode), which asked nobody. Eval runs’ sessions, tasks and conversations send no webhooks: test_run.completed tells you when a run is done.
data.conversation is the conversation as the API returns it; for a task you started, its metadata.task_id names the task. data.question and data.approval are its item as the API returns it, with who decided and when: use it to close the request in your own tool when someone else decided it first. by.type is team (with email or key_id), person, auto, refused, timeout or moved_on.
conversation.approval_decided does the same for approvals: approval.decision has the decision (approve or deny), by, at and the note, if there is one.
by.type is timeout when nobody decided within the agent’s approval_timeout_minutes. The approval was denied, and note says how long it waited:
Payload
Every event has the same envelope.data.task, data.session and data.conversation are the same objects the API returns. A finished task’s event is sent once its cost is settled, so its usage and cost_cents are final.
metadata to find your ticket, and id to ignore an event you’ve already handled.
Verify the signature
Every request has aEager-Signature header:
t is the Unix time the request was signed. v1 is the hex HMAC-SHA256 of "{t}.{raw body}", keyed with your endpoint’s whole secret (including the whsec_ prefix). To verify:
- Read the raw request body, before any JSON parsing. Re-serialized JSON won’t match.
- Compute the HMAC of
t, a., and the raw body with your secret. - Compare it with
v1in constant time. - Reject the request if
tis more than 5 minutes from your clock. This stops replays of old requests.
2xx quickly and do slow work afterwards, so the delivery doesn’t time out.
Delivery and retries
- Each delivery waits up to 10 seconds for your answer. Any
2xxcounts as received. - On a timeout, a network error or any other status (including
3xx), Eager retries up to 4 times, after about 5 seconds, 20 seconds, 1 minute and 2 minutes: about 3 minutes in total. Then it gives up on that event. - A retry sends the same body with the same
id, and a freshtand signature. - Events can arrive out of order, and more than once. Use
idto skip duplicates, and trust thestatusandupdated_atinsidedatarather than the order of arrival. When in doubt,GETthe task or session.
GET /v1/tasks to catch up.