Skip to main content
An agent is one durable object per tenant. You create it once with a pinned model and a hard spend cap. It sleeps until something wakes it — an API call, a cron entry, an inbound webhook — works in bounded slices, appends every token, tool call and budget check to one event log, and ends a task with a deliverable. Idle, it costs storage and nothing else.
agent.ts
The same thing from a terminal:

What it costs

Agents bill from the same credit balance as every other primitive. 1 credit = $0.05. No subscription, no per-agent fee. naive agents spend <agent-id> prints six components — inference, sandbox, web_search, browser, storage, wakesincluding the zeros, because a paid tool missing from that view is how a bill goes unnoticed. wakes is not metered today and prints rate not configured rather than being omitted.

The limits, plainly

The completion window is served on GLM-5.2 only

completion_window decides how a turn is scheduled — tool fan-out, sub-agent allowance, how hard the model is asked to batch. It never changes your model.
  • asap is the default and is admitted on every model.
  • standard and flex are served only on zai-org/GLM-5.2-FP8. That is the entire supported set.
Asking for standard or flex on any other model is meant to fail with window_unavailable (400) and never be quietly downgraded — a window served as asap under another name reports a discount nobody bought.
The refusal lands at the first model call, not at create. The API accepts and stores completion_window: "flex" on anthropic/claude-sonnet-4-5; the gate lives in the inference binding, so the task fails when it tries to run. If you are not on zai-org/GLM-5.2-FP8, leave the window alone.
🔴 On our deployed staging host the refusal never fired, and the downgrade did. An agent on anthropic/claude-sonnet-5 with completion_window: "flex" ran a task to done, was billed 8,054 micro-USD, and the task row recorded window: "asap". Separately, a per-task window: "standard" was replaced by the agent’s own window rather than honoured (asap and flex stored as requested). The API edge validates correctly — window=bogus is a typed 400 invalid_input listing the three allowed values — so both defects are downstream of the edge, and the second is a stale deployed edge worker rather than a source defect.Treat the refusal as the shipped intent and verify it on your own deployment. Read the window back off the task row rather than trusting the request.
What it buys, and the measurement behind it — including a five-harness comparison whose raw ranking inverts once you condition on the wall-clock cap — is on Pricing.

Three fields that are not live yet

status, wakes and next_wake_at come back on every agent and are written by nothing — exactly two writers touch the row and neither sets them. So status reads "idle", wakes reads 0, and next_wake_at reads null whether or not an alarm is armed. Do not build on them. harness_sha256 is stamped by the runtime and is real.

Is an agent the right primitive?

Tenancy

agents.create refuses without a child project. The child project owns the vault entries, the connections and the Account Kit that decide what the agent may touch, so an agent with no owner has no credentials and no cap.
Over raw HTTP the company mount is reachable and answers:
The child project is the boundary, not the agent. One child project owns many agents, and a key scoped to it can read both their transcripts and delete either one. If two agents must not see each other’s work, give them separate child projects. Reading another company’s agent returns 404, never 403, so an id is never confirmed to someone who should not have it.

Next

Quickstart

API key to a running agent — SDK, CLI or cURL.

Concepts

Agent, task, completion window, sandbox, budget, schedule, event log, deliverable.

Pricing

The six components, and what the window is measured to do.

SDK

All 22 methods.

CLI

All 18 verbs.

API

All 20 routes.