agent node starts one new agent session, gives it instructions and typed input, and waits for
one result that matches a schema. Use it for judgment on unstructured material, such as reading a
notice or a loss run. Use a task when a person must decide,
and a call when the rule must always give the same answer.
Syntax
agent id=research-claim
title, instructions, input,
result, agent.preset and output.
Fields
The fence takes no attributes after
id, and its body takes no other fields. There is no
assignee, session ID, timeout or idempotency key: Effective creates the session and derives the
step’s identity itself.
Agent settings
At least one of
preset and model is required. With model and no preset, the session uses
general-agent, and the model must be compatible with it.
Your organization decides which presets, models, tools, data sources and plugins agent steps can
use. Compiling checks the shape of these settings. Effective checks what your organization allows
when you publish and again when a run starts.
Instructions and input
title and instructions use the same {{ $name.path }} interpolation as other text fields. Each
interpolated value must be a required string, number or boolean. Interpolation doesn’t recurse,
and prose elsewhere in the document never becomes part of the instructions.
input.value uses the same data expressions as a value
node. $inputs and named values mean the same thing here as anywhere else. If the agent needs
derived data, compute it in an earlier step and pass the result.
The result envelope
The agent’s output is an envelope, not the bare result. Read the typed result through$output.value, for example $claim_research.value.summary.
The fence’s
attachments are inputs shown to the agent. The envelope’s attachments and
outputArtifactId are outputs that the agent attached when it submitted. The procedure can read
them but can’t set them. If later steps need a file the agent produced, have the agent put the
file’s ID in its typed result as well.
Example
An agent session checks a draft cancellation notice before it goes to the mail vendor. The policy number and file ID are illustrative.notice-review.procedure.md
policy_number: NW-100234, the run ends with the agent’s result, such as
{ "ready": false, "problems": ["The effective date is missing."] }. A later step could route on
$notice_review.value.ready with a choice.
On retry and resume
- Input is fixed once. Effective evaluates
input.valueandattachmentsonce, checks them, and stores them with the agent’s task. A resume doesn’t evaluate them again. - One session per step. The agent’s task and session are created once for the step. A
resumed run doesn’t start a second session. Inside a
repeatorfor-each, each round or item is its own step and starts its own session. - The first valid result wins. The first submitted result that matches
result.schemabecomes the step’s result. A duplicate or late submission can’t move the run forward twice. - The record doesn’t change. The task ID, submission ID, submitter and time in the envelope are recorded and never rewritten.
- The agent’s task can’t be reassigned. Effective assigns it to the session the step starts. A change to its assignees by hand is refused.
Common errors
See also
- task node: the same envelope, answered by a person
- choice node: route on the agent’s result
- wait node
- People and agents