본문으로 이동

AI 실행

Agents API

직접 만든 정의로 한도가 정해진 모델 작업을 실행합니다. 정의에 페르소나, 모델, 기본값을 담아 Roye 프로필에 고정합니다. 비공개 세션을 쓰면 이력이 다음 실행으로 이어집니다.

호스팅 미리보기

계약 1이 기본이고, 계약 2에서는 구조화된 출력을 쓸 수 있습니다. 두 계약 모두 고정할 수 있습니다. 호스팅 서비스는 운영자가 프로젝트마다 켜며, 이 가이드만으로는 내 프로젝트에서 켜져 있거나 모델이 검증되었다고 볼 수 없습니다.

빠른 시작

신뢰할 수 있는 백엔드만 프로젝트 키로 호출합니다. 호스팅 환경에서 쓰려면 운영자 활성화, 허용되고 요율이 정해진 모델, 잔액, 고객 자격 증명, 버전이 맞는 API·워커 배포도 필요합니다. 먼저 GET /v1/capabilities와 준비 상태를 확인하고, 꺼져 있거나 검증되지 않은 프로필은 쓰지 마세요.

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

// Trusted backend, server-side only: the backend key never reaches a browser.
const roye = new Roye({ baseURL, token: () => process.env.ROYE_PROJECT_KEY!, projectId, environment: 'development', intents });
const definition = await roye.agents.definitions.create({
  displayName: 'support-assistant',
  persona: { instructions: 'Answer billing questions in two sentences.' },
  profile: { id: 'text-standard', revision: '1' },
  model, // a public provider/model ID the profile lists
  defaults: { maxOutputTokens: 512, temperature: 0.3 },
  idempotencyKey: 'agd-1',
});
const readiness = await definition.revision(1).readiness();
if (!readiness.eligible) throw new Error('Not ready: ' + readiness.reasons.join(', '));

대기에는 시간 제한이 있고, 제한 시간이 지나도 실행을 취소하지 않습니다. 다음 실행은 확정된 이력에서 시작합니다.

session.ts
const session = await roye.agents.sessions.create({
  definition: { id: definition.id, revision: 1 },
  idempotencyKey: 'ags-1',
});
const first = await session.executions.create({ input: { text: 'Where do I find my invoice?' }, idempotencyKey: 'agx-1' });
// wait() returns the execution view as it stands: expiry never cancels. Wait again until it is terminal.
let done = await first.wait({ waitMs: 30000 });
while (['queued', 'running', 'cancelling'].includes(done.status)) done = await first.wait({ waitMs: 30000 });
// The create result carries no output; the waited view of a completed execution does.
const answer = done.status === 'completed' ? done.outputs[0]?.content : undefined;
// The next execution starts from the first one's settled history.
const second = await session.executions.create({ input: { text: 'And for last year?' }, idempotencyKey: 'agx-2' });

pnpm --filter @roye-ai/api-examples agents로 이 흐름을 실행해 볼 수 있습니다. 준비 사항은 examples/README.md에 있습니다.

핵심 개념

ID 형식으로 뜻을 짐작하지 마세요. 모든 리소스는 프로젝트 하나와 환경 하나에 속합니다. 세션과 실행은 고정한 리비전을 그대로 쓰며, 리비전은 바뀌지 않습니다.

리소스의미
프로필Roye가 설치한 읽기 전용 모델·한도·기본값 묶음입니다.
정의(agd_)페르소나, 프로필, 모델, 기본값을 리비전으로 관리합니다. 리비전마다 다이제스트가 있고, 정의는 보관할 수 있습니다.
세션(ags_)리비전 하나에 묶인 비공개 대화입니다. 끝나지 않은 실행은 한 번에 하나만 있을 수 있습니다.
체크포인트(agk_)완료된 실행이 남긴 확정 이력입니다. 체크포인트 경로는 메타데이터만 돌려줍니다.
실행(agx_)상태, 사용량, 출력이 있는 모델 호출 한 번입니다. 세션 없이 실행하면 이력이 남지 않습니다.

콘솔은 읽기만 하며 키, 체크포인트, 메시지, 이벤트는 볼 수 없습니다.

계약 1과 2 중 고르기

계약 2에서는 스키마로 검증한 JSON, 세션 메시지, 임명자 실행과 참조가 있는 실행을 쓸 수 있습니다. Roye-Contract-Version: 2 헤더나 roye.agents.v2로 고르며, 응답에는 처리한 버전이 돌아옵니다. 버전은 프로젝트·환경의 첫 요청에서 고정되며, 그 요청에 헤더가 없으면 1이 됩니다(SDK 버전).

  • 계약 2에서 완료된 실행에는 응답의 정규 다이제스트인 outputDigest가 붙고, 그 밖에는 null입니다.
  • 계약 2의 terminalReason은 열린 집합입니다. 모르는 값이 와도 종료 결과로 처리하세요.

첫 리비전에 outputSchema가 있거나 json-standard를 고정한 정의는 계약 2 전용이며, 스키마는 나중에 추가할 수 없습니다. 계약 1에서는 이런 정의와 액터 실행, 참조가 있는 실행이 목록에 나오지 않고, 이름으로 요청하면 contract_version_unsupported로 거부합니다.

계약 1에서는 목록을 페이지마다 거르므로 next가 있어도 페이지가 짧거나 비어 있을 수 있습니다. next가 null이 될 때까지 읽으세요.

프로필

잘린 응답은 maxOutputTokens에서 멈춘 응답입니다. capabilities 응답에서 JSON 프로필은 profileContractVersions에 나옵니다.

프로필계약출력, 잘린 응답
text-standard@11, 2텍스트. 사유 completed로 완료됩니다.
text-standard@21, 2텍스트. 사유 output_limit으로 완료됩니다.
structured@12JSON. 잘렸거나 8 KiB를 넘으면 검증 없이 output_truncated로 실패하고, invalidOutput과 outputDigest는 null입니다.
json-standard@12폐기 예정 JSON. 검증 없이 output_limit으로 완료됩니다.
tool-result@12폐기 예정 JSON. 잘렸거나 너무 크면 output_invalid로 실패합니다.

실행 수명 주기

상태는 앞으로만 바뀝니다. 대기를 쓰는 프로필이 없어서 waiting은 나오지 않습니다.

  • queued: 접수와 예약을 마쳤습니다. 기한이 지나면 공급자에 요청하지 않은 채 expired가 됩니다.
  • running: 워커가 맡았습니다. 취소하면 cancelling이 되고, 이미 보낸 호출은 원래 기록에서 마무리됩니다.
  • completed: 출력과 다음 체크포인트를 커밋했습니다.
  • failed, cancelled: 출력이 없고, 세션은 다음 실행을 받을 수 있습니다. 이유는 terminalReason을 보세요.

대기 중인 실행은 바로 취소되고 예약이 풀립니다. 이미 끝난 실행을 취소하면 그대로 돌아옵니다.

cancel.ts
// Cancel by ID from anywhere; a queued execution is cancelled at once, a running one moves to cancelling.
await roye.agents.executions.get(second.id).cancel({ idempotencyKey: 'agx-2-cancel' });

종료 사유

완료된 응답을 파싱하기 전에 상태뿐 아니라 사유도 확인하세요.

사유언제
completed, execution_timeout, caller_cancelled, session_deleted순서대로 출력 커밋, activeTimeoutMs 초과, 사용자 취소, 세션 삭제입니다.
execution_failed호출이 실패했거나, 호출 전에 기준 체크포인트를 읽지 못했습니다.
output_limitfailed면 출력이 8 KiB를 넘었고, completed면 잘린 응답입니다.
worker_lost호출을 보낸 뒤 워커를 잃었습니다. 사용량은 알 수 없는 상태로 보류됩니다.
deadline24시간 동안 워커가 가져가지 않았습니다.
authority_revoked커밋 시점에 권한을 잃어 요청 없이 취소되었거나, 임명자 호출 전에 권한을 잃었습니다.
principal_ended, company_archived, stale_work_claim호출 전에 임명이 끝났거나, 회사가 보관되었거나, Work 참조가 더는 유효하지 않습니다. 청구하지 않습니다.
output_invalid, output_truncatedJSON을 거부했습니다. 구조화된 출력을 보세요.

구조화된 출력

structured@1, 프로필 목록에 있는 model, outputSchema를 보내세요. 새로 만든 리비전에서 Roye는 openai/… 모델과 anthropic/claude-haiku-4.5에는 outputSchema로 네이티브 JSON을, 그 밖의 anthropic/… 모델에는 강제 함수 호출을 요청합니다. 방식을 고르는 필드는 없고, 다른 모델은 제공하지 않습니다. Roye가 강제 함수 호출을 쓰던 때 만든 anthropic/claude-haiku-4.5 리비전에서는 계속 강제 함수 호출을 씁니다. 네이티브 JSON으로 바꾸려면 정의 리비전을 새로 만들고, 새 세션과 세션 없는 실행을 그 리비전에서 시작하세요. 기존 세션은 만들 때의 리비전에 묶여 있으므로 방식도 바뀌지 않습니다.

structured.ts
// Contract 2: roye.agents.v2 sends Roye-Contract-Version: 2 on every request. Contract 1 stays the default on roye.agents.
const extractor = await roye.agents.v2.definitions.create({
  persona: { instructions: 'Extract the vendor, the total and the purchase-order number, if there is one.' },
  profile: { id: 'structured', revision: '1' },
  model, // an anthropic/ or openai/ model the profile lists; Roye picks how to ask it for JSON
  outputSchema: {
    type: 'object',
    required: ['vendor', 'total', 'purchaseOrder'],
    properties: {
      vendor: { type: 'string', maxLength: 200 },
      total: { type: 'number', minimum: 0 },
      purchaseOrder: { type: ['string', 'null'] }, // null when the invoice has none
    },
    additionalProperties: false,
  },
  idempotencyKey: 'agd-invoice-1',
});
const run = await roye.agents.v2.executions.create({
  definition: { id: extractor.id, revision: 1 },
  input: { text: invoiceText, outputFormat: 'json' },
  idempotencyKey: 'agx-invoice-1',
});
let view = await run.wait({ waitMs: 30000 });
while (['queued', 'running', 'cancelling'].includes(view.status)) view = await run.wait({ waitMs: 30000 });
if (view.terminalReason === 'completed') console.log(JSON.parse(view.outputs[0].content));
else if (view.terminalReason === 'output_invalid') console.warn(view.invalidOutput?.error); // the rejected text is in invalidOutput.text
else if (view.terminalReason === 'output_truncated') console.warn('The reply was cut or too long; nothing was committed.');

쓸 수 있는 키워드는 type(이름 하나나 여러 개, null 포함), enum, const, required, properties, items, additionalProperties: false, minLength/maxLength, minItems/maxItems, minimum/maximum, const 구분자가 있는 oneOf입니다. 최대 16 KiB이고, 있을 때만 다이제스트에 들어갑니다. 루트는 properties가 있는 객체이고 모든 노드에 type이 있어야 합니다. null이 될 수 있는 필드는 type: [T, "null"]로 쓰고, 그 enum에는 null과 다른 값을 함께 넣습니다. pattern(파싱한 뒤 직접 확인하세요), null이 될 수 있는 루트, 그 밖의 타입 배열, 규칙에 맞지 않는 nullable enum, 객체나 배열 enum 값, nullable이 아닌 enum의 null은 unsupported_capability입니다.

응답결과
유효함호출은 한 번이고 재시도는 없습니다. 출력과 체크포인트를 커밋합니다.
유효하지 않음output_invalid. invalidOutput에 거부된 텍스트와 처음 실패한 JSON 포인터·규칙이 담기며, 세션을 지우면 함께 지워집니다. 사용량은 남습니다.
잘렸거나 8 KiB 초과output_truncated. 이벤트는 execution.failed, execution.settled로 끝납니다. 네이티브 JSON의 execution.text에 임시 텍스트가 실릴 수 있지만 커밋되지 않습니다.

폐기 예정 프로필

json-standard@1과 tool-result@1은 폐기 예정(deprecated)이라 새 정의에는 권장하지 않습니다. structured@1을 쓰세요. 동결된 계약 2는 추가 변경만 받는데, 이 거부가 유일한 예외입니다.

  • 어느 환경에도 그 프로필의 리비전이 없는 프로젝트에서 정의를 만들거나 고치면 profile_not_ready로 거부하고, 메시지에 deprecated가 나옵니다.
  • 리비전이 하나라도 있는 프로젝트는 그 리비전이 개발 환경에만 있어도 모든 환경에서 리비전을 계속 만들 수 있습니다.
  • 기존 정의, 세션, 실행, 같은 키 재시도는 그대로 동작하고, capabilities에도 두 프로필이 계속 나옵니다.

tool-result 프로필

  • 상태와 사유가 모두 completed이고 JSON 객체가 하나일 때만 받아들이세요. outputDigest는 agentsOutputDigest(parsedObject)이고, 입력 다이제스트는 inputDigest({text, outputFormat: json})입니다.
  • 결과가 없거나, 여러 개거나, 이름이 틀리거나, 섞였거나, 형식이 깨졌거나, 너무 크거나, 잘리면 output_invalid입니다. invalidOutput.error는 공급자 응답 내용이 없는 설명 문장입니다. 분기는 terminalReason으로 하고, 이 값과 비공개 입력은 로그에 남기지 마세요.
tool-result.ts
// Deprecated for new definitions: this create succeeds only where the project already holds a tool-result revision in any environment.
// Persist this intent and key on your backend before the first request.
const definition = await roye.agents.v2.definitions.create({
  idempotencyKey: 'invoice-definition-original',
  persona: { instructions: 'Extract the invoice total and currency.' },
  profile: { id: 'tool-result', revision: '1' },
  model, // Must appear in this project's profile models and pass revision readiness.
  outputSchema: {
    type: 'object',
    properties: { total: { type: 'number', minimum: 0 }, currency: { type: 'string', enum: ['USD', 'EUR'] } },
    required: ['total', 'currency'], additionalProperties: false,
  },
  defaults: { maxOutputTokens: 1024, temperature: 0 },
});
const execution = await roye.agents.v2.executions.create({
  idempotencyKey: 'invoice-execution-original',
  definition: { id: definition.id, revision: 1 },
  input: { text: invoiceText, outputFormat: 'json' },
});
const view = await execution.wait({ waitMs: 30000 });
// A pending view stays on this same original. Wait again rather than creating another execution.
if (view.status === 'completed' && view.terminalReason === 'completed') {
  const result = JSON.parse(view.outputs[0].content);
  // agentsOutputDigest(result) must equal view.outputDigest.
}
// Billing uses its own contract 1 header; this SDK method selects it.
const bill = await roye.billing.usage.getAgentExecution(execution.id);
// Compare heldMicros/chargedMicros/releasedMicros with execution and metering settlement.

세션 메시지

계약 2에서 GET /v1/agents/sessions/SESSION_ID/messages를 호출하면 세션의 확정된 대화가 오래된 순으로 돌아옵니다. 완료된 실행마다 { role, content, createdAt } 형식의 user 메시지와 assistant 메시지가 하나씩 생기고, createdAt은 접수 시각입니다. 30일이 지난 메시지는 빠지며, 최대 256 KiB를 페이지 없이 한 번에 돌려줍니다.

checkpointId는 첫 완료 전과 삭제 뒤에 null이고, 세션을 삭제하는 중이거나 삭제했거나 내용을 지웠으면 contentErased가 true입니다. 멱등 키가 필요 없고 사용량도 기록하지 않습니다. 쿼리 매개변수를 보내면 invalid_request, 계약 1로 보내면 contract_version_unsupported, 회사의 운영 주체가 호출하면 403 forbidden입니다.

Session messages
GET /v1/agents/sessions/ags_…/messages
Authorization: Bearer <management key>
X-Roye-Project: <projectId>
X-Roye-Environment: development
Roye-Contract-Version: 2

# 200, Roye-Contract-Version: 2
# { "checkpointId": "agk_…", "contentErased": false,
#   "messages": [
#     { "role": "user", "content": "I cannot sign in since the update.", "createdAt": 1793000000000 },
#     { "role": "assistant", "content": "{\"category\":\"login\",\"escalationReason\":null}", "createdAt": 1793000000000 },
#     … ] }
# After the session is deleted: { "checkpointId": null, "contentErased": true, "messages": [] }

임명자 실행

Company 계약 2 임명자는 자기 액터로 턴을 실행합니다. 계약 2로 POST /v1/agents/executions를 보내고 principal에 { kind: actor, appointmentId }를 넣으세요. 실행은 세션 없이 임명의 정의 리비전으로 돌아갑니다. definition과 appointmentRevision은 생략할 수 있고, 보낸다면 현재 값이어야 합니다.

Appointee execution
POST /v1/agents/executions
Authorization: Bearer <management key>
X-Roye-Project: <projectId>
X-Roye-Environment: development
Roye-Contract-Version: 2
Content-Type: application/json

{
  "idempotencyKey": "agx-plan-1",
  "principal": { "kind": "actor", "appointmentId": "<appointmentId>" },
  "input": { "text": "Draft the launch plan." }
}

# 202, Roye-Contract-Version: 2
# { "id": "agx_…", "status": "queued",
#   "principal": { "kind": "actor", "actorId": "pac_…", "appointment": { "appointmentId": "apt_…", "revision": 1 } }, … }
# Poll GET /v1/agents/executions/{id}?waitMs=30000 with Roye-Contract-Version: 2 until it is terminal.
appointee.ts
// The SDK sends the same request and adds only local checks and intent bookkeeping.
const run = await roye.agents.v2.executions.create({
  principal: { kind: 'actor', appointmentId },
  input: { text: 'Draft the launch plan.' },
  idempotencyKey: 'agx-plan-1',
});
  • 접수할 때, 워커가 가져갈 때, 호출 직전에 임명자가 고용되어 준비되었는지와 회사가 열려 있는지 확인합니다. 아니면 호출 전에 실패하고 청구하지 않습니다.
  • 같은 키로 다시 보내면 임명자가 바뀐 뒤에도 원래 실행이 돌아오고, 새 키로 보내면 조건을 다시 확인합니다. 복구할 때는 kind executions.create, 빈 target, 원래 키를 보내세요.
  • 턴은 프로젝트 허용량을 쓰고, 회사에 예산이 있으면 그 예산에도 예약합니다. 알 수 없는 사용량은 보류되며 0으로 표시하지 않습니다(Company workspace).
  • 실행 응답에는 서비스가 만드는 references.company가 나오며, 요청에는 넣을 수 없습니다. companyWorkspaceId, origin(deliberate, 또는 sessionId와 admittedControlRevision이 붙는 controller), appointmentId, appointmentRevision입니다.
응답원인
409 appointment_not_ready임명자가 일시 정지되었거나, 끝났거나, 정의가 아직 없거나, 준비 상태가 막혀 있습니다.
409 company_not_active회사가 준비 중이거나, 보관되었거나, 삭제 중입니다.
409 stale_bindingdefinition이나 appointmentRevision이 현재 값이 아닙니다.
409 definition_archived임명의 정의가 보관되었습니다.
400 unsupported_capability고객이 직접 호스팅하는 임명자이거나, 세션 실행에 액터를 지정했습니다.
400 invalid_request형식이 틀린 principal이거나 계약 1로 보낸 principal입니다.

참조

계약 2의 references에는 실행이 어떤 Work, Automation, Communication 기록을 위해 도는지 적습니다. 참조는 바꿀 수 없고 다이제스트에 들어갑니다. 같은 키에 다른 참조를 보내면 idempotency_conflict이고, 같은 참조를 보내면 클레임이 끝난 뒤에도 원래 실행이 돌아옵니다. 참조가 없으면 실행 응답에 {}가 나옵니다.

  • work 클레임 { taskId, assignmentId, claimId, fence }: 활성 상태이고 리스(lease)가 남아 있으며 Work에서 접수할 수 있는 클레임이어야 합니다. 액터는 자기 회사 보드에서 자기가 보유한 클레임만 씁니다.
  • work 검토 { taskId, submissionId }: 그 작업에서 검토를 기다리는 제출물이어야 합니다. 운영 주체는 검토를 결정할 때 이 턴의 outputDigest를 인용합니다.
  • automation(세션, 사이클, ade_ 항목, 순번): 그 Automation 세션의 운영 주체만 보냅니다. 백엔드가 보내면 403 forbidden입니다.
  • communication { workspaceId, requestId }: 액터의 답변 턴에만 씁니다. 열려 있고 그 임명에게 온 Communication 요청이어야 하며, 아니면 403 forbidden입니다.

클레임이나 제출물이 현재 것이 아니거나 그 액터의 것이 아니면 409 stale_work_claim입니다. 워커는 가져갈 때와 호출 직전에 다시 확인하고, 그사이 클레임을 잃었으면 stale_work_claim으로 실패시키며 청구하지 않습니다.

Work claim reference
POST /v1/agents/executions
Authorization: Bearer <management key>
X-Roye-Project: <projectId>
X-Roye-Environment: development
Roye-Contract-Version: 2
Content-Type: application/json

{
  "idempotencyKey": "agx-outline-1",
  "definition": { "id": "<definitionId>", "revision": 1 },
  "references": { "work": { "taskId": "wts_…", "assignmentId": "was_…", "claimId": "wcl_…", "fence": 1 } },
  "input": { "text": "Draft the outline." }
}

# 202, Roye-Contract-Version: 2
# { "id": "agx_…", "status": "queued", "references": { "work": { "taskId": "wts_…", … } }, … }
# 409 stale_work_claim: the claim is no longer current; read it with GET /v1/work/claims/{claimId}.
Review turn
# A review turn names the submission it reviews instead of a claim (the reviewer appointee's actor).
POST /v1/agents/executions
Roye-Contract-Version: 2
Content-Type: application/json

{
  "idempotencyKey": "agx-review-1",
  "principal": { "kind": "actor", "appointmentId": "<reviewer appointmentId>" },
  "references": { "work": { "taskId": "wts_…", "submissionId": "wsb_…" } },
  "input": { "text": "Review the draft against the criteria." }
}

# Once completed: { "id": "agx_…", "status": "completed", "outputDigest": "<64 hex characters>", … }
# 409 stale_work_claim: the submission is not pending review on that task.
references.ts
// The SDK sends the same request.
const run = await roye.agents.v2.executions.create({
  definition: { id: definitionId, revision: 1 },
  references: { work: { taskId, assignmentId, claimId, fence } },
  input: { text: 'Draft the outline.' },
  idempotencyKey: 'agx-outline-1',
});
  • 400 unsupported_capability: 이 구성에 Work·Communication 읽기가 없거나, Automation 워크플로 실행을 지정했습니다.
  • 400 invalid_request: 계약 1로 보냈거나, 형식이 틀렸거나, entryId가 ade_가 아니거나, 액터가 아닌 실행에 Communication을 지정했거나, 요청이 닫혔습니다.

엔드포인트

경로는 /v1/agents 아래에 있습니다. 변경 요청에는 idempotencyKey를 넣고, revise, archive, unarchive, close, delete에는 expectedRevision도 넣으세요. 목록은 한 페이지와 커서를 돌려줍니다.

리소스경로
프로필GET /profiles, GET /profiles/{profile}/revisions/{revision}
정의POST /definitions, GET /definitions[/{definition}], POST …/archive, …/unarchive
리비전POST /definitions/{definition}/revisions, GET …/revisions[/{revision}], GET …/{revision}/readiness
세션POST /sessions, GET /sessions[/{session}], …/checkpoints, …/messages(계약 2), POST …/close, …/delete
실행POST /sessions/{session}/executions 또는 POST /executions, GET /executions[/{execution}][?waitMs=], …/events, POST …/cancel

세션을 삭제하면 내보내기를 포함해 대화 내용이 바로 가려집니다. 정리는 계속 진행되고, 사용량과 회계 기록은 남습니다.

한도

실제 비용을 측정하기 전까지 쓰는 미리보기 값입니다. 프로젝트 정책이 더 엄격할 수 있습니다.

한도값
페이로드페르소나 32 KiB, 입력 64 KiB, 출력 8 KiB, 스키마 16 KiB.
모델 설정출력 토큰 최대 2,048(기본 1,024), temperature 0~1(기본 0.7), 제한 시간 1~120초(기본 60초).
세션 이력이력에 새 입력과 출력 여유분 8 KiB를 더해 256 KiB까지. 넘으면 잘라 내지 않고 payload_limit으로 거부합니다.
정의프로젝트·환경당 1,000개, 정의당 리비전 100개(quota_exceeded). 이름 120자, 레이블 16개.
시간, 페이지대기열 기한 24시간, waitMs 최대 30초, 페이지당 최대 64개(기본 25개), 리플레이 7일.

고객이 호출하는 도구, 대기, 컨텍스트 참조, 임의 코드, 자동 보정 호출, 함수 인자 스트리밍은 제공하지 않습니다.

오류

오류는 공통 오류 형식을 씁니다. 종료 사유는 실행 결과이지 오류가 아닙니다.

코드HTTP대응
invalid_request, payload_limit, unsupported_capability, contract_version_unsupported400, 413입력을 고치거나, 지원 목록에 있는 프로필, 모델, 키워드, 버전을 쓰세요.
unauthorized, forbidden, not_found401, 403, 404권한이 없거나, 이 프로젝트·환경에 없는 리소스입니다.
profile_not_ready, definition_archived, budget_exhausted, concurrency_exhausted, quota_exceeded409, 429기록은 남지 않았습니다. 준비 상태를 맞추거나 보관을 풀거나, 나중에 같은 키로 다시 보내세요. 할당량은 늘려야 합니다.
session_busy, revision_conflict, idempotency_conflict409현재 실행을 기다리거나 취소하세요. 닫을 때도 같습니다. 리비전 충돌은 새 키로 다시 보내고, 멱등 충돌은 원래 호출을 복구하세요.
stale_binding, stale_work_claim, appointment_not_ready, company_not_active, unavailable409, 503임명, 클레임, 회사를 다시 읽으세요. unavailable은 같은 키와 입력으로 다시 보내세요.

복구

보내기 전에 idempotencyKey를 입력과 함께 저장하세요. 응답을 받지 못했다면 같은 키로 다시 보내거나 POST /v1/operations/recover에 module agents, kind, 키를 보내세요. 새 키를 쓰면 두 번째 실행이 접수되고 청구됩니다.

상황대응
생성·취소 응답을 받지 못함같은 키로 다시 보내세요. 결과에는 출력이 없으니 실행을 읽으세요.
worker_lost호출을 반복하지 않습니다. 새 키로 만든 실행은 재시도가 아니라 새 작업입니다.

Roye는 클라이언트가 없어도 체크포인트 확정, 기한이 지난 대기 작업, 중단된 삭제를 끝까지 처리합니다. 다시 연결해도 진행 상황을 조회할 뿐 대신할 실행을 만들지 않고, 조회가 끊겨도 아무것도 취소되지 않습니다.

사용량

접수할 때 기록을 만들기 전에 선언한 한도 전체와 동시 실행 슬롯 하나를 예약합니다. 조회, 대기, 이벤트, 리플레이에는 요금이 생기지 않습니다.

  • executionSettled, meteringSettled, accounting은 따로 읽으세요. 원래 호출마다 모델, 토큰 수 근거, costStatus가 기록되며, unknown은 0이 아닙니다.
  • 잔액을 쓰는 호스팅 실행이라면 청구 계약 1로 GET /v1/billing/usage/agents/EXECUTION_ID를 호출해 state, maximumMicros, heldMicros, chargedMicros, releasedMicros, 고정된 요율을 볼 수 있습니다. SDK에서는 billing.usage.getAgentExecution(id)입니다.
  • 결과가 유효하지 않아도 요금이 생길 수 있습니다. 취소해도 이미 보낸 호출의 사용량은 남고, 취소했다고 환불되거나 호출이 실제로 멈췄다는 증거가 되지는 않습니다. 고객 요금 면제는 공급자 비용을 정산하지 않으며, 공급자 호출이 끝났다는 증거도 아닙니다.