협업과 자동화
Automation API
Communication 메시지와 요청 보내기, Agents 실행, Actions 요청과 그 승인 대기, 타이머나 시그널 대기를 단계로 묶어 워크플로로 실행합니다. 단계는 런 입력과 앞 단계의 출력을 읽을 수 있습니다. 런은 서비스에서 진행되므로, 런을 시작한 프로세스가 끝나도 계속됩니다.
계약 1은 로컬 서비스에서만 제공합니다. 호스팅이나 공개는 하지 않았고, 바뀔 수 있습니다. Automation 계약은 계약 1 하나뿐이며 고정되지 않는 미리보기입니다. Roye-Contract-Version이 없는 요청도 계약 1로 처리합니다. 계약 2는 폐지되었습니다. 계약 2를 지정한 요청은 contract_version_unsupported를 받으며, 회사의 운영 세션은 Company 워크스페이스 API로 읽습니다.
빠른 시작
신뢰할 수 있는 백엔드가 백엔드 키로 워크플로를 만듭니다. 이 워크플로는 메시지를 보낸 뒤 시그널을 기다립니다.
# 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": [ … ], … }, … }수동 트리거를 만들고 런을 시작합니다.
# 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, … }나중에 런 ID만 있으면 어느 프로세스에서든 대기에 시그널을 보내고 결과를 읽을 수 있습니다.
# 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개념
| 리소스 | 설명 |
|---|---|
워크플로 (awd_) | 단계, 선택 사항 inputSchema, 그리고 Communication 단계가 있으면 Communication 바인딩(워크스페이스, 액터)으로 이루어집니다. 바꿀 때마다 새 불변 리비전이 생깁니다. |
트리거 (atr_) | 트리거에 고정된 리비전으로 런을 시작합니다. 스케줄 트리거와 이벤트 트리거는 지정한 프로젝트 키로 실행됩니다. 트리거를 참고하세요. |
Fire (atf_) | 슬롯이나 조건에 맞은 요청 하나의 기록입니다. 상태는 started, queued, skipped_overlap, refused, cancelled, not_admitted 중 하나입니다. |
런 (arn_) | 고정된 리비전을 한 번 실행한 것입니다. 런을 참고하세요. |
엔트리 (ade_) | 단계 하나의 디스패치 기록입니다. 파생 멱등 키, 대상, 유형이 정해진 결과, 처리 상태(reported, pending, unknown)를 담습니다. 끝난 엔트리는 뒤 단계가 참조할 수 있는 output을 보여 줍니다. |
대기 (awt_) | 런이 멈춰서 기다리는 타이머, 시그널, 답장, Agents 실행, Actions 인텐트(action_terminal), Actions 승인(approval)입니다. |
| 이벤트 | 프로젝트의 변경 피드입니다. 최소 한 번 전달되므로 eventId로 중복을 걸러 내세요. |
자격 증명
Automation은 신뢰할 수 있는 백엔드만 백엔드 키(ryk_…)나 소유자 콘솔 세션으로 관리합니다. 키를 브라우저에 두지 마세요. Automation 전용 토큰은 없으며, 액터 연결, 멤버 토큰, 참가자 토큰으로 호출하면 리소스를 찾기도 전에 403 forbidden을 돌려줍니다.
X-Roye-Project,X-Roye-Environment,Roye-Contract-Version: 1을 보내세요. 본문은 엄격한 JSON입니다.- 런을 시작하거나, 트리거를 만들거나 재개하거나, 런을 재개하는 키에는
automation범위와 함께 단계가 쓰는 모든 모듈의 범위가 있어야 합니다. Communication 단계는communication,agents.execute는agents,actions.invoke와wait.approval은actions범위가 필요합니다.scopes: null인 키는 모든 범위를 가지며, 콘솔 세션은 모든 모듈을 쓸 수 있습니다. - 스케줄 트리거와 이벤트 트리거는 트리거를 만든 자격 증명이 아니라 지정한 프로젝트 키로 실행됩니다. 트리거 키를 참고하세요.
- 런의 Communication 단계는 서비스가 바인딩된 액터에게 발급하는, 수명이 짧은 연결로 동작합니다.
단계
after에는 먼저 끝나야 하는 단계를 적습니다. 유형이 정해진 결과에 따라 다른 단계나 end, fail로 넘어가게 할 수 있습니다. 단계 입력에서는 런 입력과 먼저 끝나는 단계의 출력을 참조할 수 있습니다.
| 종류 | 하는 일 |
|---|---|
communication.send | 바인딩된 액터로 메시지를 보냅니다. |
communication.request | 업무 요청을 보내고 답장을 기다립니다. |
agents.execute | 런의 주체로 Agents 실행을 한 번 돌립니다. Communication 바인딩은 필요 없습니다. |
actions.invoke | Actions 인텐트를 만들고 기다립니다. Actions 단계를 참고하세요. |
wait.approval | Actions 인텐트의 승인이 결정될 때까지 기다립니다. |
wait.timer, wait.signal | 타이머나 이름 붙은 시그널을 기다립니다. |
agents.execute는 definition(id, revision), input(text, 선택 사항 outputFormat), executionWaitMs를 받습니다. 실행(agx_)은 Agents 계약 2에서 GET /v1/agents/executions/ID로 읽습니다(Agents API). 결과는 다음 중 하나입니다.
completed또는failed.expired: 대기가 먼저 끝나 실행을 취소했습니다. 최종 상태를 읽기 전까지 엔트리는pending입니다.uncertain: 모델 호출 결과나 실행 생성 여부를 알 수 없습니다.
단계 사이에 데이터 넘기기
참조를 받는 필드에는 값 대신 참조를 넣을 수 있습니다. 참조는 { "$ref": … } 형태로 run.input이나 steps.STEP.output을 가리키고, 뒤에 점으로 구분한 경로를 붙일 수 있습니다. 경로는 최대 8개 구간이고, 각 구간은 영문자, 숫자, 하이픈, 밑줄로 된 1~64자입니다. 숫자 구간은 배열의 위치를 가리킵니다. 한 단계에는 참조를 최대 16개까지 넣을 수 있습니다.
# 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 }- 참조하는 단계는 반드시 먼저 끝나야 합니다. 그 단계를
after에 직접 넣거나,after에 넣은 단계가 그 단계를 기다리게 하세요.onOutcome으로 여러 단계에서 넘어오는 단계는 그중 한 단계만 넘어와도 시작하므로, 넘어오는 모든 경로에서 먼저 끝나는 단계만 참조할 수 있습니다. - 형식이 잘못된 참조, 없는 단계, 자기 자신, 먼저 끝난다고 보장되지 않는 단계, 출력이 없는
wait.timer단계를 참조하면, 워크플로를 만들거나 고칠 때400 workflow_invalid를 돌려줍니다.error.field에는 요청 본문에서 그 참조가 있는 위치가 JSON Pointer로 들어 있습니다. - 참조는 단계를 결정할 때 한 번만 값으로 바꾸고, 바꾼 입력을 기록합니다. 그래서 장애 뒤에 다시 보내도 같은 요청이 나갑니다.
- 값이 없으면 단계는
outcome.codereference_unresolved로, 필드가 받을 수 없는 값이면reference_invalid로 실패합니다. 두 경우 모두outcome.field로 위치를 알려 주며, 하위 호출은 하지 않습니다. - 끝난 엔트리는 정규 JSON 기준 최대 16 KiB의
output을 보관합니다. 더 큰 출력은 보관하지 않습니다. 이때 엔트리에는outputLimited: true가 붙고, 그 출력을 가리키는 참조는 값을 찾지 못합니다.
| 단계 종류 | 참조를 받는 필드 | 끝난 엔트리의 출력 |
|---|---|---|
communication.send | recipientActorId, message.text | messageId |
communication.request | responderActorId, request.text | requestId, state |
agents.execute | input.text | executionId, text(최종 출력), outputFormat이 json이고 텍스트가 JSON으로 파싱되면 json |
actions.invoke | input 안의 모든 값 | intentId, state, approvalId, reference |
wait.approval | intentId | intentId, state, approvalId, approvalState, reference |
wait.signal | 없음 | payload(시그널의 페이로드) |
wait.timer | 없음 | 없음. 그래서 이 단계는 참조할 수 없습니다 |
# 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", … } }입력 스키마
리비전에 inputSchema가 있으면 모든 런 입력을 그 스키마로 검사합니다. 직접 시작한 런의 입력이 통과하지 못하면 error.field가 있는 400 invalid_request를 받고 런은 만들어지지 않습니다. 입력이 통과하지 못한 fire는 invalid_request와 함께 refused로 기록됩니다. 스키마는 Agents 구조화 출력과 같은 JSON Schema 부분 집합(type, enum, const, required, properties, items, additionalProperties: false, 길이, 항목 수, 숫자 범위, const 판별자가 있는 oneOf)을 쓰며 최대 16 KiB입니다. 이 밖의 키워드는 400 unsupported_capability입니다.
Actions 단계와 승인
| 종류 | 입력 | 끝나는 방식 |
|---|---|---|
actions.invoke | invokerId, bindingId, actionType, input(안의 값은 무엇이든 참조 가능), 선택 사항 settleOn, intentWaitMs. | settleOn이 기본값 terminal이면 인텐트가 끝날 때까지 기다립니다. 인텐트가 정상으로 끝나면 completed, 승인이 거절되면 declined, 만료되면 expired, 효과가 unknown이나 unresolved이면 uncertain, 그 밖에는 failed입니다. admission이면 인텐트가 접수되는 즉시 completed로 끝납니다. |
wait.approval | intentId(보통 admission으로 요청한 단계의 intentId 출력을 참조), approvalWaitMs. | 승인이 approved나 consumed이면 completed, denied이면 declined, 승인이나 대기가 만료되면 expired, withdrawn이나 revoked이면 failed입니다. |
actions.invoke는 공개 Actions 요청 작업으로 지정한 인보커의 인텐트를 만듭니다. 인텐트의 멱등 키는 엔트리에서 정해지고, Actions 정책이 승인을 요구하면 승인을 요청합니다. 응답을 받지 못하면 Actions 인텐트 목록에서 읽어 오며, 새 키로 다시 보내지 않습니다.intentWaitMs가 먼저 지나면, 아직 전송 시점에 이르지 않은 인텐트는 취소되고 단계는expired로 끝납니다. 전송 시점을 지난 인텐트는 끝날 때까지 계속 읽습니다. 요청할 때 Actions가action_not_permitted나binding_not_active같은 코드로 거절하면 단계는 그 코드로 실패합니다.- 런은 나중에 승인되면 전송될 수 있는 인텐트를 남기지 않습니다.
wait.approval단계가 만료되면 같은 런이 만든 인텐트를 취소합니다. 런이 취소되거나 만료되거나 실패하면, 그 런이 만든 인텐트 중 아직 전송 시점에 이르지 않은 것을 모두 취소합니다. 런이 성공하면wait.approval단계가 아직 기다리던 인텐트만 취소합니다. 런이 만들지 않은 인텐트는 취소하지 않습니다. - 두 단계 모두
actions범위가 필요합니다. Automation은 전송 시점을 지난 효과를 재전송하거나, 증명하거나, 취소하지 않습니다.
승인을 결정하는 사람
Automation과 키는 승인을 결정하지 않습니다. 프로젝트 구성원이 콘솔에서 결정하거나, 백엔드가 POST /v1/actions/approvals/ID/approver-tokens로 그 승인 하나에만 쓰는 승인자 토큰을 발급해 결정할 사람(예: 자체 앱의 최종 사용자)에게 넘깁니다(승인자 토큰). 이때 쓸 approvalId는 actions.invoke 출력에 있습니다. Actions는 자기 승인을 거절합니다. 요청자는 트리거의 키이므로, 토큰은 다른 프로젝트 키나 구성원 세션으로 발급해야 하며 트리거가 쓰는 키 체인으로는 발급할 수 없습니다.
# 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" }트리거
| 트리거 | 동작 |
|---|---|
| 수동 | fire를 기록하지 않고 keyId도 없으며 nextFireAt은 null입니다. 런은 POST /workflows/ID/runs로 시작합니다. |
| 간격 | 기준 시각에 schedule.intervalMs의 k배를 더한 시각마다 동작합니다. |
| 캘린더 | schedule.calendar에 minutes, hours와 선택 사항 daysOfMonth, months(1~12), daysOfWeek(0은 일요일)를 적고, IANA schedule.timezone(기본값 UTC) 기준으로 계산합니다. 두 날짜 필드를 모두 쓰면 둘 다 맞아야 합니다. |
| 이벤트 | 열려 있는 Communication 업무 요청 가운데 유형이 requestTypes에 있고 받는 액터가 recipientActorIds에 있는 요청마다 런을 하나 시작합니다. |
# 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" } }스케줄 규칙
- 어떤 날짜와도 맞지 않는 캘린더는
invalid_request입니다. 366일 안에 슬롯이 없으면 진단 값calendar_sparse가 붙습니다. - 서머타임 전환으로 건너뛴 시각에는 그다음 유효한 시각에 동작합니다. 두 번 나타나는 시각에는 처음 나타날 때 한 번만 동작합니다.
- 서비스가 멈췄다가 돌아오면 놓친 슬롯 중 가장 최근 슬롯 하나만 동작하고, 나머지는
skippedSlots로 셉니다. - 건너뛰거나 거절한 슬롯까지 모든 슬롯에
slotIndex,slotTime이 담긴 fire를 하나씩 기록합니다. - fire는 런 입력
schedule로 런을 시작합니다. 여기에는slotTime, 트리거 시간대 기준의date(YYYY-MM-DD)와time(HH:MM),timezone(간격 스케줄은 UTC)이 들어 있습니다.
# 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 }이벤트 트리거 규칙
- 유형은 와일드카드 없이 정확히 일치해야 하며, 메시지 내용은 읽지 않습니다. 일반 메시지, 답장, 워크플로 자신의 액터가 보낸 요청으로는 런이 시작되지 않습니다.
- 요청 하나로 시작되는 런은 최대 하나이고, fire의
source가 그 요청을 가리킵니다. 그사이 닫힌 요청은not_admitted로,maxFiresPerDay를 넘은 요청은quota_exceeded와 함께refused로 기록합니다. 대기열에 넣은 요청도 넣는 시점에 이 횟수에 포함됩니다. - 런 입력에는 요청을 가리키는 값(
workspaceId,requestId,messageId,type,requesterActorId,recipientActorId)만 들어가고 내용은 들어가지 않습니다. 일시 정지된 트리거는 아무것도 읽지 않고, 재개(resume)한 뒤에는 그 뒤에 들어온 요청만 접수합니다. 피드 위치가 보존 기간을 지나면 진단 값feed_gap이 붙습니다.
겹치는 fire
트리거의 겹침 정책(overlap)은 같은 트리거의 앞선 런이 아직 진행 중일 때 새 fire를 어떻게 처리할지 정합니다.
- 스케줄 트리거의 기본값인
skip은 fire를skipped_overlap으로 기록합니다. - 이벤트 트리거의 기본값인
queue는 fire를 시작할 때 쓸 런 입력과 함께queued로 기록하며, 대기열에는 최대 32개까지 넣습니다. 진행 중인 런이 끝나면 가장 오래된 fire를 시작하므로, 런이 진행 중이었다는 이유로 업무 요청이 버려지지 않습니다. 대기열이 찬 뒤의 fire는skipped_overlap입니다. - 대기열의 이벤트 fire는 시작하기 전에 요청을 다시 읽고, 요청이 더 이상 조건에 맞지 않으면
not_admitted로 기록됩니다. 일시 정지해도 대기열은 남고, 폐기(retire)하면 취소됩니다. allow는 트리거의 진행 중인 런이maxActiveRuns(기본값 4, 최대 16)보다 적으면 fire를 바로 시작하고, 그렇지 않으면skipped_overlap으로 기록합니다.- 트리거 정보에는
overlap,allow일 때maxActiveRuns,queue일 때queuedFires가 나옵니다. 시작된 fire에는startedAt이 붙습니다.
트리거 키
스케줄 트리거와 이벤트 트리거는 호출하는 쪽이 없을 때도 동작하므로, 실행에 쓸 프로젝트 키를 keyId로 지정합니다. 수동 트리거는 스스로 동작하지 않으므로 keyId를 거절합니다. 트리거와 그 트리거가 시작한 모든 런은 이 키로 실행되며, 트리거 정보에도 이 키가 나옵니다.
- 트리거를 만들거나
keyId로 키를 바꿀 수 있는 것은 그 키의 교체 체인에 속한 키뿐입니다. 만들기 요청이나keyId를 넣은 재개 요청은 그 키나 같은 체인의 다른 키로 보내세요. 다른 키나 구성원이 보내면error.field가/keyId인403 forbidden을 받습니다. 그래서 구성원은 수동 트리거만 만들 수 있습니다. - 키는 같은 프로젝트와 환경에 있고, 프로젝트가 보유하며(
/v1/keys로 만들거나 교체한 키), 활성 상태여야 합니다. 알 수 없는 키, 만든 사람이 보유한 키, 비활성 키는error.field가/keyId인400 invalid_request입니다. - 키에는
automation범위와 함께, 고정된 리비전의 단계가 쓰는 모든 모듈의 범위가 있어야 합니다. 이벤트 트리거는 이 키로 워크스페이스 이벤트를 읽으므로communication범위도 필요합니다. 범위가 모자라면error.field가/keyId인403 forbidden입니다. - 트리거를 만든 키는 그 트리거의 런이 만드는 모든 Actions 인텐트의 요청자가 되므로, 그 인텐트를 승인할 수 없습니다.
- 키의 범위는 바뀌지 않고 교체할 때 그대로 복사되므로, 만들기, 시작, 재개 때 검사를 통과한 키는 그 일이 끝날 때까지 계속 통과합니다.
| 언제 | 일어나는 일 | 할 일 |
|---|---|---|
| 키를 교체함 | 트리거는 교체 체인의 가장 최근 키로 계속 동작합니다. 키를 다시 지정할 필요가 없습니다. | 없음. |
| 키, 또는 유예 기간이 지난 뒤 체인의 가장 최근 키가 철회되거나 만료됨 | 다음 fire는 authority_revoked와 함께 refused로 기록되고, 트리거는 grant_withdrawn으로 일시 정지되며, 진행 중인 런은 grant_withdrawn으로 보류됩니다. | 새 프로젝트 키로 POST /triggers/ID/resume을 보내고 그 키를 keyId에 넣어 트리거의 키를 바꿉니다. 이 키도 만들 때와 같은 검사를 거칩니다. 보류된 런은 POST /runs/ID/resume으로 하나씩 재개하며, 재개한 자격 증명이 런의 주체가 됩니다. |
keyId 없이 트리거를 재개함 | 트리거는 원래 키를 그대로 씁니다. | 그 키가 더 이상 유효하지 않으면 error.field가 /keyId인 400 invalid_request를 받습니다. 다른 키를 지정하세요. |
| 트리거 키가 생기기 전에 만든 트리거 | keyId가 없고, 만들 때 기록한 주체를 그대로 씁니다. | 재개하면 이전처럼 재개한 자격 증명이 주체가 됩니다. |
런
어느 프로세스든 런 ID로 다시 연결할 수 있습니다. 런은 서비스의 Automation 워커가 돌고 있을 때만 진행됩니다.
- 상태는
pending,running,waiting,held,suspended이고, 끝나면succeeded,failed,cancelled,expired중 하나가 되며completed같은terminalReason이 붙습니다. blockedReasons에 보류된 이유가 들어 있습니다. 예정된 일이 없으면nextWakeAt은 0이 아니라 null입니다.- 일시 정지(
suspend)하면 런에서 아직 보내지 않은 엔트리가 보류됩니다.
엔드포인트
경로는 /v1/automation 아래에 있습니다. 목록은 cursor와 limit을 받고 items와 next를 돌려줍니다. 쓰기 요청은 idempotencyKey를 받고, 기존 리소스를 바꿀 때는 읽어 둔 리비전을 expectedRevision으로 함께 보냅니다.
| 경로 | 입력 |
|---|---|
POST /workflows | displayName, revision(bindings, 입력에 참조를 넣을 수 있는 steps, 선택 사항 inputSchema, deadlineMs, maxStepsPerRun). |
GET /workflows, /workflows/ID | state. |
POST /workflows/ID/revisions, archive | revision. 보관하면 새 런과 fire가 멈춥니다. |
POST /workflows/ID/triggers | kind(manual, schedule, event), workflowRevision, 스케줄과 이벤트 트리거는 keyId, 선택 사항 overlap과 allow일 때 maxActiveRuns, 그리고 schedule 또는 event(domain communication, workspaceId, requestTypes, recipientActorIds, 선택 사항 maxFiresPerDay). |
GET /triggers, /triggers/ID, /triggers/ID/fires | workflowId, state. 트리거를 읽으면 keyId, overlap, queuedFires, nextFireAt, 진단 값이 함께 옵니다. |
POST /triggers/ID/pause, resume, retire | resume은 트리거의 키를 그대로 쓰거나, 선택 사항 keyId로 바꿉니다. 바꾸는 키는 만들 때와 같은 검사를 거칩니다. retire하면 대기열의 fire가 취소됩니다. |
POST /workflows/ID/runs | 선택 사항 workflowRevision, input(inputSchema로 검사). |
GET /runs, /runs/ID, /runs/ID/entries, /runs/ID/waits | workflowId, triggerId, state. 엔트리에는 output이 함께 옵니다. |
POST /runs/ID/suspend, resume, cancel | cancel에는 선택 사항 reason을 보낼 수 있습니다. |
POST /runs/ID/signals | signalName, signalKey, 선택 사항 payload. 201을 돌려주며, 같은 키와 페이로드로 다시 보내면 200입니다. |
GET /events | cursor, limit, waitMs, workflowId, runId. |
한도와 사용량
| 한도 | 값 |
|---|---|
| 단계 | 리비전당 32개. maxStepsPerRun은 기본 32, 최대 256. |
| 워크플로당 트리거 | 20개. |
| 런 마감 | 기본 7일, 최대 30일. |
| 대기 또는 지연 | 1초에서 7일까지. |
| 스케줄 간격 | 1분에서 365일까지. |
| 캘린더 | 다음 슬롯을 366일 앞까지 찾습니다. skippedSlots는 1,000까지 셉니다. |
| 이벤트 트리거 | 요청 유형 16개, 받는 액터 16개. maxFiresPerDay는 기본 100, UTC 기준 하루 최대 1,000. 피드는 약 15초마다 읽습니다. |
| 겹침 | queue 트리거당 대기열 32개. maxActiveRuns는 1~16, 기본 4. |
| 런 입력, 시그널 페이로드 | 64 KiB, 16 KiB. |
| 입력 스키마, 엔트리 출력 | 각각 16 KiB. |
| 참조 | 단계당 16개, 경로당 8구간. |
| 메시지와 Agents 입력 텍스트 | 4096자. |
페이지, waitMs | 64개, 30초. |
| 이벤트 보존 | 7일. |
단계에는 과금하지 않습니다. Communication, Agents, actions.invoke 엔트리가 처음 전송될 때 automation.step 측정값을 하나 기록합니다. 대기, wait.approval, 리플레이는 기록하지 않습니다. Agents 단계의 모델 사용량은 Agents가 한 번 계량하고, Actions는 자기 인텐트를 한 번 계량합니다.
로컬 미리보기의 임시 값이며 호스팅 제공 전에 바뀔 수 있습니다. 프로필 리비전은 capabilities 응답에서 확인하세요. 호스팅 서비스, 트리거 리비전, 내보내기, Automation 전용 토큰, 여러 값으로 텍스트를 만드는 템플릿은 포함하지 않습니다(참조는 값 하나를 통째로 넘깁니다). 콘솔 화면은 읽기 전용입니다.
오류
오류는 공통 오류 형식(error.code, category, message, retryable, nextAction)을 씁니다. 메시지가 아니라 코드로 처리하세요. 본문을 거절하면 문제가 된 값의 위치를 /revision/steps/1/input/input/text나 /keyId 같은 JSON Pointer로 error.field에 알려 줍니다.
| 코드 | HTTP | 대응 |
|---|---|---|
invalid_request, workflow_invalid | 400 | 입력을 고치세요. 어떤 날짜와도 맞지 않는 캘린더, 순환하는 단계 그래프, 값이 보장되지 않는 참조, inputSchema를 통과하지 못한 런 입력, 알 수 없거나 만든 사람이 보유했거나 비활성인 keyId가 여기에 해당합니다. |
contract_version_unsupported | 400 | 계약 1만 제공하며 계약 2는 폐지되었습니다. 그대로 다시 보내지 마세요. |
unsupported_capability | 400 | 지원하지 않는 요청입니다. 아직 제공하지 않는 종류, 지원 범위 밖의 inputSchema 키워드, 구성에 없는 모듈이 해당합니다. |
payload_limit | 413 | 입력, 페이로드, 스키마를 줄이세요. |
forbidden | 403 | automation과 모든 단계 모듈의 범위가 있는 프로젝트 자격 증명을 쓰세요. 트리거 키는 그 키의 교체 체인으로만 지정할 수 있습니다. |
not_found | 404 | 이 프로젝트와 환경에 없는 리소스입니다. |
wait_not_signalable | 409 | 맞는 열린 대기가 없거나 런이 끝났습니다. 런을 다시 읽으세요. |
signal_conflict, idempotency_conflict | 409 | 그 키에 이미 다른 입력이 있습니다. 원래 요청을 복구하세요. |
revision_conflict, invalid_transition | 409 | expectedRevision이 현재 값이 아니거나 지금 상태에서 할 수 없는 일입니다. 다시 읽으세요. |
workflow_archived | 409 | 보관된 워크플로는 런을 시작하거나 트리거를 만들 수 없습니다. |
cursor_expired | 410 | 목록을 읽은 뒤 새 커서로 시작하세요. |
참조 때문에 실패한 단계는 오류 응답이 아닙니다. 엔트리가 outcome.code(reference_unresolved 또는 reference_invalid)와 outcome.field를 담은 채 failed로 끝납니다.
복구
처음 보내기 전에 idempotencyKey를 입력과 함께 저장하거나, 인텐트 저장소를 주입해 roye.intents.resume()이 키로 복구하게 하세요.
| 상황 | 대응 |
|---|---|
| 응답 유실 | 읽기 전용 호출인 POST /v1/operations/recover에 module automation, kind(예: runs.start), 그 target(예: workflowId), 키를 담아 보내세요. |
| 같은 요청 재전송 | 같은 본문과 키로 보내면 저장된 원래 응답을 Roye-Replayed: true와 함께 다시 돌려줍니다. 효과는 반복되지 않습니다. |
| 취소 | POST /runs/ID/cancel은 런을 끝내고 대기를 바로 닫습니다. 워크플로를 보관해도 런은 취소되지 않습니다. |
# 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와 예제
roye.automation의 메서드는 계약 1 요청을 한 번 보내고 계약 스키마로 검증하며, 폴링하지 않습니다. triggers.create는 keyId, overlap, maxActiveRuns를 받고, triggers.resume은 expectedRevision과 선택 사항 keyId를 받습니다. events.page는 cursor_expired이면 ObservationGap을 던집니다. 회사의 운영 세션은 이 핸들에 없습니다. 실행할 수 있는 예제는 examples/README.md에 있습니다.
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();