Deployments and webhooks
Built.
Scheduled deployments
A deployment starts a session on a schedule, with no client running.
const deployment = await client.beta.deployments.create({
name: "nightly",
agent: agent.id,
environment_id: environment.id,
initial_events: [{ type: "user.message", content: [{ type: "text", text: "Run the nightly check." }] }],
schedule: { type: "cron", expression: "0 2 * * *", timezone: "Europe/London" },
});
// deployment.schedule.upcoming_runs_at -> the next three run times
- Pause, unpause, archive or run one now with
POST /v1/deployments/{id}/…. - Every attempt writes a deployment run (
/v1/deployment_runs), whether or not a session started, so failures can be audited.
Webhooks
MAA addition: webhooks are managed through the API. They tell your server that something changed, so you do not have to hold a stream open.
POST /v1/webhooks
{ "url": "https://example.com/hook", "event_types": ["session.status_idle", "certificate.issued"] }
| Event type | When |
|---|---|
session.status_running, session.status_idle, session.status_terminated |
Status changes |
session.error |
A session failed |
session.thread_created, session.thread_idle |
A coordinator's threads |
span.outcome_evaluation_end |
A grader finished |
session.deleted, certificate.issued |
Deletion and its certificate |
deployment_run.created |
A scheduled run fired |
engagement.updated |
A Managed engagement changed |
* |
Everything |
Payloads carry ids and status only. They never contain message or tool content, so nothing from a session leaves the region through a webhook. Fetch the resource by id to read more.
Verify the signature
Each delivery has a header:
MAA-Signature: t=<unix seconds>,v1=<hex HMAC-SHA256(secret, "<t>.<raw body>")>
Compute the HMAC over the raw request body, compare in constant time, and reject anything where t is more than five minutes old.
Manage
GET /v1/webhooks · GET/POST/DELETE /v1/webhooks/{id} · POST /v1/webhooks/{id}/rotate_secret · POST /v1/webhooks/{id}/test · GET /v1/webhooks/{id}/deliveries (the delivery log, with retries)