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
| Parameter | Type | Default | Description |
|---|---|---|---|
name | str | None | Function name | Display name for the tool span. |
version | int | None | None | Version number for the tool. |
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
- 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