Skip to main content
Use the @tool decorator to convert any Python function into an agent-callable tool.
Definable automatically:
  1. Uses the function name as the tool name.
  2. Parses the docstring as the tool description.
  3. Generates a JSON Schema from type hints.
  4. Makes the tool available to any agent.

Decorator Options

Learn More

Parameters

Type hints, descriptions, and JSON Schema.

Hooks

Run logic before and after execution.

Caching

Cache results for identical arguments.

Async Tools

Non-blocking I/O operations.

Dependencies

Inject services and state into tools.