Skip to content
ArgusDocs
MenuTriggers and webhooks

Triggers and webhooks

Start sessions on a schedule or from a signed webhook, and receive signed events when things happen.

View as Markdown

On this page

Sessions do not have to be started by a person. Argus has two ways in and one way out.

Schedules

A schedule starts a session on an agent label at the times of a cron expression, with an input you set as the first message. Each occurrence fires once across all Argus processes. Occurrences missed while nothing was running collapse into a single fire. The started session's metadata records which schedule fired and when it was due. You can pause a schedule with enabled: false; deleting one leaves the sessions it started.

The agent label must resolve, and the variables must bind, when you save the schedule (422 otherwise).

Only gated labels run unattended

A schedule or trigger starts sessions with nobody choosing the version, so the label it runs must be held to the eval gate: production, or a label the version it holds lists in evals.gate.labels (see the eval gate). draft never qualifies. Until this rule is switched on, Argus only logs what it would refuse. Saving a schedule or trigger on any other label is refused (422). While a trigger or an enabled schedule runs a label, a version that does not gate it cannot move onto it (422, naming them; the gate's admin override does not lift this). If a label lost its gate anyway, a delivery to the trigger is refused (422) and the schedule's fire is recorded as failed; a person can still start a session on the label by hand.

Inbound triggers

A trigger gives a project an HTTPS endpoint, /v1/hooks/{project}/{trigger}, that starts a session when something outside Argus posts to it. You name the agent and label, an optional message that is placed before the webhook body, and optional variables.

Creating a trigger returns its signing secret once; it cannot be read again. If it is lost or leaked, rotate it: the new secret is shown once and the old one stops working at once. The sender signs each delivery in the Standard Webhooks style, and Argus verifies the signature before it starts anything:

  • a forged or unsigned delivery is refused;
  • a delivery to a trigger that does not exist is refused in exactly the same way as a bad signature, so trigger names cannot be probed;
  • a redelivery of the same delivery id answers with the session the first one started.

Signed deliveries count against the project's run and start limits only after the signature is verified, so an unsigned caller cannot use up your allowance.

In the app

Connections, Triggers lists a project's triggers with the agent and label each starts. Owners and members can create one (a name, the agent and label, an optional message and optional variables), rotate its secret and delete it. Creating or rotating shows the signing secret in a panel with a Copy button, masked until you press Show; it is on screen only until you press I've copied it, and neither a reload nor the list brings it back. Each trigger has its delivery URL and a sample signed curl that reads the secret from an environment variable, so the command never holds it. Viewers see the list and the delivery details and change nothing. Creating, rotating and deleting ask you to confirm it is you first.

The same is available through the API and the CLI: POST /v1/projects/{project}/triggers creates one, POST .../triggers/{trigger}/rotate-secret rotates the secret and DELETE .../triggers/{trigger} removes it.

Outbound webhooks

A webhook endpoint receives the events you pick: run.completed, human.requested, budget.warning and budget.exhausted. Each matching event is POSTed to the endpoint at least once as JSON with type, timestamp, project and data, signed the Standard Webhooks way with three headers:

Header Content
webhook-id The delivery id. The same on every retry, so deduplicate on it.
webhook-timestamp Unix seconds.
webhook-signature v1, and the base64 HMAC-SHA256 of <id>.<timestamp>.<body>, keyed by the endpoint's secret.

Any 2xx is success. Anything else, a timeout or a redirect is retried with exponential backoff, starting at 10 seconds and growing to an hour, honouring Retry-After, for 15 attempts over about a day. Every delivery is in a log you can read, and any delivery can be sent again.

Webhook URLs must be HTTPS and are reached only on public addresses. A URL that resolves to a private, link-local or metadata address is refused, and the delivery log shows the refusal.

In the app

Connections, Webhooks lists a project's endpoints with their events. Project owners can add one (an https address on a public network and the events to send), rotate its secret and remove it; the secret is shown once in the same way as a trigger's. Under each endpoint, Recent deliveries shows the latest ones with their status, tries and the last answer or error, so you can see why a receiver is not getting events. Members and viewers can read the list and the deliveries but not change them. An address Argus does not call (a private network, a loopback address) is refused on the form with the reason. Through the API: POST /v1/projects/{project}/webhooks, POST .../webhooks/{webhook}/rotate-secret, DELETE .../webhooks/{webhook} and GET .../webhooks/{webhook}/deliveries.

Why human.requested matters

Subscribing to human.requested is how an app or a chat message learns that a run is waiting for an approval, so a person can answer from wherever they are. See Tools and approvals.