Skip to main content
Turn Python functions into agent-callable tools with clear parameters and docstrings.
The user defines a tool, registers it on an agent, and verifies the model invokes it correctly.

How It Works


How to Create a Simple Tool Function

1

Define Tool Function

2

Use with Agent

How to Create Tools with Multiple Parameters

1

Define Multi-Parameter Tool

2

Use with Agent

How to Create Tools as Classes

1

Define Tool Class

2

Use Class Methods as Tools

How to Create Async Tools

1

Define Async Tool

2

Use with Async Agent

How to Use Optional, Literal, and Enum Parameters

1

Create Tool with Choice Parameters

See the Tool Parameter Types page for complete reference on using Optional, Union, Literal, Enum, List, and Dict types.

Tool Function Requirements

Best Practices

The Args section becomes the parameter schema the model reads. Spell out each argument so calls are accurate.
Typing a parameter as Literal["draft", "active"] or an Enum stops the model from passing invalid values.
Return str, dict, or list rather than custom objects so the result flows back through the model cleanly.
Async tools need await agent.astart(...). Keep sync and async tools separated by how the agent is run.

Different Ways to Create

Other ways to build tools

Debug Tools

Troubleshoot tool calls