Automation workflows
Automation workflows let a project run an agent without a person in the chat. A workflow combines a plain-language task with one or more triggers, data and agent tools, and optional delivery targets such as email, Slack, or GitHub. Each run produces a report, records the delivery results, and remains available in the automation feed.
Workflow configuration
An automation is a saved instruction set for unattended work. Its configuration defines the task, schedule or webhook trigger, model choice, project tools, and outbound integrations. The editor requires at least one trigger, so every saved automation has a clear way to start. See Automations and integrations for the wider product view.
Triggers
Triggers start a run either at a recurring time or through an authenticated HTTP request. A workflow can use both forms. A scheduled trigger uses a cron expression and the server time zone; a webhook-only workflow has no scheduled job and uses the webhook switch as its active state.
flowchart LR
C[Automation configuration] --> S[Recurring schedule]
C --> W[Authenticated webhook]
S --> R[Automation run]
W --> R
Scheduled workflows can be enabled or paused. Pausing a scheduled workflow also blocks its webhook trigger. Webhook-only workflows do not have a schedule to pause, so their webhook setting controls whether they accept requests.
References: apps/…/automations-form.tsx• L599-769 apps/…/automation.routes.ts• L107-120 apps/…/automation.routes.ts• L330-343
Webhook ingestion
The webhook endpoint accepts POST /api/automations/:automationId/run and starts work asynchronously. The caller must send an organization API key as a Bearer token. The key's organization must own the automation's project, and the automation must allow webhook runs. A valid request returns 202 with the new run identifier rather than waiting for the agent to finish.
sequenceDiagram
participant Caller
participant Webhook
participant Run as Automation run
participant Feed as Run feed
Caller->>Webhook: POST with organization API key
Webhook->>Webhook: Check organization, trigger, pause, and billing access
Webhook->>Run: Start asynchronously
Webhook-->>Caller: 202 with run ID
Run->>Feed: Persist progress and final result
The webhook does not change the automation owner. The run still uses the configured automation user and project, while the API key only proves that the caller may trigger the workflow.
References: apps/…/automation-webhook.ts• L11-64 apps/…/automation-webhook.test.ts• L47-134 apps/…/automation-principal-access.test.ts• L90-109
Automation execution
Execution creates a run in the running state and gives it a fresh chat. The agent receives the saved prompt together with instructions about the requesting user, available delivery tools, and the configured project context. It investigates the task, prepares a short result, and sends the useful output through the selected integration tools.
Run lifecycle
The run lifecycle links the trigger to an auditable chat and a terminal result. Progress is saved while the agent is still working, so users can inspect an active run. A run ends as completed, failed, or cancelled; a running record that remains unfinished for too long is marked failed when run data is read.
flowchart TD
T[Trigger] --> R[Create running record]
R --> A[Agent investigates task]
A --> D[Deliver through tools]
D --> C[Completed with integration results]
A --> F[Failed with error]
R --> X[Cancelled by user]
The run uses the automation owner's project access. If that access is gone when execution begins, the run fails instead of silently switching to the person who triggered it.
References: apps/…/automation.handler.ts• L71-106 apps/…/automation.handler.ts• L108-224 apps/…/automation.queries.ts• L261-280 apps/…/automation.queries.ts• L344-447
Agent tools
Agent tools provide the means to understand the request and act on its result. The workflow can use the normal project data tools, selected MCP servers, and a history tool that returns earlier runs of the same automation. The history tool helps the agent report what is new instead of repeating past work.
Outbound integration tools are added only when their integration is enabled. Email and Slack delivery tools are required when configured. GitHub exposes read access plus only the write actions selected by the workflow. The run has no human follow-up step, so the agent must complete the task and deliver it within the run.
References: apps/…/automation.ts• L5-30 apps/…/automation-tools.ts• L54-127 apps/…/automation-run-prompt.tsx• L21-70
Integration delivery
Integrations turn the agent's result into an external action. The workflow records each delivery with its type, destination when relevant, success state, message, and link when one exists. This lets the run show useful partial results even when one target fails.
Email and Slack delivery
Email sends to the configured recipients and can also include recipients named in the agent's tool call. Generated charts and maps appear as inline images. Generated stories can be sent as PDF attachments.
Slack sends to every valid configured channel. The intended pattern is one short headline followed by the full report in its thread. Generated charts, maps, and stories are uploaded to that thread. A failed channel does not prevent delivery to other valid channels, and each channel receives its own result.
For broader Slack setup and channel behavior, see Messaging channel integrations.
References: apps/…/automation-tools.ts• L140-187 apps/…/automation-tools.ts• L189-357 apps/…/automation-run-prompt.tsx• L74-99 apps/…/automation.ts• L5-32
GitHub actions
GitHub gives the agent a controlled path from review to action. It can inspect issues, pull requests, comments, search results, and files. The workflow may also allow it to create issues, open pull requests, or add comments.
Repository limits apply to both reads and writes. When a repository list is set, actions are restricted to that list. A pull request action opens a request between branches that already exist; it does not create a branch or push commits. This pull request is the automation's review handoff. The automation tools do not assign reviewers.
References: apps/…/github-automation-tools.ts• L31-114 apps/…/github-automation-tools.ts• L125-177 apps/…/github-automation-tools.ts• L245-297 apps/…/github-automation-tools.ts• L320-393
Integration results
The run extracts results from the agent's tool calls after the stream ends. A required delivery tool that the agent never calls makes the run fail because no external delivery occurred. A called tool can still report a delivery error; in that case the run can complete with errors and the feed shows which integration or destination failed.
The automation feed shows the report text, generated charts, run state, and integration icons. Users can open the run chat, mark results read, or cancel an active run. The feed is therefore both the user-facing result and the first place to check delivery health.
References: apps/…/automation.handler.ts• L166-204 apps/…/automation.ts• L26-33 apps/…/automations-feed.tsx• L407-505 apps/…/automations-feed.tsx• L618-691 apps/…/automations-feed.tsx• L832-895
Review handoffs
Review handoffs let an automation move a finding from analysis into a shared engineering work item. In this workflow area, the handoff is a GitHub pull request or an issue comment created after the agent reads the allowed repository context.
The agent should use GitHub read actions to gather context before a write action. A pull request requires an existing head branch and a target base branch. The automation can report the resulting URL in its integration result, but a human or another process must handle branch creation, code changes, pushes, and reviewer assignment outside these tools.
References: apps/…/github-automation-tools.ts• L127-177 apps/…/github-automation-tools.ts• L264-297 apps/…/github-automation-tools.ts• L324-335
Change checklist
When these files or sections are changed, remember to consider these:
- Add a new outbound integration to the saved configuration, agent prompt descriptions, tool creation, run-result extraction, and feed presentation as one contract.
- Keep trigger validation, scheduled-job state, and webhook pause behavior aligned when changing how an automation is enabled.
- Keep integration result fields aligned across tool output, persisted run data, and feed status so partial delivery failures remain visible.
- Keep repository limits and GitHub write permissions aligned between the configuration UI and the tools exposed to the agent.
- Preserve the owner and project identity used for the run when changing webhook authorization or trigger entry points.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| No schedule and no webhook trigger | The automation cannot be saved. | Require at least one trigger in the editor and route validation. |
| Scheduled automation is paused | Scheduled runs and webhook requests are blocked. | Check the linked schedule state before starting a webhook run. |
| Missing, invalid, or cross-organization API key | The webhook returns an authorization or not-found response and starts no run. | Use a Bearer organization key and keep it in the automation's project organization. |
| Required integration tool is not called | The run is marked failed even if the agent produced text. | Treat configured delivery calls as the success condition. |
| Integration reaches only some destinations | The run can complete with errors and some channels or targets remain undelivered. | Read per-destination integration results in the feed. |
| Automation owner loses project access | The run fails instead of running as the webhook caller. | Restore owner access or transfer ownership before running. |
| Run stays in progress past the stale-run limit | The run is marked failed with a timeout message when run data is read. | Investigate the run and agent path before retrying it. |
Key files
| File | Why to read it |
|---|---|
| apps/…/automations-form.tsx | Shows the user-facing model for triggers, prompts, tools, integrations, and webhook setup. |
| apps/…/automation.routes.ts | Defines configuration rules, schedule reconciliation, manual runs, cancellation, and run access. |
| apps/…/automation-webhook.ts | Defines the external trigger contract and its authorization boundary. |
| apps/…/automation.handler.ts | Connects a trigger to a run, chat, agent stream, and final integration results. |
| apps/…/automation.ts | Defines the unattended agent profile and its available project tools. |
| apps/…/automation-tools.ts | Describes delivery tools and the email, Slack, history, and artifact behavior. |
| apps/…/github-automation-tools.ts | Defines GitHub read scope and the selected write actions used for review handoffs. |
| apps/…/automation.queries.ts | Defines the run history, terminal states, feed data, and stale-run handling. |
| apps/…/automations-feed.tsx | Shows how users read run output, delivery status, errors, and active-run controls. |