@agent
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
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