Giving the agent a tool

Sometimes the model needs to look something up

Nodes and edges organize your code. But the LLM inside parse_intent sometimes needs a fact it can't invent โ€” like which walkers are actually free at the requested time. Hallucinating an available walker is worse than useless.

A tool is a function you hand the agent so it can call it mid-reasoning. Pydantic AI's @agent.tool decorator registers a normal Python function as something the model may invoke โ€” and because it's a typed function, the arguments and return value stay type-safe. The decorator is the same @ syntax you met with @dataclass and @app.route.