Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion docs/docs/learn/programming/tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,17 @@ print("Tool calls made:", result.trajectory)
react_agent = dspy.ReAct(
signature="question -> answer", # Input/output specification
tools=[tool1, tool2, tool3], # List of available tools
max_iters=10 # Maximum number of tool call iterations
max_iters=5 # Maximum number of reasoning-acting iterations (default: 10)
)
```

**`max_iters`**: Controls the maximum number of reasoning and acting cycles the agent can perform. In each iteration, the model:
1. Reasons about the current state and what to do next
2. Decides whether to call a tool or provide a final answer
3. If calling a tool, executes it and observes the result

The agent stops when it either reaches `max_iters` or decides it has enough information to answer. Higher values allow more tool calls but increase latency and cost.

## Approach 2: Manual Tool Handling

For more control over the tool calling process, you can manually handle tools using DSPy's tool types.
Expand Down