Create an agent
id, current_version, created_at, updated_at, and archived_at. current_version starts at 1 and increments each time an update changes the agent.
Define an agent as a file
An agent is a declarative configuration, so the recommended way to manage it is a checked-in.agent.yaml file. The whole config — model, harness, prompt, tools, budget, policies — lives in one file you can review, diff, and version-control alongside your code. The CLI reads it on create, update, and apply.
refunder.agent.yaml
apply is the GitOps path. It upserts by name and omits version, so the checked-in file is the source of truth (last write wins) — exactly what a CI apply loop wants. For interactive edits where you don’t want to clobber a concurrent change, use update with --expected-version (a mismatch is a 409). See versioning below.Agent, session, run
An agent is a durable definition; work happens in sessions that reference it. One agent backs many sessions and cron deployments, each independently budgeted, streamed, and controlled.Versioning
Every change to an agent’s configuration produces a new immutable version. A version is a frozen snapshot of the whole config — model, system prompt, tools, skills, window, budget, and metadata — identified by an integer that increments from 1. Nothing about a past version ever mutates, which is what lets a long-running session or a scheduled deployment keep behaving exactly as it did the day it started.- Optimistic concurrency. Supply
expected_versionto apply the update only if nothing else changed it in the meantime; a mismatch returns409withcode: "version_conflict". Omit it to apply unconditionally (last write wins) — the path a declarativeapplyloop uses. - Omitted fields are preserved. Send only what you want to change.
- Array fields (
tools,skills,identity) are fully replaced by the new array. - No-op detection. If an update produces no change, no new version is created.
- Sessions and deployments pin a version. A running session keeps the config it started with; a deployment can pin a specific
agent_versionfor staged rollout. New versions apply only to new work.
Lifecycle
Configuration reference
string
required
A human-readable name for the agent.
string | object
required
The model that powers the agent. A model ID string, or an object such as
{ "id": "zai-org/GLM-5.2-FP8", "effort": "high" }. See Model router & inference.string
default:"pi"
The harness — the agent loop that drives each turn.
pi is the only value today and the default. The runtime beneath it (durability, tools, budget, policy) is the same whichever harness you pick.object
required
Spend limits, in integer micro-USD on the wire. An agent cannot be created without one. See Budgets.
string
A system prompt that defines the agent’s behavior and persona. Distinct from the user messages that describe the work.
string
default:"immediate"
Default completion window:
immediate, priority, or loose. Overridable per session.object
The tools available to the agent, as a single toolset object: a
default_config plus per-tool configs, each entry { enabled, permission } where permission is allow, ask, or deny. See Policies. Built-ins are enabled by capability; MCP and connection tools register under the same keys.object[]
MCP servers the agent can reach, referenced by
mcp_toolset.string[]
One or more identities the agent can act as.
object
Phase 3. A coordinator declaration listing the agents this agent can delegate to.
object
A default JSON Schema for a structured result. When set, a session goes idle carrying a typed
structured_output; a session can override it per run.string
A description of what the agent does.
object
Arbitrary key-value pairs for your own tracking.
Next: runtime & durability
How the harness drives each turn, and how the runtime makes it durable.