Beyond single steps

Earlier, we handled one round of tool calls. But real tasks require multiple steps: "Get the weather in Tokyo, multiply it by 10, then turn off the kitchen light." That is 3 tool calls that depend on each other. Our current code cannot do this automatically.

04-agent-loop.ipynb
python
# Current limitation: we handle ONE round of tool calls
# Then get the final response. But what if the task needs
# multiple sequential tools?

# "Get weather in Tokyo, multiply by 10, turn off lights"
# Step 1: get_weather("Tokyo") -> 25
# Step 2: multiply(25, 10) -> 250  (needs step 1 result!)
# Step 3: toggle_light("kitchen", False)

# Our earlier code only handles step 1 automatically.

Multi-step tasks need sequential tool calls where later steps depend on earlier results.

Single-step vs Multi-step agent

Quiz: Quiz

Loading practice…