Skip to main content
An automation saves everything a session needs: a pinned agent version, an environment, an opening prompt, and run defaults such as credentials, files, and memory. Its triggers decide when it starts a session. Every start is recorded as a run, so you can see why each session began and what it was given. The samples assume the 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, and webhook. 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 by Input for this run: and the payload.

Create an automation

  1. In the sidebar, click Automations, then click New automation.
  2. Name it, choose the agent, its version, and an environment.
  3. Under Agent instructions, write what the agent should do each time.
  4. Add triggers: Schedule, Slack, GitHub, or Webhook. With none, the automation runs only with Run now.
  5. Optionally set Credential access, Files, Memory, and Run metadata.
  6. Click Create automation. It starts paused.
The response is 201 with the whole automation and an ETag header:
  • createAutomation requires an Idempotency-Key. A retry with the same key returns the same automation instead of a second one.
  • Every trigger needs a triggerId you 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 with enabled: 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. Add filters.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 in If-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.
  1. In Automations, open the automation.
  2. Click Run now to start one run. You can add an optional JSON payload.
  3. Click Resume to let its triggers start runs, or Pause to stop them.
runAutomation requires an Idempotency-Key and returns the run:
What success means: the run moves from 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

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.
Runs come back newest first with 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

  • replaceAutomation replaces the whole automation, including its trigger set, and keeps its status. Send every field, with If-Match. Keep each trigger’s triggerId to keep its identity.
  • deleteAutomation deletes the automation and its triggers, with If-Match, and returns 204. Runs already started keep their records.
  • listAutomations lists automations newest first, without prompts or triggers. getAutomation returns 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.
  1. In the sidebar, click Credential vaults, open a vault, and click Add credential.
  2. Set Type to Webhook signing secret, paste the secret into Signing secret, and save.

Create a source

  1. In the sidebar, click Event sources, then create a source.
  2. Name it and choose the Provider protocol: Slack Events API, GitHub webhook, or Custom webhook.
  3. 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.
  4. Save, copy the Callback URL, and paste it at the provider.
  5. Resume the source when you’re ready to receive events.
The response is 201 with the source, paused:
For a Slack or GitHub source, send 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 with POST 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.
A delivery that’s accepted returns 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

  • getEventSourceStatus reports health and how many automations use the source (triggerCount), plus the last delivery’s time and whether it was admitted or ignored. health is never_received, healthy, paused, connection_unavailable, or setup_required. healthy means a delivery has arrived, not that the provider can reach the URL right now.
  • pauseEventSource and resumeEventSource stop and restart deliveries from reaching triggers, with If-Match. Triggers that use the source are left as they are.
  • replaceEventSource replaces a source you created, with If-Match, and keeps its status. Saving doesn’t resume a paused source.
  • deleteEventSource deletes a source you created, with If-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.