Weather Tool Agent
Build a user-goal agent with geocode, weather, and finish tools, a JSON action protocol, retries, and tests — all simulated in stdlib Python.
Outcome: A runnable weather agent that geocodes a city, fetches a forecast, finishes with a sentence, retries bad JSON, and fails closed on unknown places.
beginner · 5–7 hours
- 01
Overview and Architecture
Define the weather agent as a loop: user goal, three tools, JSON actions, stop conditions, and a fake model you can later swap for an API.
- 02
Tools and Simulated Environment
Register geocode, weather, and finish as functions with stable JSON-shaped results, unknown-city errors, and no real network.
- 03
JSON Action Loop and Retries
Parse {tool, args} from the policy, execute tools, retry bad JSON, and stop on finish or budget.
- 04
Evals and Tests
Test tools, the parser, goal predicates, and golden transcripts with a tiny stdlib runner — no pytest required in the browser.
- 05
Hardening the Weather Agent
Validate arguments, cap parse retries, reject unknown tools, simulate rate limits, and fail closed without calling weather on garbage coords.