rl client from Client setup.
Before you begin
- Creating automations and event sources needs create permission, changing, pausing, and resuming them needs update, and deleting needs delete. Organization developers and admins have all of them. See Organizations and roles.
- You need an agent version and a verified environment. See Agents and Environments.
- For Slack, GitHub, or webhook triggers you need an event source. See Receive events.
How automations run
- Trigger types:
schedule,slack,github, andwebhook. You can also start a run by hand at any time, even while the automation is paused. - New automations start paused. Test one with Run now, then resume it so its triggers can start runs.
- Everything is frozen per run. A run records the automation, trigger, and event exactly as they were, and the session’s opening message. Editing the automation later doesn’t change runs already started.
- The opening message is your saved prompt. For an event run, it’s followed by
Event for this run:and the event as JSON. For a manual run with a payload, it’s followed byInput for this run:and the payload.
Create an automation
- Console
- TypeScript
- cURL
- In the sidebar, click Automations, then click New automation.
- Name it, choose the agent, its version, and an environment.
- Under Agent instructions, write what the agent should do each time.
- Add triggers: Schedule, Slack, GitHub, or Webhook. With none, the automation runs only with Run now.
- Optionally set Credential access, Files, Memory, and Run metadata.
- Click Create automation. It starts paused.
201 with the whole automation and an ETag header:
createAutomationrequires anIdempotency-Key. A retry with the same key returns the same automation instead of a second one.- Every trigger needs a
triggerIdyou generate, a UUID that stays the same when you edit the trigger later. - The agent version, environment, event sources, vaults, files, and memory stores are all checked on create. A reference that doesn’t exist or doesn’t fit refuses the create with
422.
Choose triggers
An automation has up to 20 triggers, and a run starts when any enabled one matches. Turn a trigger off withenabled: false to keep it without it starting runs.
Schedule
Read
getAutomationStatus to see each schedule’s nextRunAt, upcomingRuns, lastRunAt, and counts of occurrences skipped for overlap or missed outside the catch-up window. synchronization is synced once your saved schedule is in effect.
Slack
Starts a run for Slack messages. It needs a Slack event source: connect Slack on the Integrations page, or add your own Slack app as a source.
To list channels for a connected Slack workspace, call
getIntegrationSlackChannelCatalog with the connection id. It returns up to 1,000 channels the Slack app is a member of. Invite the app to a channel to make it listable.
GitHub
Starts a run for GitHub webhook events. It needs a GitHub event source: connect GitHub on the Integrations page, or add a repository or organization webhook as a source.Webhook
Starts a run for deliveries to a custom webhook source. Addfilters.fieldEquals to start runs only for some deliveries. Each condition names a dot-separated path into the JSON body, such as data.level, and the value it must equal, written as JSON text without quotes.
Set run defaults
runDefaults applies to every run, whether a trigger or a person starts it.
Resume, pause, and run by hand
Pause, resume, replace, and delete need the automation’s current ETag inIf-Match. It’s "revision-N", where N is the automation’s revision, and it’s also returned in the ETag header of every read. A stale value returns 412 precondition_failed; read the automation again and retry.
- Console
- TypeScript
- cURL
- In Automations, open the automation.
- Click Run now to start one run. You can add an optional JSON payload.
- Click Resume to let its triggers start runs, or Pause to stop them.
runAutomation requires an Idempotency-Key and returns the run:
pending to created, and sessionId names the session it started. Follow that session like any other; see Sessions. A run that couldn’t start a session ends failed with an error that has a code, a message, the field or resourceId responsible when there is one, and retryable.
Resume returns the automation with status active. Pausing stops triggers from starting runs; Run now still works.
See run history
- Console
- TypeScript
- cURL
Open the automation to see its runs, each with its Trigger, when it started, and Session creation. Filter by status, trigger, or date, and click a run for its Run detail and a link to its session.
total and nextCursor. Filter by automationId, triggerId, eventSourceId, triggerType, status, createdAtGte, and createdAtLt. getAutomationRun returns one run with its frozen automationSnapshot, triggerSnapshot, sourceSnapshot, promptSnapshot, and eventContext. For event runs, providerDeliveryId identifies the delivery, and the same delivery never starts the same trigger twice.
Change or delete an automation
replaceAutomationreplaces the whole automation, including its trigger set, and keeps itsstatus. Send every field, withIf-Match. Keep each trigger’striggerIdto keep its identity.deleteAutomationdeletes the automation and its triggers, withIf-Match, and returns204. Runs already started keep their records.listAutomationslists automations newest first, without prompts or triggers.getAutomationreturns the whole automation.
Receive events
An event source is an endpoint that receives events and checks they’re genuine. Automations listen to it through Slack, GitHub, and webhook triggers. One source can serve many automations.
Sources created by connecting an account are connection-managed: they start active, and you pause and resume them from the list, but they’re replaced or deleted with their connection. Sources you create start paused.
Store the signing secret
Slack, GitHub, and signed custom sources check every delivery against a signing secret. Store it first as a Webhook signing secret credential (credential_type: "webhook_secret") in a vault. It’s used only to check deliveries and never reaches a sandbox.
- Console
- TypeScript
- cURL
- In the sidebar, click Credential vaults, open a vault, and click Add credential.
- Set Type to Webhook signing secret, paste the secret into Signing secret, and save.
Create a source
- Console
- TypeScript
- cURL
- In the sidebar, click Event sources, then create a source.
- Name it and choose the Provider protocol: Slack Events API, GitHub webhook, or Custom webhook.
- Under Verification, choose the Vault and Credential holding the signing secret. For a custom webhook, set the Signature header and optional Signature prefix, or choose Accept unsigned callbacks.
- Save, copy the Callback URL, and paste it at the provider.
- Resume the source when you’re ready to receive events.
201 with the source, paused:
type slack_events_api or github_webhook and a delivery of {"kind": "webhook", "verificationCredential": {...}} naming the Slack signing secret or the GitHub webhook secret.
webhookUrl is a path. The full URL to give the provider is the console’s address followed by that path, https://recursion.labelbox.com/agents/v1/event-sources/<eventSourceId>/events. The console’s Callback URL copies it whole.
Send a custom webhook delivery
Send a JSON body withPOST to the callback URL. For an hmac_sha256 source, compute the HMAC-SHA256 of the exact body bytes, keyed with your signing secret, and send it as lowercase hexadecimal in the signature header, after the prefix. Sign the bytes you send; re-serializing the JSON after signing breaks the signature.
200 with {"ok": true}. The same signed body is treated as the same delivery, so a retry doesn’t start a second run. For an unsigned source, send an X-Webhook-Id or Idempotency-Key header to name the delivery.
Manage sources
getEventSourceStatusreportshealthand how many automations use the source (triggerCount), plus the last delivery’s time and whether it wasadmittedorignored.healthisnever_received,healthy,paused,connection_unavailable, orsetup_required.healthymeans a delivery has arrived, not that the provider can reach the URL right now.pauseEventSourceandresumeEventSourcestop and restart deliveries from reaching triggers, withIf-Match. Triggers that use the source are left as they are.replaceEventSourcereplaces a source you created, withIf-Match, and keeps its status. Saving doesn’t resume a paused source.deleteEventSourcedeletes a source you created, withIf-Match, only when no automation uses it.
What can go wrong
For every error code, see Errors.
Limits
See Limits for every other limit.
Next steps
Integrations
Connect Slack and GitHub to get event sources.
Memory
Give automated runs curated memory.
Files
Mount the same files into every run.
Sessions
Follow the sessions automations start.