@tool
Overview
The @tool decorator creates a span for a tool operation — a discrete callable used by agents (search, calculator, API call, file read). Tool spans inherit the current entity path and appear nested under the nearest agent, workflow, or task.
Parameters
Function usage
Class usage
Notes
- Tool spans automatically capture function arguments as input and return values as output
- Exceptions inside tools are recorded on the span with error status
- Use
@toolfor operations that agents call, and@taskfor broader processing steps