Skip to content

Automations

An automation runs a workflow again and again on a trigger ("every 2 minutes", or only when you ask), keeps every run as a readable chat turn, and tells you only when something needs your attention. This page is the HTTP contract for automations on AbstractGateway: every route with its request and response shapes, the errors, how waits are answered, and how to operate automations on a gateway.

The automation logic itself (controller, triggers, retries, context modes, discussions, read-only workspaces) is AbstractRuntime's and is described in AbstractRuntime's docs/automations.md. For the gateway's components see architecture.md; for the rest of the HTTP API see api.md.

How automations work

An automation is one durable AbstractRuntime root run, its controller, whose run id is the automation id. The controller is a workflow that ships with AbstractRuntime; the gateway's runner ticks it like any other run. Each time the trigger fires, the controller starts one occurrence: an ordinary child run of your target workflow, with the inputs frozen at creation (except its workspaces: they are checked again when each occurrence is admitted, against the gateway policy and your default as they are then; a wider default applies from the next run, and a workspace the admin refused or capped since is dropped or lowered for that run, with the reason recorded). An occurrence reads as a chat turn (the prompt it received and its answer). In independent mode every occurrence starts fresh; in growing mode each occurrence sees the previous ones as conversation history. Automations are quiet: an occurrence raises attention only when its output asks for it, when it fails after its last retry, or while it waits for a person. The gateway projects this runtime state over HTTP and queues your commands; it never schedules or runs anything itself.

Before you start

  • Sign-in. Every route lives under /api/gateway and needs the usual bearer token or browser session (security.md). Each user sees only their own automations: another user's automation answers 404.
  • Detection. Apps gate their automation UI on the capabilities document:
GET /api/gateway/discovery/capabilities
→ capabilities.contracts.common.automations = {
    "available": true, "version": 1,
    "endpoint": "/api/gateway/automations",
    "automations_endpoint": "/api/gateway/automations",
    "trigger_sources_endpoint": "/api/gateway/trigger-sources",
    "command_types": ["automation.revise", "automation.pause", "automation.resume",
                      "automation.run_now", "automation.stop_current", "automation.archive",
                      "automation.unarchive"]
  }
  • Runtime. Automations need AbstractRuntime 0.6.0 or later, and this gateway pins 0.20.0. A gateway installed against an older runtime does not start (troubleshooting.md).

The examples below assume:

export BASE_URL="http://127.0.0.1:8080"
export AUTH="Authorization: Bearer $(cat "$ABSTRACTGATEWAY_DATA_DIR/auth/bootstrap-admin-token")"

Routes at a glance

Route Purpose
GET /api/gateway/trigger-sources what can start an automation (Trigger sources)
POST /api/gateway/automations create an automation (Create)
POST /api/gateway/automations/schedule-preview what a trigger would do if saved now: its sentence and first run (Schedule preview)
GET /api/gateway/automations list your automations, older scheduled runs included (List and read)
GET /api/gateway/automations/{automation_id} one automation: definition and summary
PATCH /api/gateway/automations/{automation_id} revise title, target, trigger, context or policy (Change)
POST /api/gateway/automations/{automation_id}/commands pause, resume, run now, stop the current run, archive, unarchive
GET /api/gateway/automations/{automation_id}/occurrences every run of the automation as a chat turn (Occurrences)
GET /api/gateway/automations/{automation_id}/attention the notifications you have not seen (Attention)
POST /api/gateway/automations/{automation_id}/seen record what you have seen
POST /api/gateway/automations/{automation_id}/discuss open a separate conversation about one occurrence (Discuss)
POST /api/gateway/commands answer an occurrence's wait (Waits); also accepts the automation.* commands
GET /api/gateway/runs run lists with automation attribution (Run lists)

Errors

Every error on /api/gateway/automations… and /api/gateway/trigger-sources has one shape, including sign-in failures, request-validation failures and malformed JSON:

{"detail": {"reason_code": "revision_conflict", "message": "Automation is at revision 4, not 3.", "field": "expected_revision", "command_id": "c-17"}}

field names the offending input and command_id echoes the command, when they apply.

Status reason_code When
401 unauthorized no token, a wrong token or an expired session
403 forbidden the security layer refused the request (for example an origin outside the allowlist, or a browser-session write without its CSRF token)
404 automation_not_found no automation with this id for you (another user's automation included)
404 occurrence_not_found the automation has no occurrence with this index
409 revision_conflict expected_revision is not the automation's revision
409 automation_busy run_now while an occurrence is running or waiting to run
409 invalid_state the automation's state rules the command out (see Commands)
409 identity_conflict a request_id or command_id reused for a different request
409 cursor_expired, history_unavailable a list cursor that has expired; a conversation history that cannot be read
422 invalid_request a missing, unknown or malformed field (including malformed JSON)
422 invalid_definition a target, trigger, context or policy the gateway or runtime refuses
422 unsupported_feature a valid request that v1 does not support (for example changed_since, or a policy value other than the fixed v1 value)
422 unknown_trigger_source a trigger source_id/source_version no installed source provides

Rare transport answers keep the same shape with not_found (unknown path), rate_limited (429), unavailable (503) or internal_error (500).

Trigger sources

GET /api/gateway/trigger-sources lists what can start an automation:

{"items": [
  {"id": "schedule", "version": 1, "label": "Schedule", "capabilities": {"kind": "time"},
   "config_schema": {…}, "event_schema": {…}, "available": true},
  {"id": "schedule", "version": 2, "label": "Schedule", "capabilities": {"kind": "time"}, …, "available": true},
  {"id": "manual", "version": 1, "label": "Manual", "capabilities": {"kind": "manual"}, …, "available": true}
]}
  • schedule@1 takes {start_at?, every?, until?, count?}. every is a fixed interval: a number and one of s, m, h, d ("2m", "8h", "1d"), at most 366d. Intervals are plain UTC durations with no calendar or daylight-saving rules, so interfaces say "every 8 hours", never "daily at 08:00". start_at defaults to the creation time and anchors the grid; until is exclusive and must be after start_at; count (1 to 1,000,000) caps the number of ticks and needs every when above 1. Without every the schedule fires once, at start_at. Ticks missed while the gateway was down coalesce into one occurrence. Existing schedule@1 automations keep working unchanged; new automations use schedule@2.
  • schedule@2 adds calendar rules in a time zone. config.kind is one of:
  • "every": {every, start_at?, until?, count?}, the fixed UTC interval of schedule@1;
  • "once": {start_at}, or {at: "2026-12-24T18:30"}, a wall time in the automation's time zone;
  • "daily": {at: "08:00"};
  • "weekly": {days: ["mon", "thu"], at: "08:00"} (any non-empty set of mon … sun);
  • "monthly": {day: 1..31 | "last", at: "08:00"}; a day beyond the month's length runs on its last day (day 31 runs on 30 April and on 28 or 29 February).

Calendar rules run on wall time in config.time_zone, an IANA name such as Europe/Paris. When you leave it out, the gateway fills in your account's time zone at creation (Account preferences); a revision without one keeps the automation's zone. To change it later, send the trigger again with another time_zone. Daylight saving is handled: a daily 08:00 stays at 08:00; a wall time that does not exist on the spring-forward day (02:30) runs at 03:30 that day; a wall time that happens twice on the fall-back day runs once. Missed ticks coalesce and a resume never catches up, as with schedule@1. An unknown zone is refused with 422 invalid_definition, field trigger.config.time_zone. - manual@1 takes {}: the automation runs only when you send automation.run_now. - email.received@1 runs on new mail in your own mailbox (email.md): {folder?, uses_model?, every?, max_batch?, filter?: {from_in?, from_domain_in?, to_in?, subject_contains?, has_attachment?}} (equality, membership and one literal substring; no patterns). With uses_model (the default) the automation runs at most once an hour by default on the batch received since its last run; with "uses_model": false every 60 seconds. every sets the interval (minimum 60s). Each message is read at most once per automation; mail received before the automation existed, or while it was paused, is not processed. The occurrence receives the messages under trigger.emails, marked content_trust: "untrusted". The gateway's mail watcher reads the mailbox only while such an automation is active. With several mailboxes, "account": "<mailbox_id>" chooses the one to watch (no value = your primary mailbox; see email.md). - feed.item@1 runs when a feed you follow (RSS 2.0, RSS 1.0 (RDF) or Atom 1.0) has new items. The automation names one of your trigger connections (connection_id); the connection holds the feed URL and how often it is read (every, default 15m, at least 60s). The items of one read become one run, under input_data.event.data.events, marked untrusted. The console's New connection proposes well-known public feeds (news, technology, science, business, a subreddit, a YouTube channel, GitHub releases) and accepts any other address (console.md). A pick also sets Check every to the feed's recommended interval (its check_every: 10m for Hacker News, 15m for news and finance, 30m for technology sites, 6h for science magazines and journals, 12h for arXiv), still editable; a custom catalogue entry may omit it and keep the default. - webhook.received@1 runs when an external system calls your signed webhook address (POST /api/gateway/triggers/webhooks/{connection_id}, Standard Webhooks signature). The automation names the webhook connection; each call becomes one event of the run's input_data.event (event.data.events[0].data.body, the webhook id as its subject), marked untrusted.

Trigger connections are yours alone: create them with the connections API or the console's Triggers page, and see events-examples.md for a feed digest and a signed webhook call end to end.

An automation with "notify": {"channels": ["console", "email"]} emails every completed run’s full result, even when the model does not request a notification. notify.recipients selects the destinations (default ["self"]). Mailbox availability, recipient policy and send limits still apply. The separate policy.email_allowed_recipients controls email-tool consent.

A source installed by another package that fails to load is listed with "available": false and an unavailable_reason. A missing built-in source is an error (500 internal_error).

Create an automation

POST /api/gateway/automations

{
  "request_id": "0b6f…",               // your idempotency key
  "title": "Memory every 2 minutes",
  "target": {"bundle_ref": "memory-check@1.2.0", "flow_id": "check",
             "input_data": {"prompt": "Report the memory use of this computer."}},
  "trigger": {"source_id": "schedule", "source_version": 1, "config": {"every": "2m"}},
  "context": {"mode": "independent"},   // or "growing"
  "policy": {"tool_approval": "auto", "retry": {"max_attempts": 3}}
}
→ {"automation_id": "…", "revision": 1, "summary": {…AutomationSummary}}
curl -sS -H "$AUTH" -H "Content-Type: application/json" \
  -d '{"request_id":"'"$(python -c 'import uuid; print(uuid.uuid4())')"'","title":"Memory every 2 minutes","target":{"flow_id":"@default","interface":"abstractcode.agent.v1","input_data":{"prompt":"Report the memory use of this computer."}},"trigger":{"source_id":"schedule","source_version":1,"config":{"every":"2m"}}}' \
  "$BASE_URL/api/gateway/automations"

request_id. The automation id is derived from your user and the request_id, so sending the same request again returns the same automation. The same request_id with a different request answers 409 identity_conflict.

target. A workflow this gateway serves, in one of two forms:

  • {bundle_ref, flow_id, input_data?}: bundle_ref is bundle_id or bundle_id@version; a version-less reference pins the version loaded at creation. flow_id must be one of the bundle's entrypoints.
  • {"flow_id": "@default", "interface": "<agent interface>", "input_data"?}: the gateway default workflow of that agent interface (for example abstractcode.agent.v1), resolved at creation (configuration.md). Do not send bundle_ref with it. A default that points into the shared workflow catalog is refused (422 unsupported_feature): automations run workflows of the gateway's own registry.

The concrete workflow (bundle_id@version:flow_id) is stored in the definition, so later changes to the default do not move the automation. Publishing a new version of the target does not move it either, and it interrupts nothing: a publish swaps the workflow list in place, so the controller, its waiting occurrences and the model they use keep running (architecture.md).

target.input_data is your workflow's input. The gateway applies the same protections as for any run: your workspace settings are clamped to the operator's workspace policy, the automation gets its own folder under the gateway's data folder, and the built-in deny rules keep its tools away from the data folder and your credential folders (security.md). Keys the server owns are dropped: _meta, workspace_read_only, and every _runtime key except these, which a client may set:

_runtime key What it sets
allowed_tools narrows the tools the target may call
provider, model the model the target uses
thinking, speculation generation settings, as in a chat run
stream live token streaming (true/false)

Anything else under _runtime (for example control, tool_policy, agora_agent) is runtime or host state and is dropped. Tool approval is set by policy.tool_approval or its named policy.tool_policy override. A workflow's automation_defaults may not carry server-owned keys at all: saving the workflow answers 422 with the field.

context.mode.

Mode Each occurrence Session
independent (default) starts fresh, with no history a new session per occurrence
growing receives the previous occurrences as conversation history: the most recent whole turns within the configured token budget (50,000 tokens by default), never a cut message, not summarized; the occurrence run records what was replayed and dropped in _runtime.session_history the automation's session, automation:<automation_id>

policy. tool_approval is "auto" (default) or "ask" (Tool approval). retry sets how a failed occurrence is retried: max_attempts 1 to 10 (default 3) and backoff {initial: "30s", factor: 2, max: "10m"} by default. serial: true, misfire: "coalesce" and failure: "continue" are the only v1 values; anything else answers 422 unsupported_feature.

For per-tool choices, policy.tool_policy accepts {auto_approve_tools: ["read_file"], require_approval_tools: ["execute_command"]}. This complete snapshot overrides tool_approval; approval is required for unmentioned candidate tools, and Require wins when a name appears in both lists. Set tool availability with target.input_data.tools and _runtime.allowed_tools, including [] to deny all. Existing messaging and untrusted-input restrictions remain authoritative. Omit the snapshot, or revise it to null, to use tool_approval again. The installed AbstractRuntime must support named automation policies; older versions return 422 for this field.

Changes use the existing create and revise routes. A revise response acknowledges queued work: read the definition until its revision advances before reporting the change as saved or starting a run with those permissions. See AbstractRuntime's Tool approval for the runtime policy rules.

title and trigger may be left out when the target publishes automation_defaults (below): the defaults then fill title, trigger, context, and the input_data keys you did not send. Without published defaults, a missing title or trigger answers 422 invalid_request.

Automation defaults on workflows

A workflow can suggest how automations created from it should run. The flow editor stores the suggestion in the VisualFlow document as automation_defaults:

"automation_defaults": {
  "schema_version": 1,
  "title": "Memory every 2 minutes",
  "trigger": {"source_id": "schedule", "source_version": 1, "config": {"every": "2m"}},
  "context": {"mode": "independent"},
  "input_data": {"prompt": "Report the memory use of this computer."}
}
  • POST /api/gateway/visualflows and PUT /api/gateway/visualflows/{id} accept it and check it on save: unknown fields, a binding_id, a title over 120 characters, or a trigger config its source refuses answer 422 with reason_code and field. context defaults to {"mode": "independent"} and input_data to {}.
  • A growing workflow can carry its history budget: "context": {"mode": "growing", "growing": {"max_tokens": 20000}} (a positive whole number; refused for the independent mode). It is stored, published, and copied into every automation created from the defaults. Without it, the gateway's default applies (below).
  • PUT with "automation_defaults": null removes it; leaving the field out keeps it. PUT and GET return the stored value.
  • Publishing writes it into the bundle manifest as metadata.automation_defaults[<flow id>]. GET /api/gateway/bundles, GET /api/gateway/bundles/{bundle_id} and the shared catalog records return automation_defaults keyed by entrypoint flow id.
  • At creation the defaults are checked again with the same rules; invalid published defaults answer 422 with the offending field.
  • A trigger whose source listens to a connection (needs_connection with the trigger_connections provider: webhook.received@1, feed.item@1) carries "connection_id": "<id>" in trigger (or in trigger.config); it is required for those sources (422 connection_required) and refused for the others. A connection belongs to one person: an automation created from defaults that name someone else's connection is refused with 422 connection_not_yours ("choose one of your own connections"), and a request naming a connection that is not yours answers 404 connection_not_found. The automation stores it as trigger.config.connection_id. Connections are managed with the connections API and the console's Triggers page, which also says which automations handle each connection and mailbox (Handled by) and turns one of your triggered flows on for it (Use in a flow, console.md).

An automation runs unattended, so it cannot stop to ask before every tool call. policy.tool_approval decides what happens:

  • "auto" (default). Creating the automation is the consent for the tools its target offers: every occurrence runs them without asking. Apps state this on their creation form and list the tools. The grant is limited to the target's _runtime.allowed_tools when it has that list, and to the tools AbstractRuntime classifies otherwise; a tool outside that classification (a third-party MCP tool, for example) still asks. Sending a message is never pre-approved (framework backlog 0992 WP0): send_email, send_whatsapp_message and send_telegram_* stay out of the grant even when allowed_tools names them. A send_email whose every recipient is your registered email runs unattended; any other recipient parks the occurrence on a tool_approval wait until someone approves or refuses it. Text an occurrence reads (an inbound email, a web page) therefore cannot make it mail your data to an address that text names. The gateway freezes your registered email (account email, or the gateway's operator_email setting without accounts) into the target's inputs when the automation is created or its target revised; after changing that email, revise the target to refresh it. Without a registered email every send asks.
  • "ask". Every tool batch that needs approval waits on a tool_approval wait, as in an ordinary chat, and someone must answer it (Waits).

Questions the workflow itself asks (Ask User) wait for a person in both modes. A change of tool_approval applies from the next occurrence. Discussions never inherit the grant: their tools ask as in any chat.

Schedule preview

POST /api/gateway/automations/schedule-preview with {"trigger": {source_id, source_version, config}} answers what that trigger would do if you saved it now. Nothing is stored. The trigger is checked by the same validator as a create (same 422 answers) and the time zone is filled in the same way.

{"trigger": {"source_id": "schedule", "source_version": 2,
             "config": {"kind": "daily", "at": "08:00", "time_zone": "Europe/Paris", "start_at": "…", "anchor": "…"}},
 "time_zone": "Europe/Paris",
 "schedule_rule_text": "Every day at 08:00 (Europe/Paris)",
 "schedule_text": "Every day at 08:00 (Europe/Paris) · next Fri 9 Oct 08:00",
 "next_run_at": "2026-10-09T06:00:00+00:00", "next_run_local": "2026-10-09T08:00:00+02:00",
 "first_run_sentence": "Runs every day at 08:00 (Europe/Paris), first run Fri 9 Oct 08:00."}

first_run_sentence is the line a schedule dialog shows under its "When" fields, e.g. "Runs every 24 hours (UTC), first run now." or "Runs once at Thu 24 Dec 18:30 (Europe/Paris).". next_run_at and next_run_local are null for a trigger with no clock time (manual, email).

List and read

Route Answer
GET /api/gateway/automations?status=&archived_only=&kind=&cursor=&limit= {items: [AutomationSummary], next_cursor, paused_automations_count, archived_automations_count, archived_automations}, in the listing order
GET /api/gateway/automations/{automation_id} {definition, active_revision, summary: AutomationSummary}
  • status is a comma-separated subset of active, paused, completed, failed, archived. limit is 1 to 200 (default 50).
  • Archived automations are left out of the list unless you ask for them: archived_only=true lists only archived ones (it cannot be combined with status), or name archived in status. paused_automations_count and archived_automations_count are how many of yours are paused and archived, on every page, whatever the filter (archived_automations is the same count as archived_automations_count).
  • kind is what the automations are for: user (the default: the ones a person creates and manages), notes (AbstractNote's own processing, the "Process my notes", "Reflect on my notes" and "Consolidate my notes" automations, recognised by their target's abstractnote bundle id) or all. A purpose, never the client that created it. Every row carries kind; the paused and archived counts count the listed kind. AbstractNote reads its automations by id (GET /automations/{automation_id} and its Processing page), so they work while every app's list leaves them out.
  • Read every page, following next_cursor until it is null. changed_since is refused (422 unsupported_feature); poll complete pages instead.

Listing order

The gateway serves the list in the order every app draws it, so no app sorts it again:

  1. Active first. Every automation that is neither paused nor archived (status active, completed or failed), most recent activity first.
  2. Then paused, most recent activity first.
  3. Archived automations are their own listing (archived_only=true), most recent activity first.

Each row says where it belongs: section is "active", "paused" or "archived", and last_activity_at is the instant the order uses: the automation's last change. It moves whenever the automation itself changes (an occurrence started, retried or finished, a pause, resume, cancel or revision, an archive), never when someone reads it or marks its runs seen. Rows with the same instant are ordered by automation_id, descending. Older scheduled runs (Legacy) are placed by the same rule.

Apps show the active rows, then a Paused section folded by default and labelled like Archived (an icon, "Paused" and paused_automations_count); see the framework's ADR 0048.

next_cursor continues this order where the page stopped. The order follows activity, so an automation that changes between two page reads may be served twice or not at all in that walk; the next refresh shows it. Refresh from the first page; never resume an old walk. A cursor from an earlier gateway (created-order auto1: cursors) is refused with 422 invalid_request (field: "cursor"); start again from the first page.

AutomationSummary:

{"automation_id": "…", "title": "…",
 "status": "active",                  // active | paused | completed | failed | archived
 "trigger": {"binding_id": "…", "source_id": "schedule", "source_version": 1, "config": {…}},
 "target": {"workflow_id": "digest@1.2.0:digest", "bundle_ref": "digest@1.2.0", "flow_id": "digest"},
 "flow_name": "Release digest",
 "context_mode": "independent", "workspace_root": "/…/workspaces/session-automation-…",
 "next_fire_at": "…", "occurrence_count": 6,
 "next_run_at": "2026-10-09T06:00:00+00:00", "next_run_local": "2026-10-09T08:00:00+02:00",
 "time_zone": "Europe/Paris",
 "schedule_rule_text": "Every day at 08:00 (Europe/Paris)",
 "schedule_text": "Every day at 08:00 (Europe/Paris) · next Fri 9 Oct 08:00",
 "trigger_text": "Every day at 08:00 (Europe/Paris)",
 "current_occurrence": {"index": 7, "run_id": "…", "attempt": 1, "status": "running"},   // or null
 "last_occurrence": {"run_id", "index", "status", "attempts", "fired_at", "finished_at"?, "excerpt", "notify"},
 "last_notification": {"channel": "email", "status": "failed", "at", "sent_at", "code", "sentence", "text": "Email result failed — …"},  // or null
 "attention": {"pending_waits": 0, "unread": false, "unseen_count": 0, "cursor": "att1:3", "items": [], "waits": []},
 "legacy": false, "revision": 1, "updated_at": "…",
 "section": "active",                 // active | paused | archived (Listing order)
 "last_activity_at": "…",             // the instant the listing orders by
 "capabilities": ["revise", "pause", "resume", "run_now", "stop_current", "archive", "discuss"],  // archived: ["unarchive", "discuss"]
 "session_kind": "automation"}
  • workspace_root is the automation's folder, the same value as definition.workspace_root (an older scheduled run shows its own folder when it has one).
  • next_fire_at is the next scheduled run of an active scheduled automation, also while an occurrence is running (a tick missed meanwhile runs as soon as the current one ends). It is absent for a manual trigger, a finished schedule, and a paused, archived, completed or failed automation.
  • next_run_at is the same instant as next_fire_at (UTC) and next_run_local the same instant with the offset of time_zone; both are absent when next_fire_at is.
  • time_zone is a schedule@2 automation's zone; for any other trigger it is the owner's account time zone.
  • target is the workflow the automation runs ({workflow_id, bundle_ref, flow_id}; its input_data stays in the definition, GET /automations/{id}), and flow_name that entrypoint's name in the bundle version it runs (null when this gateway does not have that version loaded). The console's Triggers page lists · <flow_name></em> under each trigger (<strong>Handled by</strong>). A legacy row has neither.</li> <li><code>trigger_text</code> is the trigger of ANY automation in words, the line a client shows next to the title: the schedule sentence (<code>schedule_rule_text</code>) for a schedule, "By hand", "When mail arrives in <address>" (the watched mailbox), "When <connection name> has a new item" (a feed), "When <connection name> is called" (a webhook), else "When <the source's label>".</li> <li><code>schedule_text</code> is the one sentence every client shows for the schedule, verbatim: the rule (<code>schedule_rule_text</code>) and, when a next run exists, " · next <day> <date> <time>" in <code>time_zone</code> (the year is added when it is not the current one). Examples: "Every Mon, Wed and Fri at 07:30 (Europe/Paris) · next Mon 12 Oct 07:30", "Monthly on day 31 (or the last day) at 08:00 (Europe/Paris)", "Monthly on the last day at 23:00 (UTC)", "Every 24 hours (UTC) · next Fri 9 Oct 21:53 (Europe/Paris)", "Once at Thu 24 Dec 18:30 (Europe/Paris)", "When an email arrives", "Manual runs only". Every clock time is in <code>time_zone</code>; a fixed UTC interval, whose rule says "(UTC)", names the zone after each time it shows unless that zone is UTC. Clients never compute a next run themselves.</li> <li><code>current_occurrence</code> is the occurrence in progress, <code>status</code> <code>admitted</code>, <code>running</code> or <code>backoff</code> (waiting to retry), or <code>null</code> when none is.</li> <li><code>last_occurrence.excerpt</code> holds the first 280 characters of its answer.</li> <li><code>last_notification</code> is the newest "Email result" notice of this automation (<code>null</code> when it never asked for one): <code>status</code> <code>queued</code>, <code>sending</code>, <code>sent</code>, <code>failed</code> or <code>unknown</code>, the typed <code>code</code> and <code>sentence</code> of a failure, and <code>text</code>, the one line clients show verbatim ("Email result sent", "Email result failed — <sentence>"). A mailbox that must be connected again (sealed with the old macOS keychain key, gateway 0.14) fails such a notice once, with "Email result failed — The mailbox credentials were sealed with the old macOS keychain key; connect the mailbox again — the new key lives in the data folder."; it is never retried.</li> <li><code>attention</code> is described in <a href="#attention-and-seen">Attention</a>; <code>items</code> and <code>waits</code> hold up to 20 entries each.</li> <li><code>capabilities</code> lists what the automation accepts. An archived automation lists <code>["unarchive", "discuss"]</code>; a completed or failed one <code>["discuss"]</code>.</li> </ul> <p><code>definition</code> is the stored definition (target, trigger, context, policy, revision); <code>active_revision</code> is the revision in force.</p> <h2 id="change-an-automation">Change an automation<a class="headerlink" href="#change-an-automation" title="Permanent link">¶</a></h2> <h3 id="revise">Revise<a class="headerlink" href="#revise" title="Permanent link">¶</a></h3> <p><code>PATCH /api/gateway/automations/{automation_id}</code></p> <div class="highlight"><pre><span></span><code>{"command_id": "…", "expected_revision": 3, "changes": {"title"?, "target"?, "trigger"?, "context"?, "policy"?}} → CommandReceipt </code></pre></div> <ul> <li><code>changes</code> must be a non-empty object with only those keys. A <code>target</code> is resolved and protected as at creation. A <code>policy</code> change is merged into the current policy, so a retry-only change keeps <code>tool_approval</code>.</li> <li>A revision applies from the next occurrence; the running one finishes under the old definition. A new schedule never fires a past tick.</li> <li><code>expected_revision</code> is optional; a stale value answers 409 <code>revision_conflict</code>. Invalid <code>changes</code> answer 422 before anything is queued.</li> </ul> <h3 id="commands">Commands<a class="headerlink" href="#commands" title="Permanent link">¶</a></h3> <p><code>POST /api/gateway/automations/{automation_id}/commands</code></p> <div class="highlight"><pre><span></span><code>{"command_id": "…", "type": "automation.pause", "payload": {}} → {"command_id": "…", "accepted": true, "duplicate": false, "seq": 42} </code></pre></div> <table> <thead> <tr> <th>Type</th> <th>Effect</th> </tr> </thead> <tbody> <tr> <td><code>automation.pause</code></td> <td>no more scheduled occurrences; a running one finishes; "run now" still works</td> </tr> <tr> <td><code>automation.resume</code></td> <td>continues at the next scheduled time; resuming never fires at once</td> </tr> <tr> <td><code>automation.run_now</code></td> <td>one occurrence now, also while paused (the automation stays paused)</td> </tr> <tr> <td><code>automation.revise</code></td> <td><code>payload: {changes, expected_revision?}</code>; the same as <code>PATCH</code></td> </tr> <tr> <td><code>automation.stop_current</code></td> <td>cancels the running occurrence</td> </tr> <tr> <td><code>automation.archive</code></td> <td>no more occurrences; the history is kept</td> </tr> <tr> <td><code>automation.unarchive</code></td> <td>back to <strong>paused</strong> with its history; <code>resume</code> re-arms the trigger</td> </tr> </tbody> </table> <p><strong>The receipt means queued.</strong> A command is <code>accepted</code> when it is written to the gateway's durable command inbox. The runner hands it to AbstractRuntime, which records in the automation's ledger whether it was applied or rejected (<code>GET /api/gateway/runs/{automation_id}/ledger</code>). The same <code>command_id</code> again answers <code>duplicate: true</code> with the first <code>seq</code>; the same <code>command_id</code> for a different command answers 409 <code>identity_conflict</code>.</p> <p><strong>The route refuses at once what the state already rules out</strong> (409):</p> <ul> <li>any command but <code>unarchive</code> (and a repeated <code>archive</code>) on an archived automation, any command but <code>archive</code> on a completed or failed one, and <code>unarchive</code> on an automation that is not archived (<code>invalid_state</code>);</li> <li><code>run_now</code> while an occurrence is running or waiting to run (<code>automation_busy</code>), or when the trigger has no ticks left (<code>invalid_state</code>);</li> <li><code>pause</code> when paused, <code>resume</code> when not paused, <code>stop_current</code> with nothing running (<code>invalid_state</code>);</li> <li>a stale <code>payload.expected_revision</code> (<code>revision_conflict</code>).</li> </ul> <p>AbstractRuntime checks again when it applies the command, because the state may change in between.</p> <p><strong>Through the run command door.</strong> <code>POST /api/gateway/commands</code> also accepts the six <code>automation.*</code> types with <code>run_id</code> set to the automation id; it answers 404 when <code>run_id</code> is not an automation. Prefer the automation routes above, which also refuse invalid states and revisions at once. Run commands (<code>pause</code>, <code>resume</code>, <code>cancel</code>, <code>conclude</code>, <code>update_schedule</code>, …) aimed at an automation id answer 409 <code>invalid_state</code>: an automation is controlled only with the <code>automation.*</code> types.</p> <h2 id="occurrences">Occurrences<a class="headerlink" href="#occurrences" title="Permanent link">¶</a></h2> <p><code>GET /api/gateway/automations/{automation_id}/occurrences?cursor=&limit=</code> → <code>{items, next_cursor}</code>, newest first, one row per occurrence (its latest attempt):</p> <div class="highlight"><pre><span></span><code>{"run_id": "…", "index": 7, "attempts": 1, "fired_at": "…", "finished_at": "…", "status": "completed", // admitted | running | waiting | backoff | completed | failed | cancelled "trigger": {"source_id": "schedule", "summary": "schedule: Every 30 minutes (UTC), tick 5"}, "user_turn": "[Trigger schedule@1 · occurrence 7 · fired …]\nTriage my inbox…", "answer": "…", "notify": null, "failure": {"reason_code": "occurrence_failed", "message": "…", "attempts": 3}, // failed rows only "artifacts": [{"artifact_id", "name", "mime_type", "url"}], "waits": [{"run_id", "wait_key", "kind", "reason", "prompt"?, "choices"?, "details"?}], "ledger_url": "/api/gateway/runs/…/ledger", "workspace_url": "/api/gateway/runs/…/workspace"} </code></pre></div> <ul> <li><code>user_turn</code> and <code>answer</code> are the occurrence as a chat turn; <code>answer</code> is empty until the occurrence ends.</li> <li><code>status</code> is <code>waiting</code> only while the occurrence, or a run below it, waits for a person (it then has <code>waits</code>). An occurrence whose agent is still working reads <code>running</code>. <code>backoff</code> means a retry is scheduled.</li> <li><code>trigger.summary</code> describes the trigger the occurrence ran under, also after a revision; a manual occurrence reads <code>manual: run now (<command id>)</code>.</li> <li><code>artifacts[].url</code> serves the file; <code>workspace_url</code> browses the occurrence's folder (<a href="../api/#a-runs-workspace-folder-browse-and-preview">api.md</a>).</li> </ul> <h2 id="waits-on-a-person">Waits on a person<a class="headerlink" href="#waits-on-a-person" title="Permanent link">¶</a></h2> <p>An occurrence (or a run below it) can wait for a person. Each wait, in an occurrence row's <code>waits</code> and in the summary's <code>attention.waits</code> (which also carries the occurrence <code>index</code>), is typed:</p> <div class="highlight"><pre><span></span><code>{"run_id": "…", "wait_key": "…", "kind": "ask_user" | "tool_approval" | "event", "reason": "…", "prompt"?: "…", "choices"?: […], "details"?: …} </code></pre></div> <p>For <code>tool_approval</code>, <code>details</code> lists the tool calls that approving will run: <code>[{name, arguments, call_id?}]</code>.</p> <p>Answer a wait with the ordinary resume command on the wait's run:</p> <div class="highlight"><pre><span></span><code>curl<span class="w"> </span>-sS<span class="w"> </span>-H<span class="w"> </span><span class="s2">"</span><span class="nv">$AUTH</span><span class="s2">"</span><span class="w"> </span>-H<span class="w"> </span><span class="s2">"Content-Type: application/json"</span><span class="w"> </span><span class="se">\</span> <span class="w"> </span>-d<span class="w"> </span><span class="s1">'{"command_id":"'</span><span class="s2">"</span><span class="k">$(</span>python<span class="w"> </span>-c<span class="w"> </span><span class="s1">'import uuid; print(uuid.uuid4())'</span><span class="k">)</span><span class="s2">"</span><span class="s1">'","run_id":"<wait run_id>","type":"resume","payload":{"wait_key":"<wait_key>","payload":{"approved":true}}}'</span><span class="w"> </span><span class="se">\</span> <span class="w"> </span><span class="s2">"</span><span class="nv">$BASE_URL</span><span class="s2">/api/gateway/commands"</span> </code></pre></div> <p>The answer, <code>payload.payload</code>, depends on <code>kind</code>:</p> <table> <thead> <tr> <th><code>kind</code></th> <th>What waits</th> <th>Answer (<code>payload.payload</code>)</th> </tr> </thead> <tbody> <tr> <td><code>ask_user</code></td> <td>a question the workflow asks</td> <td><code>{"response": "…"}</code></td> </tr> <tr> <td><code>tool_approval</code></td> <td>a tool batch awaiting approval</td> <td><code>{"approved": true}</code> or <code>{"approved": false}</code>, optionally with <code>"tool_ids": ["…"]</code></td> </tr> <tr> <td><code>event</code></td> <td>an event wait that carries a prompt or choices</td> <td><code>{"payload": {…}}</code> (the event payload, wrapped)</td> </tr> </tbody> </table> <p>For an automation's runs the gateway refuses an answer of the wrong shape (422 <code>invalid_request</code>, field <code>payload</code>, with the expected shape in the message): <code>{"response": "approve"}</code> to a tool approval is refused, never recorded as the tool result. Waiting occurrences stay counted in <code>attention.pending_waits</code> until they are answered.</p> <h2 id="attention-and-seen">Attention and <code>/seen</code><a class="headerlink" href="#attention-and-seen" title="Permanent link">¶</a></h2> <h3 id="what-asks-for-attention">What asks for attention<a class="headerlink" href="#what-asks-for-attention" title="Permanent link">¶</a></h3> <p>A workflow asks for attention through its <strong>output</strong>:</p> <ul> <li><code>notify: true</code>: the title is the automation's title and the body the answer;</li> <li><code>notify: {"title": "…", "body": "…"}</code>: your own title and body.</li> </ul> <p>Anything else stays quiet: quiet occurrences are listed but raise no notification. An occurrence that fails after its last retry always raises one. A plain agent workflow that must flag its results is wrapped in a small flow that returns <code>{response, notify}</code>.</p> <h3 id="reading-and-marking-attention">Reading and marking attention<a class="headerlink" href="#reading-and-marking-attention" title="Permanent link">¶</a></h3> <p>Attention items live in the automation's own history; what each user has <strong>seen</strong> is kept by the gateway per user, in <code><data dir>/automations/attention/</code>.</p> <ul> <li>The summary's <code>attention</code> block: <code>unseen_count</code> and <code>unread</code> (items you have not seen), <code>items</code> (up to 20 of them), <code>cursor</code> (the latest item's cursor), <code>pending_waits</code> and <code>waits</code> (live waits, up to 20).</li> <li><code>GET /api/gateway/automations/{automation_id}/attention?cursor=&limit=</code> pages your unseen items, oldest first: <code>{items, next_cursor}</code> with items <code>{kind: "notify" | "failure", automation_id, run_id, index, at, title, body?, cursor}</code>.</li> <li><code>POST /api/gateway/automations/{automation_id}/seen</code> with <code>{"attention_cursor": "att1:<n>"}</code> records what you have seen and returns <code>{"attention_cursor": "att1:<stored n>"}</code>.</li> </ul> <p><code>/seen</code> only moves forward: an older cursor is ignored and the stored one is returned. Send the cursor of the last item you actually displayed, never the summary's latest <code>cursor</code>, so items you did not show stay unseen. A cursor beyond the automation's latest item, or one that does not match <code>att1:<n></code>, answers 422 <code>invalid_request</code>. <code>/seen</code> never clears waits: they stay counted until they are answered.</p> <h2 id="discuss-an-occurrence">Discuss an occurrence<a class="headerlink" href="#discuss-an-occurrence" title="Permanent link">¶</a></h2> <p><code>POST /api/gateway/automations/{automation_id}/discuss</code></p> <div class="highlight"><pre><span></span><code>{"request_id": "…", "occurrence_index": 7, "prompt": "Why did memory jump here?"} → {"session_id": "discussion-session:…", "run_id": "…", "session_kind": "discussion", "workspace_root": "<its own folder>", "mounted_workspace": "<the automation's folder>"} </code></pre></div> <p>A discussion is a separate conversation about one occurrence. It runs the occurrence's workflow with its frozen inputs, your <code>prompt</code> as the new user turn, and the automation's conversation from occurrence 1 up to and including that occurrence as its history (oldest turns dropped first when it is long).</p> <ul> <li><strong>Identity.</strong> The discussion's run id is <code>uuid5(automation_id, "discuss:" + request_id)</code> and its session id is <code>discussion-session:<that run id></code>, so request ids are scoped to the automation. The same request returns the same discussion; a different request with the same <code>request_id</code> on that automation answers 409 <code>identity_conflict</code>.</li> <li><strong>Its own folder, the automation's mounted read-only.</strong> The discussion works in its own folder (<code>workspace_root</code>, a gateway session folder like any chat's), where it can write, edit and run commands. The automation's folder (<code>mounted_workspace</code>) is mounted alongside: the discussion can read it, and every write into it through file tools or workflow writers is refused. Shell commands run in the discussion's own folder; the mount is enforced for file tools and workflow writers, not inside shell commands. Apps can show "own workspace: … · automation files mounted read-only at …".</li> <li><strong>Nothing flows back.</strong> Nothing a discussion does is written into the automation's conversation, state or history.</li> <li><strong>Tools ask.</strong> The automation's tool grant does not apply; tools ask for approval as in any chat. The operator's default tool grant, when one is stored, applies to discussions as to any chat, so the commands it covers run without asking there too.</li> <li><strong>Errors.</strong> 404 <code>occurrence_not_found</code> for an unknown index, 422 <code>invalid_request</code> for an empty <code>prompt</code> or <code>request_id</code>, 409 <code>history_unavailable</code> when the history cannot be read.</li> </ul> <p><strong>Continue a discussion</strong> with <code>POST /api/gateway/runs/start</code> and its <code>session_id</code>. The gateway re-stamps every later turn from the discussion's first run, whatever the request says: the same provenance, the discussion's own folder, the automation's folder mounted read-only, and the discussion's history (read strictly). The history is provided by the gateway, so a request that sends <code>context.messages</code> in a discussion session is refused (400); a session whose discussion cannot be resolved answers 409 <code>session_attribution_failed</code>. These answers come from <code>/runs/start</code> and use its ordinary error shape.</p> <h2 id="wakes-work-a-run-schedules-for-later">Wakes: work a run schedules for later<a class="headerlink" href="#wakes-work-a-run-schedules-for-later" title="Permanent link">¶</a></h2> <p>A run can ask for work later: an agent's <code>schedule_run</code> tool (or the <code>SCHEDULE_RUN</code> effect of a flow) with <code>after_s</code>, <code>at</code> or <code>on</code> (a trigger), and a <code>task</code> or a <code>note</code> ("ping me in 5 minutes about X"). AbstractRuntime plans it (at most the caller's tools, never <code>schedule_run</code> itself, a note gets none); the gateway creates it as a <strong>one-shot automation</strong> owned by the run's account:</p> <ul> <li>it runs the session's own workflow (its turn root's bundle and flow, same provider and model), under the gateway's workspace guard and built-in tool deny for the session it will run in;</li> <li>by default the new run is a turn of the <strong>caller's session</strong> (<code>mode: same_session</code>), with the <code>[Trigger schedule@2 · occurrence 1 · …]</code> header, so the conversation shows it and the model's replay sees it; <code>mode: independent</code> runs it in the automation's own session;</li> <li>your event stream records <code>wake.scheduled {automation_id, session_id, origin_run_id, at | on}</code>, then, when it fires, <code>trigger.event</code> and the new run's <code>run.started</code> (origin <code>kind: "agent"</code>);</li> <li>cancel = archive the automation (<code>automation.archive</code>) before it fires: <code>wake.cancelled</code> is recorded and nothing runs. It is listed with your other automations meanwhile.</li> </ul> <p>Evidence: <code>src/abstractgateway/wakes_host.py</code> (<code>GatewayScheduleRun</code>, wired on every runtime the host builds), <code>src/abstractgateway/runner.py</code> (<code>_stream_wake_cancelled</code>).</p> <h2 id="automations-in-run-lists">Automations in run lists<a class="headerlink" href="#automations-in-run-lists" title="Permanent link">¶</a></h2> <p><code>GET /api/gateway/runs</code> rows carry the fields that say how a run belongs to an automation:</p> <table> <thead> <tr> <th>Field</th> <th>Values</th> </tr> </thead> <tbody> <tr> <td><code>session_kind</code></td> <td><code>chat</code>, <code>automation</code>, <code>occurrence</code>, <code>discussion</code></td> </tr> <tr> <td><code>automation_id</code></td> <td>the automation the run belongs to, or <code>null</code></td> </tr> <tr> <td><code>role</code></td> <td><code>controller</code>, <code>occurrence</code>, <code>descendant</code>, <code>discussion</code>, <code>legacy_schedule</code>, or <code>null</code></td> </tr> <tr> <td><code>occurrence_index</code></td> <td>the occurrence number, or <code>null</code></td> </tr> <tr> <td><code>legacy</code></td> <td><code>true</code> for an older scheduled run</td> </tr> <tr> <td><code>workspace_root</code></td> <td>on turn rows only (runs without a parent, and occurrences): the folder the run works in, as it runs (a launch-folder override, a discussion's own folder); absent on sub-runs, controllers and runs without one</td> </tr> </tbody> </table> <p>A growing automation's occurrences have <code>session_kind: "automation"</code>; an independent automation's occurrences have <code>session_kind: "occurrence"</code>.</p> <p>Every row also carries <code>kind</code>, the session's purpose (<a href="../api/#listing-behaviour">api.md</a>): an automation's occurrence sessions are <code>kind: "automation"</code> and leave the default conversation list (<code>kind=automation</code>, <code>kind=conversation,automation</code> or <code>session_kind=automation,occurrence</code> list them); AbstractNote's <code>note-process</code>, <code>note-reflect</code> and <code>note-consolidate</code> occurrences are <code>kind: "process"</code>, its captures and drains <code>notes</code>.</p> <ul> <li><strong><code>session_kind</code> filter.</strong> A comma-separated subset, for example <code>session_kind=chat,discussion</code>. An unknown kind answers 400.</li> <li><strong><code>root_only=true</code> returns turns:</strong> runs without a parent, except automation controllers, plus occurrences. A retried occurrence is one turn (its last attempt). A growing automation therefore reads as one chat session with one turn per occurrence, with no client changes.</li> <li><strong>A normal chat list</strong> uses <code>root_only=true&session_kind=chat,discussion</code>.</li> <li><code>GET /api/gateway/sessions/{session_id}/history/bloc</code> returns the same turns (<a href="../api/#session-history-bloc-get-sessionssession_idhistorybloc">api.md</a>).</li> <li>An older scheduled run lists with <code>role: "legacy_schedule"</code>, <code>session_kind: "automation"</code>, <code>is_scheduled: true</code> and <code>legacy: true</code>, so a chat list never shows it as a chat.</li> </ul> <h2 id="older-scheduled-runs-legacy">Older scheduled runs (legacy)<a class="headerlink" href="#older-scheduled-runs-legacy" title="Permanent link">¶</a></h2> <p>Schedules created with <code>POST /api/gateway/runs/schedule</code> (<a href="../api/#2b-schedule-a-run-bundle-mode">api.md</a>) are not converted. They appear in <code>GET /api/gateway/automations</code>, placed by the <a href="#listing-order">listing order</a>, with <code>legacy: true</code>, <code>revision: null</code> and <code>capabilities: ["legacy"]</code>, and keep their own controls (<code>pause</code>, <code>resume</code>, <code>cancel</code> through <code>POST /api/gateway/commands</code>).</p> <ul> <li><code>GET /api/gateway/automations/{id}</code> and the other per-automation routes answer 404 for them.</li> <li><code>trigger.binding_id</code> is the schedule's root run id; <code>last_occurrence</code> is its latest child run, with <code>index</code> its position among the children.</li> </ul> <h2 id="operations">Operations<a class="headerlink" href="#operations" title="Permanent link">¶</a></h2> <p><strong>One writer process per data folder.</strong> v1 supports one process that ticks runs, resumes them and applies commands on a data folder: the runner. Run either <code>abstractgateway serve</code> (API and runner in one process) or the split shape, <code>abstractgateway runner</code> plus <code>abstractgateway serve --no-runner</code>, on one data folder (<a href="../getting-started/#3-split-api-and-runner-opt-in">getting-started.md</a>). In the split shape the API process only creates automations and discussions and queues commands; the runner does the rest. The lock that serializes an automation's steps and commands works inside one process, so do not point a second gateway at the same data folder.</p> <p><strong>The runner drives controllers.</strong> Every workflow host registers the controller workflow that ships with AbstractRuntime, <code>abstractframework.automation-controller@1.0.0:controller</code> (it is not a bundle and does not appear in bundle lists), so the runner ticks controllers like any run. A controller sleeps on one wait until its next tick or retry; a command wakes it for an immediate tick. Nothing fires while no runner is ticking the data folder: <code>GET /api/health</code> reports the runner (<code>runner.runners[].status</code>).</p> <p><strong>Restart recovery.</strong> Automations are durable runs, so they survive a restart:</p> <ul> <li>After a restart the runner picks up every controller where it stopped.</li> <li>Occurrence ids are deterministic and a child run is created only when its id is free, so a restart in the middle of an occurrence continues that occurrence and never starts it twice.</li> <li>Commands accepted before the restart are applied from the runner's saved command position; a replayed command is recognized by its <code>command_id</code>.</li> <li>Ticks missed while the gateway was down coalesce into one occurrence.</li> <li>A command that fails on the host is recorded as rejected (<code>internal_error</code>); if even that record cannot be written, the runner keeps the command and retries it at the next poll.</li> </ul> <p><strong>Boot warm-up.</strong> With file-backed stores the gateway builds the run store's session and children indexes when it starts, so the first chat does not pay for that scan. The log line <code>run store session index warmed in <seconds>s</code> reports the time (about a second for 20,000 runs). SQLite stores keep these indexes in the database.</p> <p><strong>Acceptance check.</strong> From a source checkout, <code>scripts/accept_automations_v1.py</code> checks the whole feature end to end against a gateway it starts and stops itself:</p> <div class="highlight"><pre><span></span><code>python<span class="w"> </span>scripts/accept_automations_v1.py<span class="w"> </span>--data-dir<span class="w"> </span>/tmp/automation-acceptance </code></pre></div> <ul> <li><code>--data-dir</code> must be an empty or new folder; the script owns it.</li> <li><code>--interval</code> (default <code>20s</code>) is the schedule of its test monitors, short so the run is quick; <code>--port</code> picks the port (default: the first free port from 18900).</li> <li>It needs no model provider: its workflows are deterministic, and a local spy server checks that no provider call is made.</li> <li>It prints one <code>PASS</code> or <code>FAIL</code> line per step (creation, scheduled ticks, quiet versus notable occurrences, pause, run now while paused, resume without firing, revise, independent versus growing context, a restart in the middle of an occurrence, a two-turn discussion with refused writes, attention items, an unattended tool call, tool approval answered by kind, and a replay that makes zero calls) and exits 0 only when every step passes.</li> </ul> <h2 id="limits-in-v1">Limits in v1<a class="headerlink" href="#limits-in-v1" title="Permanent link">¶</a></h2> <ul> <li>Schedules are fixed UTC intervals (<code>s</code>, <code>m</code>, <code>h</code>, <code>d</code>, at most <code>366d</code>) or daily, weekly and monthly rules at a wall time in an IANA time zone (<code>schedule@2</code>); there are no cron expressions.</li> <li>The trigger sources are <code>schedule@1</code>, <code>schedule@2</code>, <code>manual@1</code>, <code>email.received@1</code>, <code>feed.item@1</code> and <code>webhook.received@1</code>, plus sources installed by other packages.</li> <li>Occurrences run one at a time, missed ticks coalesce, and a failed occurrence never stops the automation. These policies cannot be changed.</li> <li>Growing history is the most recent whole turns within the configured token budget (50,000 tokens by default) and is not summarized; older turns drop out of the replay (they stay in the store).</li> <li>Under <code>tool_approval: "auto"</code>, tools outside AbstractRuntime's classification, such as third-party MCP tools, still ask for approval, and messages to anyone but your registered email always ask. Recipients named in an automation's definition are not pre-approved yet (backlog 0992).</li> <li>Retries repeat the external effects of the failed attempt.</li> <li>A <code>@default</code> target must resolve to a workflow of the gateway's own registry, not the shared catalog.</li> <li><code>GET /api/gateway/automations</code> has no change cursor: poll complete pages.</li> <li>The summary's <code>attention.items</code> and <code>attention.waits</code> hold up to 20 entries.</li> <li>Older scheduled runs are listed read-only and never converted.</li> <li>One writer process per data folder.</li> </ul> <h2 id="related-docs">Related docs<a class="headerlink" href="#related-docs" title="Permanent link">¶</a></h2> <ul> <li><a href="../api/">api.md</a>: the rest of the HTTP contract, durable commands and run lists</li> <li><a href="../architecture/#automations">architecture.md</a>: where automations sit in the gateway</li> <li><a href="../security/">security.md</a>: sign-in, the workspace guard and the built-in deny list</li> <li><a href="../faq/#automations">faq.md</a> and <a href="../troubleshooting/#automations">troubleshooting.md</a></li> <li>AbstractRuntime <code>docs/automations.md</code>: the controller, triggers, retries, context modes and discussions</li> </ul> <h2 id="growing-context-limit">Growing context limit<a class="headerlink" href="#growing-context-limit" title="Permanent link">¶</a></h2> <p>Choose <strong>Growing</strong> to set <strong>Max growing context (tokens)</strong> when creating or editing an automation. The default is 50,000; enter <code>30000</code> for a 30,000-token history budget. The limit is hidden for <strong>Independent</strong> runs. Changing it affects subsequent occurrences; already admitted occurrences retain their history for retries. History retains whole turns, including the newest turn even when that turn alone exceeds the budget.</p> <p>The API field is <code>context.growing.max_tokens</code>, a positive integer. Existing definitions that omit it retain the gateway's default, which <code>GET /api/gateway/automations/defaults</code> serves as <code>{"growing_max_tokens": 50000}</code>: clients show and pre-fill that value rather than a number of their own.</p> </article> </div> <script>var target=document.getElementById(location.hash.slice(1));target&&target.name&&(target.checked=target.name.startsWith("__tabbed_"))</script> </div> <button type="button" class="md-top md-icon" data-md-component="top" hidden> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8z"/></svg> Back to top </button> </main> <footer class="md-footer"> <div class="md-footer-meta md-typeset"> <div class="md-footer-meta__inner md-grid"> <div class="md-copyright"> Made with <a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener"> Material for MkDocs </a> </div> </div> </div> </footer> </div> <div class="md-dialog" data-md-component="dialog"> <div class="md-dialog__inner md-typeset"></div> </div> <script id="__config" type="application/json">{"annotate": null, "base": "..", "features": ["navigation.instant", "navigation.tracking", "navigation.top", "content.code.copy"], "search": "../assets/javascripts/workers/search.a7633da7.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script> <script src="../assets/javascripts/bundle.a5f9d56c.min.js"></script> </body> </html>