Skip to content

Collaboration and automation

Automation API

Durable workflows whose steps send Communication messages and requests, run Agents executions, invoke Actions and wait for their approval, or wait for a timer or a signal. A step can read the run input and earlier steps' output, and a run continues on the service after the process that started it exits.

Local preview

Contract 1 runs on the local service only, is not hosted or published, and may change. It is the only Automation contract: a never-pinned preview that a request without Roye-Contract-Version also gets. Contract 2 is retired. A request naming it gets contract_version_unsupported, and company operating sessions are read through the Company Workspace API.

Quickstart

Your trusted backend creates a workflow with a backend key. This one sends a message, then waits for a signal.

create-workflow.http
# A workflow: send a message, then wait for a signal. Bodies are strict JSON.
POST /v1/automation/workflows
Authorization: Bearer <backend key>
X-Roye-Project: <projectId>
X-Roye-Environment: development
Roye-Contract-Version: 1
Content-Type: application/json

{ "idempotencyKey": "wf-review-1", "displayName": "review-request",
  "revision": {
    "bindings": { "communication": { "workspaceId": "cws_…", "actorId": "act_notifier" } },
    "steps": [
      { "stepId": "notify", "kind": "communication.send",
        "input": { "recipientActorId": "act_reviewer",
                   "message": { "type": "review.requested.v1", "text": "Please review ticket T-1." } } },
      { "stepId": "approve", "kind": "wait.signal", "after": ["notify"],
        "input": { "signalName": "approval", "expiresInMs": 300000 } } ] } }

# 201 { "id": "awd_…", "state": "active", "currentRevision": 1, "revision": 1, "current": { "steps": [ … ], … }, … }

Create a manual trigger and start a run.

start-run.http
# A manual trigger of revision 1 (a manual trigger records no fires).
POST /v1/automation/workflows/awd_…/triggers
{ "idempotencyKey": "trg-1", "kind": "manual", "workflowRevision": 1 }

# Start a run. The run continues on the service if this process exits.
POST /v1/automation/workflows/awd_…/runs
{ "idempotencyKey": "run-1", "input": { "ticket": "T-1" } }
# 201 { "id": "arn_…", "state": "pending", "origin": "manual", "nextWakeAt": null, … }

Later, any process with the run ID can signal the wait and read the result.

signal-run.http
# Later, from any process holding the run ID: find the open signal wait, then signal it.
GET /v1/automation/runs/arn_…/waits?state=open
# 200 { "items": [ { "id": "awt_…", "kind": "signal", "signalName": "approval", "state": "open", "expiresAt": 1760000000000, … } ], "next": null }

POST /v1/automation/runs/arn_…/signals
{ "idempotencyKey": "sig-1", "signalName": "approval", "signalKey": "approve-1", "payload": { "approved": true } }
# 201 { "runId": "arn_…", "waitId": "awt_…", "signalName": "approval", "signalKey": "approve-1", "receivedAt": 1760000000000 }

# Read the result: state succeeded, terminalReason completed, and the entries that did the work.
GET /v1/automation/runs/arn_…
GET /v1/automation/runs/arn_…/entries

Concepts

ResourceMeaning
Workflow (awd_)Steps, an optional inputSchema and, for Communication steps, a Communication binding (workspace, actor). Each change adds an immutable revision.
Trigger (atr_)Starts runs of the revision it is pinned to. A schedule or event trigger runs as the project key it names. See triggers.
Fire (atf_)A slot or matched request: started, queued, skipped_overlap, refused, cancelled or not_admitted.
Run (arn_)One execution of a pinned revision. See runs.
Entry (ade_)A step's dispatch: derived idempotency keys, target, typed outcome and disposition (reported, pending, unknown). A settled entry exposes an output that later steps can reference.
Wait (awt_)The timer, signal, reply, Agents execution, Actions intent (action_terminal) or Actions approval (approval) a run is parked on.
EventThe project change feed, delivered at least once: deduplicate by eventId.

Credentials

Only your trusted backend manages Automation, with a backend key (ryk_…) or the owner console session. Keep the key out of browsers. There is no Automation-scoped token: actor connections, member tokens and participant tokens get 403 forbidden before any lookup.

  • Send X-Roye-Project, X-Roye-Environment and Roye-Contract-Version: 1. Bodies are strict JSON.
  • A key that starts a run, creates or resumes a trigger, or resumes a run grants automation and the scope of every module the steps use: communication for Communication steps, agents for agents.execute, actions for actions.invoke and wait.approval. scopes: null grants them all, and a console session covers every module.
  • Schedule and event triggers run as the project key they name, never as the credential that created them. See trigger keys.
  • A run's Communication steps act through a short-lived connection issued for the bound actor.

Steps

after lists the steps that must settle first. A typed outcome may route to another step, end or fail. A step input may reference the run input and the output of a step that settles first.

KindWhat it does
communication.sendSends a message as the bound actor.
communication.requestSends a work request and waits for the reply.
agents.executeRuns one Agents execution as the run's subject. Needs no Communication binding.
actions.invokeCreates an Actions intent and waits for it. See Actions steps.
wait.approvalWaits until the approval of an Actions intent is decided.
wait.timer, wait.signalWaits for a timer or a named signal.

agents.execute takes definition (id, revision), input (text, optional outputFormat) and executionWaitMs. Read its execution (agx_) with GET /v1/agents/executions/ID under Agents contract 2 (Agents API). Outcomes:

  • completed or failed.
  • expired: the wait ended first and the execution was cancelled. The entry stays pending until its final state is read.
  • uncertain: the model call's result, or the create, is unknown.

Passing data between steps

A field that accepts a reference may hold { "$ref": … } instead of a value. It names run.input or steps.STEP.output, optionally followed by a dotted path. A path has at most 8 segments of 1 to 64 letters, digits, hyphens or underscores, and a numeric segment indexes an array. A step holds at most 16 references.

nightly-report.http
# A nightly report: an Agents step writes the report for the scheduled date, and an Actions step delivers it.
POST /v1/automation/workflows
{ "idempotencyKey": "wf-report-1", "displayName": "nightly-report",
  "revision": {
    "bindings": {},
    "inputSchema": { "type": "object", "required": ["schedule"],
                     "properties": { "schedule": { "type": "object", "required": ["date"],
                                                   "properties": { "date": { "type": "string" } } } } },
    "steps": [
      { "stepId": "report", "kind": "agents.execute",
        "input": { "definition": { "id": "<definitionId>", "revision": 1 },
                   "input": { "text": { "$ref": "run.input.schedule.date" } },
                   "executionWaitMs": 600000 } },
      { "stepId": "deliver", "kind": "actions.invoke", "after": ["report"],
        "input": { "invokerId": "aiv_…", "bindingId": "acb_…", "actionType": "https_webhook.deliver",
                   "input": { "eventType": "report.ready.v1",
                              "body": { "date": { "$ref": "run.input.schedule.date" },
                                        "report": { "$ref": "steps.report.output.text" } } },
                   "intentWaitMs": 3600000 } } ] } }

# A schedule at 01:00 every day in Seoul, as a project key that grants automation, agents and actions.
POST /v1/automation/workflows/awd_…/triggers
{ "idempotencyKey": "trg-report-1", "kind": "schedule", "workflowRevision": 1, "keyId": "<reportsKeyId>",
  "schedule": { "calendar": { "minutes": [0], "hours": [1] }, "timezone": "Asia/Seoul" } }

# Or start a run by hand for one date. The input is checked against inputSchema.
POST /v1/automation/workflows/awd_…/runs
{ "idempotencyKey": "run-report-1", "input": { "schedule": { "date": "2026-10-27" } } }
# An input without schedule creates no run:
# 400 { "error": { "code": "invalid_request", "field": "/input/schedule", … } }

# Each settled entry carries the output a later step can reference.
GET /v1/automation/runs/arn_…/entries
# 200 { "items": [ { "stepId": "report", "state": "settled", "outcome": { "outcome": "completed" },
#                    "output": { "executionId": "agx_…", "text": "…" }, … },
#                  { "stepId": "deliver", "state": "settled", "outcome": { "outcome": "completed" },
#                    "output": { "intentId": "aci_…", "state": "completed", … }, … } ], "next": null }
  • A referenced step must be certain to settle first: list it in after, directly or through the steps it waits for. A step that several steps route to with onOutcome starts when any one of them routes to it, so it may reference only a step that settles first on every route.
  • Create and revise refuse a malformed reference, an unknown step, the step itself, a step not certain to settle first and a wait.timer step, which has no output. The refusal is 400 workflow_invalid with error.field, the JSON Pointer of the reference in your request body.
  • References resolve once, when the step is decided, and the resolved input is recorded, so a replay after a crash sends the same request.
  • An absent value fails the step with outcome.code reference_unresolved, and a value the field does not accept with reference_invalid. Both name outcome.field, and the step fails before any downstream call.
  • A settled entry keeps an output of at most 16 KiB of canonical JSON. A larger output is not kept: the entry shows outputLimited: true, and a reference to it is unresolved.
Step kindFields that accept a referenceOutput of a settled entry
communication.sendrecipientActorId, message.textmessageId
communication.requestresponderActorId, request.textrequestId, state
agents.executeinput.textexecutionId, text (the final output), and json when outputFormat is json and the text parses
actions.invokeAny value inside inputintentId, state, approvalId, reference
wait.approvalintentIdintentId, state, approvalId, approvalState, reference
wait.signalNonepayload, the signal's payload
wait.timerNoneNone, so no reference may name it
references.http
# With outputFormat json, a reference can reach into the parsed output.
{ "stepId": "deliver", "kind": "actions.invoke", "after": ["report"],
  "input": { "invokerId": "aiv_…", "bindingId": "acb_…", "actionType": "https_webhook.deliver",
             "input": { "eventType": "report.ready.v1",
                        "body": { "summary": { "$ref": "steps.report.output.json.summary" },
                                  "firstItem": { "$ref": "steps.report.output.json.items.0" } } },
             "intentWaitMs": 3600000 } }

# The model answered without summary: the deliver step fails before it invokes anything.
# { "stepId": "deliver", "state": "settled",
#   "outcome": { "outcome": "failed", "code": "reference_unresolved", "field": "/input/input/body/summary" } }

# Without "after": ["report"], create refuses the reference with the JSON Pointer of the value:
# 400 { "error": { "code": "workflow_invalid", "field": "/revision/steps/1/input/input/body/summary", … } }

Input schema

When the revision has an inputSchema, every run input is checked against it. A manual start that fails is 400 invalid_request with error.field and creates no run, and a fire whose input fails is recorded refused with invalid_request. The schema uses the JSON Schema subset of Agents structured output (type, enum, const, required, properties, items, additionalProperties: false, length, item and number bounds, and oneOf with a const discriminator) and is at most 16 KiB. A keyword outside the subset is 400 unsupported_capability.

Actions steps and approvals

KindInputSettles
actions.invokeinvokerId, bindingId, actionType, input (any value may be a reference), optional settleOn, intentWaitMs.With settleOn terminal (the default), when the intent ends: completed, declined when its approval was denied, expired, uncertain while the effect is unknown or unresolved, or failed. With admission, completed as soon as the intent is admitted.
wait.approvalintentId, usually a reference to the intentId output of an admission invoke, and approvalWaitMs.completed when the approval is approved or consumed, declined when denied, expired when it or the wait expires, failed when withdrawn or revoked.
  • actions.invoke creates the intent through the public Actions invoke operation as the named invoker, keyed by the entry, and asks for an approval whenever the Actions policy requires one. A lost response is read back from the Actions intent list, never sent again under a new key.
  • When intentWaitMs passes first, an intent before its dispatch point is cancelled and the step settles expired. Past that point the step keeps reading the intent until it ends. An Actions refusal at invoke, such as action_not_permitted or binding_not_active, fails the step with that code.
  • A run never leaves behind an intent that a later approval could still send. A wait.approval step that expires cancels the intent its own run created. A run that is cancelled, expires or fails cancels every intent it created that has not reached its dispatch point, and a run that succeeds cancels one a wait.approval step was still waiting for. An intent the run did not create is never cancelled.
  • Both kinds need the actions scope. Automation never redispatches, attests or cancels an effect past its dispatch point.

Who decides an approval

Automation and keys never decide an approval. A project member decides it in the console, or your backend issues an approver token for that one approval with POST /v1/actions/approvals/ID/approver-tokens and gives it to the person who decides, such as an end user in your own app (approver tokens). The actions.invoke output names approvalId for this. Actions refuses self-approval: the requester is the trigger's key, so issue the token with another project key or as a member, never with the key chain the trigger runs as.

approval.http
# An escalation: ask for an approval-required action, wait for the decision, then tell the requester.
"steps": [
  { "stepId": "email", "kind": "actions.invoke",
    "input": { "invokerId": "aiv_…", "bindingId": "acb_…", "actionType": "https_webhook.deliver",
               "input": { "eventType": "customer.reply.v1", "body": { "requestId": { "$ref": "run.input.event.requestId" } } },
               "settleOn": "admission", "intentWaitMs": 3600000 } },
  { "stepId": "approve", "kind": "wait.approval", "after": ["email"],
    "input": { "intentId": { "$ref": "steps.email.output.intentId" }, "approvalWaitMs": 86400000 } },
  { "stepId": "tell", "kind": "communication.send", "after": ["approve"],
    "input": { "recipientActorId": { "$ref": "run.input.event.requesterActorId" },
               "message": { "type": "escalation.result.v1", "text": { "$ref": "steps.approve.output.state" } } } } ]

# The email entry's output names the approval.
GET /v1/automation/runs/arn_…/entries
# 200 { "items": [ { "stepId": "email", "state": "settled", "outcome": { "outcome": "completed" },
#                    "output": { "intentId": "aci_…", "state": "awaiting_approval", "approvalId": "apr_…", "reference": null } }, … ] }

# A member decides it in the console, or your backend issues an approver token for the person who decides,
# with another project key: never the key chain the trigger runs as, which is the requester.
POST /v1/actions/approvals/apr_…/approver-tokens
Authorization: Bearer <another project key>
{ "idempotencyKey": "approver-1", "ttlMs": 900000 }
# 201 { "token": { "id": "apt_…", "approvalId": "apr_…", "state": "active", … }, "secret": "apt_…", "secretStatus": "returned" }

Triggers

TriggerBehavior
ManualNo fires, no keyId, and nextFireAt is null. Start runs with POST /workflows/ID/runs.
IntervalFires at the anchor plus k times schedule.intervalMs.
Calendarschedule.calendar lists minutes, hours, optional daysOfMonth, months (1 to 12) and daysOfWeek (0 is Sunday) in IANA schedule.timezone (default UTC). Both day fields must match if set.
EventOne run per open Communication work request of a type in requestTypes to a recipient in recipientActorIds.
schedule-trigger.http
# A schedule on a calendar: 09:00 on weekdays in Seoul (daysOfWeek 0 is Sunday).
POST /v1/automation/workflows/awd_…/triggers
# It runs as the project key it names in keyId, sent with that key or another key of its rotation chain.
{ "idempotencyKey": "trg-2", "kind": "schedule", "workflowRevision": 1, "keyId": "<scheduleKeyId>",
  "schedule": { "calendar": { "minutes": [0], "hours": [9], "daysOfWeek": [1, 2, 3, 4, 5] }, "timezone": "Asia/Seoul" } }
# 201 { "id": "atr_…", "kind": "schedule", "keyId": "<scheduleKeyId>", "overlap": "skip",
#       "spec": { "calendar": { … }, "timezone": "Asia/Seoul", "catchUp": "latest_only" }, "nextFireAt": 1760000000000, … }
# Each fire starts a run whose input is the slot in the trigger's timezone:
# { "schedule": { "slotTime": 1760000000000, "date": "2026-10-28", "time": "09:00", "timezone": "Asia/Seoul" } }

Schedule rules

  • A calendar that never matches is invalid_request. One with no slot in 366 days shows diagnostic calendar_sparse.
  • A time skipped by daylight saving fires at the next valid instant. A repeated time fires once, at its first occurrence.
  • After downtime only the latest missed slot fires, and skippedSlots counts the rest.
  • Every slot, skipped or refused too, records a fire with slotIndex and slotTime.
  • A fire starts its run with the input schedule: slotTime, date (YYYY-MM-DD) and time (HH:MM) in the trigger's timezone, and timezone (UTC for an interval).
event-trigger.http
# An event trigger: a run per open work request of an allowed type to an allowed recipient.
# Plain messages and replies never start a run; at most maxFiresPerDay runs start per UTC day.
# Its key also grants communication. Requests that arrive while a run is active wait as queued fires.
POST /v1/automation/workflows/awd_…/triggers
{ "idempotencyKey": "trg-3", "kind": "event", "workflowRevision": 1, "keyId": "<supportKeyId>",
  "event": { "domain": "communication", "workspaceId": "cws_…", "requestTypes": ["review.requested.v1"],
             "recipientActorIds": ["act_reviewer"], "maxFiresPerDay": 50 } }
# 201 { "id": "atr_…", "kind": "event", "keyId": "<supportKeyId>", "overlap": "queue", "queuedFires": 0, … }
# Its fires: GET /v1/automation/triggers/atr_…/fires
# 200 { "items": [ { "id": "atf_…", "disposition": "queued", "source": { "type": "request", "id": "req_…", … }, … },
#                  { "id": "atf_…", "disposition": "started", "runId": "arn_…", "startedAt": 1760000000000,
#                    "source": { "domain": "communication", "type": "request", "id": "req_…", "revision": 1 }, … } ], "next": null }

Event trigger rules

  • Types match exactly, with no wildcard, and content is never read. Plain messages, replies and the workflow actor's own requests start nothing.
  • A request starts at most one run, and the fire's source names it. A request closed by then is not_admitted. One over maxFiresPerDay is refused with quota_exceeded, and a queued request counts when it is queued.
  • The run input names the request (workspaceId, requestId, messageId, type, requesterActorId, recipientActorId), never its content. A paused trigger reads nothing, resume admits only newer requests, and a feed past retention shows diagnostic feed_gap.

Overlapping fires

A trigger's overlap decides what a fire does while an earlier run of the trigger is active.

  • skip, the default for schedule triggers, records the fire skipped_overlap.
  • queue, the default for event triggers, records the fire queued with the run input it will start with, up to 32 queued fires. When the active run ends, the oldest queued fire starts, so no work request is dropped because a run was active. A later fire is skipped_overlap.
  • A queued event fire reads its request again before it starts and is not_admitted if the request no longer qualifies. Pause keeps the queue, and retire cancels it.
  • allow starts a fire at once while fewer than maxActiveRuns of the trigger's runs are active (default 4, at most 16), and records it skipped_overlap otherwise.
  • The trigger view shows overlap, maxActiveRuns for allow and queuedFires for queue. A started fire shows startedAt.

Trigger keys

A schedule or event trigger fires when no caller is present, so it names the project key it runs as in keyId. A manual trigger never fires and refuses keyId. The trigger and every run it starts act as that key, and the trigger view shows it.

  • Only the key's own rotation chain arms or re-points the trigger: send the create, or a resume naming keyId, with that key or another key of its chain. Any other key, and a member, gets 403 forbidden with error.field /keyId, so a member creates only manual triggers.
  • The key belongs to the same project and environment, is held by the project (created or rotated through /v1/keys) and is active. An unknown, creator-held or inactive key is 400 invalid_request with error.field /keyId.
  • The key grants automation and the scope of every module the pinned revision's steps use. An event trigger's key also grants communication, because the trigger reads the workspace events as that key. A missing scope is 403 forbidden with error.field /keyId.
  • The key that arms a trigger is the requester of every Actions intent its runs create, so it can never approve them.
  • Scopes never change and a rotation copies them, so a key that passed the check at create, start or resume keeps passing it for the life of the work.
WhenWhat happensWhat you do
The key is rotatedThe trigger keeps firing as the newest key of the rotation chain. Nothing is re-pointed.Nothing.
The key, or after the overlap the newest key of its chain, is revoked or expiresThe next fire is recorded refused with authority_revoked, the trigger pauses with grant_withdrawn, and its running runs are held with grant_withdrawn.Re-point the trigger with POST /triggers/ID/resume, sent with the new project key and naming it in keyId, checked as at create. Resume each held run with POST /runs/ID/resume, which re-subjects it to the resuming credential.
The trigger is resumed without keyIdThe trigger keeps its key.If the key no longer stands, the resume is 400 invalid_request with error.field /keyId. Name another key.
The trigger was created before trigger keysIt has no keyId and keeps the subject recorded at its creation.Resume re-subjects it to the resuming credential, as before.

Runs

Any process can reattach to a run with its ID. Runs advance only while the service's Automation worker runs.

  • States are pending, running, waiting, held and suspended, then succeeded, failed, cancelled or expired with a terminalReason such as completed.
  • blockedReasons says why a run is held. nextWakeAt is null, not zero, when nothing is due.
  • suspend holds the run's pending entries.

Endpoints

Routes are under /v1/automation. Lists take cursor and limit and return items and next. Writes take idempotencyKey, and changes add the expectedRevision you read.

RouteInput
POST /workflowsdisplayName, revision (bindings, steps whose input may hold references, optional inputSchema, deadlineMs, maxStepsPerRun).
GET /workflows, /workflows/IDstate.
POST /workflows/ID/revisions, archiverevision. Archiving stops new runs and fires.
POST /workflows/ID/triggerskind (manual, schedule or event), workflowRevision; keyId for a schedule or event trigger; optional overlap and, for allow, maxActiveRuns; and schedule or event (domain communication, workspaceId, requestTypes, recipientActorIds, optional maxFiresPerDay).
GET /triggers, /triggers/ID, /triggers/ID/firesworkflowId, state. A trigger shows keyId, overlap, queuedFires, nextFireAt and any diagnostic.
POST /triggers/ID/pause, resume, retireresume keeps the trigger's key, or re-points it to an optional keyId checked as at create. retire cancels queued fires.
POST /workflows/ID/runsOptional workflowRevision, input (checked against inputSchema).
GET /runs, /runs/ID, /runs/ID/entries, /runs/ID/waitsworkflowId, triggerId, state. Entries carry their output.
POST /runs/ID/suspend, resume, cancelcancel takes an optional reason.
POST /runs/ID/signalssignalName, signalKey, optional payload. Returns 201, or 200 when the same key and payload repeat.
GET /eventscursor, limit, waitMs, workflowId, runId.

Limits and usage

LimitValue
Steps32 per revision. maxStepsPerRun is 32 by default, at most 256.
Triggers per workflow20.
Run deadline7 days by default, at most 30.
Wait or delay1 second to 7 days.
Schedule interval1 minute to 365 days.
CalendarSearched 366 days ahead. skippedSlots counts up to 1,000.
Event trigger16 request types, 16 recipients. maxFiresPerDay is 100 by default, at most 1,000 per UTC day. Feed read about every 15 seconds.
Overlap32 queued fires per queue trigger. maxActiveRuns 1 to 16, default 4.
Run input, signal payload64 KiB, 16 KiB.
Input schema, entry output16 KiB each.
References16 per step, 8 path segments each.
Message and Agents input text4096 characters.
Pages, waitMs64 items, 30 seconds.
Event retention7 days.

No step is charged. Each Communication, Agents or actions.invoke entry records one automation.step measurement when first sent. Waits, wait.approval and replays record none. Agents meters an Agents step's model usage once, and Actions meters its own intent once.

Placeholder local-preview values that may change before any hosted offer; the capabilities response names the profile revision. Not included: hosted service, trigger revisions, exports, an Automation-scoped token, and a template that builds text from several values (a reference passes one whole value). Console views are read-only.

Errors

Errors use the shared envelope (error.code, category, message, retryable, nextAction). Handle the code, not the message. A refused body names the offending value in error.field, a JSON Pointer such as /revision/steps/1/input/input/text or /keyId.

CodeHTTPWhat to do
invalid_request, workflow_invalid400Fix the input, such as a calendar that never matches, a step cycle, a reference that is not certain to resolve, a run input that fails inputSchema, or an unknown, creator-held or inactive keyId.
contract_version_unsupported400Only contract 1 is served, and contract 2 is retired. Do not retry as is.
unsupported_capability400Unsupported here: a later-slice kind, an inputSchema keyword outside the subset, or a missing module.
payload_limit413Shrink the input, payload or schema.
forbidden403Use a project credential that grants automation and every step module. A trigger key must be armed by its own rotation chain.
not_found404Not in this project and environment.
wait_not_signalable409No matching open wait, or the run ended. Re-read the run.
signal_conflict, idempotency_conflict409The key holds other input. Recover the original.
revision_conflict, invalid_transition409Stale expectedRevision, or not allowed in this state. Re-read.
workflow_archived409Archived: no new run or trigger.
cursor_expired410Read the lists, then use a fresh cursor.

A step that fails on a reference is not an error response. Its entry settles failed with outcome.code (reference_unresolved or reference_invalid) and outcome.field.

Recovery

Persist idempotencyKey with the input before sending, or inject an intent store so roye.intents.resume() recovers by key.

SituationWhat to do
Lost responseCall the read-only POST /v1/operations/recover with module automation, the kind (such as runs.start), its target (such as workflowId) and the key.
Re-sent requestThe same body and key return the stored original with Roye-Replayed: true. Nothing repeats.
CancellationPOST /runs/ID/cancel ends the run and closes its waits at once. Archiving a workflow cancels no run.
recovery.http
# The start response was lost. Recover the original by key: read-only, never a second start.
POST /v1/operations/recover
{ "module": "automation", "kind": "runs.start", "target": { "workflowId": "awd_…" }, "idempotencyKey": "run-1" }
# 200 { "operationId": "op_…", "state": "succeeded", "result": { "status": 201, "resource": { "domain": "automation", "type": "run", "id": "arn_…" } }, … }

# Or re-send the same body with the same key: the stored original, with  Roye-Replayed: true.
POST /v1/automation/workflows/awd_…/runs
{ "idempotencyKey": "run-1", "input": { "ticket": "T-1" } }

# Late signal after the run ended:
# 409 { "error": { "code": "wait_not_signalable", "category": "conflict", "retryable": false, "nextAction": "reread", … } }

SDK and examples

Each roye.automation method sends one contract 1 request, validated with the contract schemas, and never polls. triggers.create takes keyId, overlap and maxActiveRuns, and triggers.resume takes expectedRevision and an optional keyId. events.page raises ObservationGap on cursor_expired. A company's operating sessions are not on this handle. Runnable examples are listed in examples/README.md.

automation.ts
import { Roye } from '@roye-ai/client';

// Trusted backend only. The key grants automation and every module the steps use.
const roye = new Roye({ baseURL, token: () => process.env.ROYE_PROJECT_KEY!, projectId, environment: 'development', intents });
const workflow = await roye.automation.workflows.create({
  displayName: 'nightly-report',
  revision: { bindings: {}, inputSchema, steps }, // steps hold { $ref } inputs, as in the HTTP example
});

// The schedule runs as the key it names; send this call with that key or another key of its chain.
const trigger = await roye.automation.triggers.create(workflow.id, {
  kind: 'schedule',
  workflowRevision: workflow.currentRevision,
  keyId: reportsKeyId,
  schedule: { calendar: { minutes: [0], hours: [1] }, timezone: 'Asia/Seoul' },
});

const run = await roye.automation.runs.start(workflow.id, { input: { schedule: { date: '2026-10-27' } } });
const entries = await roye.automation.runs.entries.list(run.id); // each settled entry carries its output

// The key was revoked and the trigger paused with grant_withdrawn: re-point it, sent with the new key.
const paused = await roye.automation.triggers.get(trigger.id);
await roye.automation.triggers.resume(trigger.id, { expectedRevision: paused.revision, keyId: newReportsKeyId });

// A lost response: recover by the persisted key.
const [recovered] = await roye.intents.resume();