The manual way
Under the hood, tool calling is a three-step process.- Describe the structure of the tool as a JSON schema and pass it to the model
- The model fills in the JSON schema and outputs it for the application to parse
- The application executes the tool call and send the results to the model
1. Describe the tool schema
Python
2. Give tool call schema to model
Python
3. Execute the tool call
Python
Python
The Dedalus Way
TheDedalusRunner supports automatic tool calling serialization.
This means that it handles schema extraction, tool dispatch, conversation looping, and final response handling. All you have to do is pass in your function into the tools parameter!
Python
See Response Schemas for the full
ChatCompletion and RunResult
shapes, including tool_calls fields.Writing good tools
Type your functions. Type hints become the JSON schema the model sees.city: str becomes {"type": "string"}. The more specific the hints, the better the model fills them in.
Write docstrings. The Runner uses your docstring as the tool’s description. The model reads it to decide when to call the function.
Use descriptive names. The model picks which tool to call by name. get_weather beats do_stuff.
Keep tool counts low. Tool schemas take up space in the context window. Minimize the tools you pass for a given task.
Read more
Dedalus Runner
Learn more about the DedalusRunner
MCP Servers
Learn how to connect MCP servers to your Dedalus models
Structured Outputs
Guarantee that your model outputs the desired schema every time
Use Cases
End-to-end examples for inspiration