promptdojo_

Build the multi-tool agent. Write run_agent(question) that:

  • Starts with a messages list containing one user turn with question.

  • Loops up to 5 times, calling fake_model(messages) each iteration.

  • On stop_reason == "end_turn": return response["content"][0]["text"].

  • On stop_reason == "tool_use": there may be ONE OR MORE tool_use blocks in response["content"]. For each one, look up the tool in the TOOLS registry and call it with **block["input"]. Build a list of tool_result blocks (each with the matching tool_use_id) and append both turns:

    1. The full assistant turn ({"role": "assistant", "content": response["content"]})
    2. One user turn whose content is the list of tool_result blocks.
  • If the cap is hit without end_turn, return "capped".

Then call it once and print the result.

Expected output:

found: Tokyo's best ramen shops, 2026 guide.

this step needs the editor

on desktop today; in the app (coming soon). save your spot and we'll bring you back here when you're ready.

open this same url on a laptop to keep going today.