- Agent steps
- Agent steps
Agent steps
Agent steps
An agent step gives an agent one task, with typed inputs and typed outputs.
An agent step hands a task to an agent inside a workflow. You declare what goes in and what must come out. The agent does the work; Avalanche checks the output’s types and records what the agent did.
import avalanche as ava
class ExtractInvoice(ava.Signature):
"""Extract the invoice fields from the text. Convert the total to integer cents."""
text: str = ava.InputField()
invoice: Invoice = ava.OutputField()
@ava.agent_step(ExtractInvoice)
async def extract_invoice(text: str, *, agent: ava.Agent) -> Invoice:
result = await agent(text=text)
return result.outputs.invoice
Signature
The signature is the contract with the agent. The docstring is the instruction. Fields say what the agent receives and what it must return.
| Part | Written as |
|---|---|
| Instructions | The class docstring |
| Input | name: type = ava.InputField() |
| Output | name: type = ava.OutputField() |
Output types can be Pydantic models, lists, files. An output that does not match its type fails the step; values are never coerced.
A one-line form exists for small tasks:
Summarize = ava.Signature("document: str -> summary: str", "Summarize the document.")
The step function
@ava.agent_step(ExtractInvoice)
async def extract_invoice(text: str, *, agent: ava.Agent) -> Invoice:
result = await agent(text=text) # one call, inputs by name
return result.outputs.invoice # outputs by name
| Name | What it is |
|---|---|
agent | Supplied by Avalanche. Call it once per step. |
result.outputs | One attribute per output field, already validated. |
result.trace | What the agent did. See Traces and evals. |
The function is ordinary Python, so you can prepare inputs before the call and check the result after it.
Without a function
When there is nothing to prepare or check, declare the agent directly in the workflow:
@ava.workflow
def summarize_flow():
return load_document() >> ava.agent.step(Summarize)
Options
@ava.agent_step(
ExtractInvoice,
runtime=ava.runtimes.ClaudeAgent(model="claude-haiku-5-5"),
tools=[lookup_vendor],
skills=[house_style],
integrations=[crm],
evaluations=quality,
retries=2,
)
| Option | What it sets |
|---|---|
runtime | Which agent engine and model run the step. See Runtimes. |
tools | Your functions the agent may call. See Tools and skills. |
skills | Reusable instructions the agent can load. |
integrations | Outside services the agent can use. See Integrations. |
evaluations | Quality scores for the output. See Traces and evals. |
retries, on_uncertain | The same as on a Python step. |
In the UI

Before a run: the instructions, the fields and the model of an agent step.

After a run: what went in and what came out, under Run I/O.
