Agent Steps
Give a model a bounded task with declared inputs and outputs, and let a Flow treat its answer like any other result.
Define an Agent
Use an Agent Step to give a model a task with declared inputs and outputs. The surrounding Flow decides when it runs, what it receives, and what happens with its answer.
This Step takes agent_name as an input and returns a greeting in agent_greeting:
{
"id": "hello-agent",
"name": "Hello Agent",
"type": "agent",
"attributes": {
"agent_name": {"role": "required"},
"agent_greeting": {"role": "output"}
},
"agent": {
"provider": "anthropic",
"model": "claude-sonnet-5-5",
"prologue": "Return a greeting of \"Hello, <agent_name>!\" using the provided agent_name.",
"max_turns": 4,
"max_tokens": 2048,
"timeout": 60000
}
}
Supply {"agent_name": "Tom"} when starting a Flow that uses this Step. The task asks the model to return {"agent_greeting": "Hello, Tom!"}.
| Field | Purpose |
|---|---|
provider | The model provider, which selects the worker that runs the Step |
model | The provider’s model name |
effort | Optional reasoning effort, such as xhigh (Extra High) |
prologue | Markdown instructions stating the Step’s intent |
mcp | MCP servers the model may use, each optionally limited to some of its tools |
max_turns | The most model turns one attempt may take |
max_tokens | The most tokens each turn may produce |
timeout | Milliseconds one attempt may run, defaulting to STEP_TIMEOUT |
The model receives the Step’s inputs under their invocation names and returns its outputs under theirs. Input mapping works as it does for Service Steps.
Write Task Instructions
Write the task instructions in prologue and use the Step’s name and description to explain its purpose. The model also receives the input values and definitions of the possible inputs and required outputs, so it can relate your instructions to the declared Attributes.
Use max_turns, max_tokens, and timeout to bound each attempt. A task can take several turns for tool replies or prodding before returning its final outputs.
Choose a Model and Effort
In the Step editor, choose a provider and model, then select the MCP servers and tools the task may use. Start the worker with the provider’s credentials so the editor can list its models. The workers omit retired models from the list.
Choose an effort from the options the selected model offers, or leave it unset to use the model’s default. The provider setup sections explain where these options come from, and model capabilities explains how to override them.
Discovery failures appear in the Step editor with their source, status, and error details. Available providers and models remain selectable when another worker, provider, or MCP server fails. Worker logs retain the underlying errors.
Give the Task Tools
Choose the MCP servers and tools the Step needs in the editor. Docker Compose includes the argyll MCP server for Argyll’s own tools.
To make another server available, add it to the worker. Select that server in the Step’s mcp configuration. Limit its tools when the task needs only part of the server’s interface:
{
"mcp": [
{"server": "tools", "tools": ["lookup_customer"]}
]
}
Handle Outcomes
Successful attempts publish the declared outputs to the Flow. Failed attempts follow the same retry rules as Service Steps. If the model reaches max_turns before returning the outputs, the attempt fails permanently.
Provider refusals, content filtering, and token or context limits end the attempt immediately with the reported reason. The worker preserves any usage returned with the failure rather than continuing to prod the model until max_turns.
Wait for a Healthy Worker
Pending work starts when the Step’s worker is healthy. Argyll checks worker availability regularly and resumes waiting work when service recovers.
Track Spend
Add this metric Attribute to the Agent Step to publish its known charges:
{
"spend": {
"role": "metric",
"metric": {
"selector": { "language": "argyll", "source": "work.usage?.cost ?? 0" }
}
}
}
To run a later Step only while known spend is below budget, declare spend as a required input and use spend.value < budget in its Predicate, with budget supplied as an input or const. To total spend across Flows, watch spend in a Feed.
work.usage sums usage reported by successful and failed attempts. For a nested operation, declare the metric on its Flow Step. Downstream Predicates read the spend recorded when that Step finishes. A Feed folds the metric after the Flow Step’s children deactivate, including usage they reported in the meantime.
Reuse Cached Instructions
Agent Steps reuse cached instructions, schemas, and tool definitions whenever possible to reduce token costs across attempts, even when the input values differ. Changes to the Step’s instructions, context, or tools refresh the affected content. Cache availability depends on the model provider.
Check Pricing Coverage
Use input_tokens and output_tokens to track model consumption. input_tokens includes tokens reused from cache (cache_input_tokens) and tokens written to cache (cache_output_tokens).
| Usage Field | Meaning |
|---|---|
cost | Total known charges |
cost_reported | Charges returned by the provider |
cost_calculated | Charges calculated from token counts and configured rates |
cost_unpriced_tokens | Tokens whose price is unknown |
Check cost_unpriced_tokens to see how much consumption still needs a rate.