Skip to content

AI agent steps

This page lists the fields of the agent step, its limits, how its tool calls are reviewed, and how it fails. An agent step lets a model work in turns: each turn, the model answers or calls the tools the step declares, and the platform runs those calls as durable work before the next turn.

The step needs the ai.agent language feature, which the platform advertises in its capabilities. Conversation memory also needs ai.memory; see Conversation memory.

Step fields

Field Required Meaning
id Yes The step's ID.
kind Yes agent.
uses Yes weave-agentic-turn@1.0.0, the platform's model turn. No other Action can run a turn.
profile Yes The name of an entry in the workflow's llmProfiles: provider, model, options and outputSchema.
connection Yes The AI connection the turns run on.
instructions Yes An expression for the model's instructions.
prompt Yes An expression for the request the model answers.
context No An expression for data the model reads as context.
tools No Up to 32 tools; see Tools.
review No The default reviewer for tools that change data; see Reviews.
memory No What the agent remembers; see Memory.
limits No Budgets and the deadline; see Limits.
onError, errorPath No What a failure of the agent does, as for any step that handles its errors.

A value marked secret (x-secret or writeOnly) can't reach the model: the compiler refuses an instructions, prompt, context or fixed tool value that reads one (WV-COMP-AI_SECRET_INPUT).

Tools

Each tool has a name, a description the model reads, and exactly one target:

Target Field Runs
Action action (with connection when the Action needs one) A published Action, as a task
Workflow workflow A callable workflow, as a child run the agent waits for
Person human (questionSchema, formSchema, assignment) A human task that asks a person

A tool can also set how its calls are reviewed:

Field Default Meaning
approval auto for a read-only Action and for a question to a person; required for every other tool required makes each call wait for a person's review. auto on a tool that changes data is refused (WV-COMP-AGENT_UNREVIEWED_EFFECT).
review The step's review Who reviews this tool's calls: assignment, expirySeconds and distinctReviewer, as in Reviews. A tool whose calls are reviewed needs a review on the tool or on the step (WV-COMP-AGENT_REVIEW).

fixed sets arguments the model can't change: they are merged last and always win. The model sees only the other arguments. A tool result is redacted by the tool's output schema and by the secret patterns before the model reads it.

Reviews

Every tool that changes data waits for a person's review before it runs: any Action that isn't read_only, and every workflow tool. Read-only Actions and questions to a person run directly. A tool that changes data can't skip its review (WV-COMP-AGENT_UNREVIEWED_EFFECT).

Field Default Meaning
assignment — Who reviews the call, from the activation's assignment bindings.
expirySeconds 86,400 (at most 604,800) When the review expires; it never outlives the agent's own deadline.
distinctReviewer false Excludes the person who started the run.

The reviewer sees the side effect first, then the tool, its description, the arguments classified by the target's input schema, which arguments the workflow fixed, and a mark that the model wrote them. They approve or reject, with an optional comment the model reads after a rejection. An approval runs exactly the input the review showed. An expired review tells the model {"status": "expired"}.

With distinctReviewer: true, the run's starter gets 403 WV-REVIEW-DISTINCT when they read, claim, complete or reassign the review, even when they manage human tasks, and the review doesn't appear in their task list. For a run started by an API key, a trigger or a schedule, distinctReviewer excludes that service principal, which can't complete tasks anyway, so any assigned person may review.

Memory

Field Default Meaning
scope step step (one activation), run (shared by activations with the same key) or conversation (kept across runs under an expression's value).
key — The run memory's name for run; an expression for conversation.
window 24 (2 to 200) How many messages are kept and loaded.
ttlSeconds 2,592,000 (3,600 to 31,536,000) For conversation only: how long a conversation is kept after its last exchange.
contextTokens 8,192 (512 to 262,144) The context the turns fit, capped by the AI policy.

Conversation memory

With scope: conversation, an agent remembers a conversation across runs. Each run evaluates key, for example {"ref": "/input/customerId"}, and loads what earlier runs with the same key remembered before its first turn. When the agent completes, its prompt and final answer are appended to the conversation. It needs the ai.memory language feature.

"memory": {"scope": "conversation", "key": {"ref": "/input/customerId"}, "window": 24, "ttlSeconds": 86400}
  • The key. It must evaluate to text of 1 to 256 characters (WV-COMP-AGENT_MEMORY when it can't, and WV-SCHEMA-INVALID_INSTANCE at run time like a bad prompt). It can't read a value marked secret (WV-COMP-AI_SECRET_INPUT). The platform never stores or sends the key: it keeps the SHA-256 of the workflow's name, a zero byte and the key's value. The hash is pseudonymous, not anonymous: anyone who can guess a key can compute its hash.
  • One conversation per workflow and key in an environment. Another workflow, or the same workflow renamed, starts its own conversation for the same key. Another environment never sees it.
  • What is kept. For each completed run: the prompt, after the secret patterns (bearer tokens, JWT-shaped strings, PEM blocks, sk-, AKIA and ghp_ keys, user information in URLs) are replaced with [redacted], and the final answer, redacted by the step's output schema (x-secret, writeOnly) and the same patterns. Nothing else is kept: not the instructions, the context, tool calls and results, reviews, or intermediate turns. Ordinary personal data in a prompt, such as a name, is kept as written.
  • Only completed agents remember. An agent that fails, times out, is cancelled, or whose answer its output schema refuses adds nothing.
  • What the model sees. The newest window messages, as whole exchanges, go first as one data message under the data notice, before the prompt. They are data, never instructions: they change no tools, budgets, reviews or fixed values, and a changing tool's calls still wait for a person. When a turn doesn't fit its context, remembered exchanges are dropped first, oldest first.
  • Waiting for the conversation. The platform loads the conversation within about a second (the next recovery scan), and the agent's timeoutSeconds already counts.
  • Lifetime. Each append keeps the conversation for ttlSeconds more. An expired conversation is never loaded, listed or read; it loads as empty, and the next append starts it over. See Retention.
  • Test runs (step tests, draft test activations and the workflows they call) neither load nor remember: their agents start with an empty conversation. To test with memory, use a seed in the saved turns; see Simulation.

Take the key from a verified identity

Anyone who can start a run with a given key reads that conversation through the agent's answers and adds to it. Take the key from something the trigger verified, such as a signed webhook's field or an authenticated principal's data, never from free text a caller controls.

People with run.read list and read conversations, and people with run.purge delete one or purge a workflow's; see the API reference, the SDK and weave agent-conversations.

Limits

Field Default Maximum
maxIterations 6 32
maxToolCalls 12 64
parallelToolCalls 4 8
maxTotalTokens 60,000 2,000,000
timeoutSeconds 900 604,800
onToolError return_to_model incident stops the agent at a tool failure

A run spends at most 2,000,000 tokens across all its agents.

Failures

Code Raised when
WV-AGENT-ITERATIONS The agent used its turns without a final answer.
WV-AGENT-BUDGET A turn crossed the step's or the run's token budget. Retry grants one forced final turn.
WV-AGENT-TIMEOUT The agent's deadline passed.
WV-AGENT-TOOL-FAILED A tool failed with onToolError: incident.
WV-TASK-AMBIGUOUS A call that changes data and is never retried may have applied.

onError takes the agent's failure, like any step's. A call that changes data and is never retried, still running when the agent fails, is different: it may have applied. It keeps its own key and task under WV-TASK-AMBIGUOUS, whatever onToolError and onError say. Once a person reconciles it in Operate, the agent's failure goes to onError. AI agent incidents lists the decisions for each code and key.

Activation

Activation checks an agent like an AI task: its connection must use the profile's provider (WV-ACTIVATION-AI-PROVIDER), and the AI policy must approve the model for the connection's endpoint (WV-ACTIVATION-AI-MODEL). Activation also refuses any step other than an agent that would run the model turn, an action step that runs a model task, an agent whose turn action isn't the platform's, an agent tool whose action runs a model task, and an undo action of a transaction step (confirm, cancel or compensate) that runs a model task (WV-ACTIVATION-AI-RESERVED). An action step has no AI profile, so the AI policy could never check its model, and an undo runs with none of an agent's guards, so the compiler refuses that action step and that undo action too (WV-COMP-AGENT_ACTION at its uses): an AI model runs in an AI step or an AI agent step. A workflow version that pins a document it doesn't carry is refused with the same code, as what that runs can't be checked.

Agent log

The agent log shows what an agent did, turn by turn: each turn's tokens and time, the tool calls the model asked for, how each call ended, and the final answer. Read it with run.read:

  • API: GET …/runs/{identifier}/agents/{key}/log; see the API reference.
  • SDK: await client.read_agent_log(run_id, "support").
  • CLI: weave runs agent-log <run-id> --key support.

key is the agent step's ID, which pages through its activations in iteration order (20 at most per page), or one activation's key, such as support[2] inside a loop.

Field Meaning
status running, waiting (a review or a person must act), succeeded, failed, cancelled or timed_out.
stop final or forced_final for an agent that answered; otherwise null.
error The code of a failed agent, such as WV-AGENT-BUDGET.
memory The memory scope and how many remembered messages the first turn loaded. With conversation memory, conversation has the key_hash, the version loaded, whether it had expired, and test for a test run.
turns Each turn: turn, forced (the forced final turn), input_tokens, output_tokens, started_at, ended_at, final (the answer of the turn that answered), calls, dropped_tool_calls and error: a turn the model couldn't run names the model's own code, such as LLM_NO_TOOL_SUPPORT.
totals turns, tool_calls, input_tokens, output_tokens and duration_ms (null while the agent runs).

Each call has its instance_key (support#1.2), the name the model wrote, its target, status, times, arguments, output, error, review and, for a workflow tool, the child_run_id. The target is the tool's kind (action, workflow or human) and the pinned action's or workflow's reference; it's null when the name matches none of the step's tools. Treat kind as text: a new kind of tool can appear, and you can show it by its reference.

Call status Meaning
queued Accepted; waits for room among the parallel calls.
review Waits for a person's review.
running Sent to its target.
succeeded, failed How the target answered, as the model read it; error.code names a failure. A call still running when the run timed out is failed with TIMEOUT.
refused The platform refused the call and nothing ran: UNKNOWN_TOOL, INVALID_ARGUMENTS, REPEATED_CALL or TOOL_BUDGET_EXHAUSTED.
rejected, expired The review said no, or nobody answered in time; review holds the decision and comment.
not_run The agent stopped before the call could run.
cancelled The call was sent, then closed when the agent ended or the run was cancelled.

Values follow the run views' rules. arguments are classified by the parameters the model saw, output by the tool's output schema and final by the step's result schema. A value that can't be shown is left out with its reason: an output with a field marked x-secret has available: false and the omission classified_secret, and a value that doesn't fit in the page's 8 MiB has the omission resource_limit. The name is the model's own text, so it's shown escaped: format characters are dropped, control characters and line separators are written as \uXXXX, and it's cut at 256 characters.

See also: history and replay, incident operations, simulating an agent, and the worker protocol.