Overview
The@agent decorator creates a span representing an autonomous agent. Agent spans set the workflow name context, so all nested tasks and tools appear grouped under this agent in the trace tree.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
name | str | None | Function name | Display name for the agent span. |
version | int | None | None | Version number for the agent. |
method_name | str | None | None | Required when decorating a class. Specifies which method to use as the entry point. |
processors | str | List[str] | None | None | Route this span to specific named processors. See add_processor. |
Function usage
Class usage
Notes
- Agent spans set the workflow name context — nested spans inherit the agent name for grouping
- Use
@agentfor top-level autonomous entities and@taskfor individual operations within them