Skip to content
Docs menu

plans

The planner: a frontier model orchestrates the three layers for one task on one device. It works through a closed step vocabulary. It can only request approvals, and a human signs them. It never opens a session and never names a joint. Each plan is recorded as an orchestration run.

5 operations · 9 schemas

GET /v1/plans

List plans

listPlans · scope key:read

Plans visible to the caller (owner, creator, or org member), newest first. No plan is public.

Parameters

listPlans parameters
NameInTypeDescription
statusqueryPlanStatus
device_idqueryId
run_idqueryId

The plan recorded as this orchestration run (at most one).

limitqueryinteger

default 20 · ≥ 1 · ≤ 100

Page size.

cursorquerystring

length ≤ 512

Opaque cursor from the previous page's next_cursor.

Responses

listPlans responses
StatusDescriptionBody
200

Page of plans.

PlanPage
401

Missing or invalid credentials.

Problemapplication/problem+json
422

Request failed validation.

Problemapplication/problem+json

POST /v1/plans

Plan a task for a robot (the planner makes its first decision)

createPlan · scope key:train

{task, device, budget_usd, max_minutes} → a plan. The hub records an orchestration run (with parent_run_id lineage when given). It asks the planner model for its first decision synchronously and executes what it can. A request_approval step files an approval request on the device at once. The hub returns the plan with its steps and timeline.

The planner's vocabulary is closed: request_approval, await_started, open_session, wait, evaluate, hand_back. Six guarantees are enforced in code on every decision:

  • only those kinds
  • no step text names a joint, a torque, a velocity, a gain or a raw action
  • a request_approval may only name an endpoint or model the device's registered contracts allow (checked before any request is filed)
  • nothing runs on the device's behalf before the device's own signed started
  • every step expires inside the plan's window
  • every step's cumulative cost cap lies within the budget

A violating decision is retried once with the errors quoted back. If the retry also violates a guarantee, the plan is failed and the response is 502 carrying the errors.

The plan cannot approve anything, because createApproval is session-only. It does not open a session. The device opens it. It only reads endpoints. It acts as the credential that created it, narrowed to write, for the one write it makes: filing requests. Spends model dollars: key:train. Every decision is billed to the Anthropic key of the workspace that owns the device. A workspace with no key answers 402 and no plan is recorded. When the hub's own key pays, every decision counts against the coach's daily quota, this one and each later one. This call answers 429 with X-Coach-Quota-* headers when the first decision cannot be made.

Request body

application/json · required · PlanCreate

createPlan request body
FieldTypeDescription
taskrequiredstring

length 1–4000

What the robot should do, in plain words.

devicerequiredstring

length 1–160

A device id (dev_...), a device name, or owner/name among the devices the caller can see.

budget_usdnumber

default 1 · > 0 · ≤ 100

Cap on the plan's model spend in USD; the plan ends budget_exhausted at it.

max_minutesinteger

default 5 · ≥ 1 · ≤ 1440

The plan's window; it hands back when it passes. Every step and every approval fits inside it.

parent_run_idstring | null

Lineage: the run (a training run or another plan's run) this plan follows from. An unreadable one is 422.

Responses

createPlan responses
StatusDescriptionBody
201

Plan created; its first decision was made and executed as far as it could go.

Plan
401

Missing or invalid credentials.

Problemapplication/problem+json
402

This workspace has no key the hub may use for the model's vendor, or a limit is reached: its own key's monthly cap, or the workspace's limit. type and errors[].type say which: model_key_required, model_cap_reached or billing.cap_reached. settings_url is where a person adds a key, raises the cap or opens Billing. Nothing was spent.

Problemapplication/problem+json
403

Authenticated but not allowed (visibility, membership or scope).

Problemapplication/problem+json
404

Resource not found (or hidden from the caller).

Problemapplication/problem+json
422

Request failed validation.

Problemapplication/problem+json
502

The planner's first decision failed validation twice. The plan exists, is failed, and its timeline carries the errors; errors[] here carries them too.

Problemapplication/problem+json
503

A service this endpoint needs is not configured in this deployment. The API boots with zero secrets. An endpoint that needs one says so instead of returning a stack trace.

Problemapplication/problem+json

GET /v1/plans/{plan_id}

Get a plan (steps, timeline, what it is waiting on)

getPlan · scope key:read

Parameters

getPlan parameters
NameInTypeDescription
plan_idrequiredpathId

Plan id (plan_...).

Responses

getPlan responses
StatusDescriptionBody
200

The plan.

Plan
401

Missing or invalid credentials.

Problemapplication/problem+json
404

Resource not found (or hidden from the caller).

Problemapplication/problem+json

POST /v1/plans/{plan_id}/advance

Run one orchestrator tick on a plan (idempotent)

advancePlan · scope key:train

The orchestrator's beat, callable by hand. Re-reads the device's events, the endpoint session metering and the approval state. Expires a step whose window passed and executes the current step when it can. Asks the model for the next decision only when no step is pending or the last one failed or expired. Takes a compare-and-set lock on the plan, so two ticks at once cannot both decide. A tick with nothing due changes nothing. The same function runs on a schedule (the arq cron, or the API's in-process ticker when PLAN_TICK_INTERVAL_S is set). You never need to call this. A decision made here counts against the coach's daily quota when the hub's key pays. When the account's quota is exhausted, the plan hands back. This call does not answer 429 in that case. When the workspace has lost its key or reached its cap, the plan is failed with that reason and this call answers 402.

Parameters

advancePlan parameters
NameInTypeDescription
plan_idrequiredpathId

Plan id (plan_...).

Responses

advancePlan responses
StatusDescriptionBody
200

The plan after the tick (unchanged when nothing was due).

Plan
401

Missing or invalid credentials.

Problemapplication/problem+json
402

This workspace has no key the hub may use for the model's vendor, or a limit is reached: its own key's monthly cap, or the workspace's limit. type and errors[].type say which: model_key_required, model_cap_reached or billing.cap_reached. settings_url is where a person adds a key, raises the cap or opens Billing. Nothing was spent.

Problemapplication/problem+json
403

Authenticated but not allowed (visibility, membership or scope).

Problemapplication/problem+json
404

Resource not found (or hidden from the caller).

Problemapplication/problem+json
502

A decision made during this tick failed validation twice; the plan is failed.

Problemapplication/problem+json
503

A service this endpoint needs is not configured in this deployment. The API boots with zero secrets. An endpoint that needs one says so instead of returning a stack trace.

Problemapplication/problem+json

POST /v1/plans/{plan_id}/cancel

Cancel a plan

cancelPlan · scope key:train

Ends an active plan (canceled) and its run. A pending approval request the plan filed stays for a person to deny in the web app. An issued approval ends on its own window. The plan can request consent. It cannot revoke it, and its final event says so. 409 when the plan already ended.

Parameters

cancelPlan parameters
NameInTypeDescription
plan_idrequiredpathId

Plan id (plan_...).

Responses

cancelPlan responses
StatusDescriptionBody
200

The canceled plan.

Plan
401

Missing or invalid credentials.

Problemapplication/problem+json
403

Authenticated but not allowed (visibility, membership or scope).

Problemapplication/problem+json
404

Resource not found (or hidden from the caller).

Problemapplication/problem+json
409

State conflict (duplicate handle/slug, wrong repo kind, terminal job, ...).

Problemapplication/problem+json

Schemas (9)

The schemas these operations reach before any other tag’s do. A type that links elsewhere is rendered on that tag’s page.

PlanPage

object

PlanPage fields
FieldTypeDescription
itemsrequiredarray of Plan
next_cursorrequiredstring | null

PlanCreate

object

PlanCreate fields
FieldTypeDescription
taskrequiredstring

length 1–4000

What the robot should do, in plain words.

devicerequiredstring

length 1–160

A device id (dev_...), a device name, or owner/name among the devices the caller can see.

budget_usdnumber

default 1 · > 0 · ≤ 100

Cap on the plan's model spend in USD; the plan ends budget_exhausted at it.

max_minutesinteger

default 5 · ≥ 1 · ≤ 1440

The plan's window; it hands back when it passes. Every step and every approval fits inside it.

parent_run_idstring | null

Lineage: the run (a training run or another plan's run) this plan follows from. An unreadable one is 422.

Plan

object

One orchestration and its whole timeline. run_id is the kind: orchestration run it is recorded as. cost_usd is model spend, metered per decision (retries included). steps are in execution order. events are oldest first.

Plan fields
FieldTypeDescription
idrequiredId
run_idrequiredId
parent_run_idstring | null
statusrequiredPlanStatus
status_reasonstring | null
taskrequiredstring
devicerequiredPlanDevice
ownerrequiredRepoOwner
created_byUserPublic | null
budget_usdrequirednumber
cost_usdrequirednumber

Model spend so far, USD (6 decimal places).

billed_toModelBilledTo
pricedrequiredboolean

False when the model has no rate row; usage is still recorded.

max_minutesrequiredinteger
expires_atrequiredstring (date-time)
decisionsrequiredinteger
max_decisionsrequiredinteger

The hub's cap on decisions per plan (PLAN_MAX_DECISIONS).

attemptsrequiredinteger

Model calls including retries.

modelstring | null
backendstring | null

anthropic or recorded. A replayed plan must never read as a real one.

current_request_idstring | null
current_approval_idstring | null
waiting_onPlanWaiting | null
stepsrequiredarray of PlanStep
eventsrequiredarray of PlanEvent
next_tick_atstring (date-time) | null (date-time)
created_atrequiredstring (date-time)
updated_atrequiredstring (date-time)
finished_atstring (date-time) | null (date-time)

PlanDevice

object

PlanDevice fields
FieldTypeDescription
idstring | null

Null once the device row is gone; the name stays.

namerequiredstring

PlanWaiting

object

What the plan is blocked on right now. The plan page shows it as a card.

PlanWaiting fields
FieldTypeDescription
kindrequiredstring

one of approval · started · session · event · time · step

step_idrequiredId
messagerequiredstring
request_idstring | null
approval_idstring | null
untilstring (date-time) | null (date-time)

When the waiting step expires.

approve_inrequiredstring

Where a person approves: the web app's Devices page. No API key can approve.

PlanStep

object

PlanStep fields
FieldTypeDescription
idrequiredId
indexrequiredinteger

Position in the plan (0-based, execution order).

decisionrequiredinteger

Which decision (1-based) proposed the step.

kindrequiredPlanStepKind
paramsrequiredobject

The kind-specific fields the planner set: model_or_endpoint, minutes, approval_ref, endpoint_ref, seconds, until_event, condition, complete.

reasonrequiredstring

The planner's task-level reason. Never names a joint, a torque, a velocity or a raw action (enforced).

statusrequiredPlanStepStatus
expires_in_srequiredinteger

Seconds the step may stay active once it starts.

expires_atrequiredstring (date-time)

The plan's window until the step activates, then started_at + expires_in_s clamped to it. Never null.

cost_cap_usdrequirednumber

Cumulative model spend the plan may reach after this step; enforced before the step runs.

started_atstring (date-time) | null (date-time)
finished_atstring (date-time) | null (date-time)
resultobject | null

What happened: the request id filed, the approval seen, the session opened, the condition's observed value.

created_atrequiredstring (date-time)

PlanEvent

object

PlanEvent fields
FieldTypeDescription
idrequiredId
kindrequiredstring

length ≤ 32

The event kind: created, decision, flagged, rejected, step_started, waiting, step_done, step_failed, step_expired, steps_skipped or finished. A decision event carries the model's summary, observations, flags, usage, cost and latency in data.

step_idstring | null
messagerequiredstring
dataobject | null
cost_usdnumber | null

Model spend this event represents (decisions and rejections).

created_atrequiredstring (date-time)

PlanStepKind

string

one of request_approval · await_started · open_session · wait · evaluate · hand_back

The closed vocabulary. request_approval files an approval request, which a human approves. await_started waits for the approval and the device's signed started. open_session waits for the device to open its endpoint session. wait waits for seconds or an event. evaluate tests one telemetry metric. hand_back ends the plan.

PlanStepStatus

string

one of pending · active · done · failed · expired · skipped