Repository navigation
Strands Build 2 · The toolsmith: schemas the model calls correctly #33
akash-coded
started this conversation in
Exercises
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
The toolsmith
A single tool is a gadget. A few well-described tools plus a clear role is an assistant that does real work and hands back clean, usable results. Build one.
The running example is a lightweight trip assistant. Swap in your own domain if you prefer - support, research, internal ops. The mechanics are identical.
Spin up
Same starter as before. Stay on Haiku 4.5 while you build.
Stuck on AWS: it is almost always the
us.model-id prefix, the region, or your credentials. Check those three first.Level 1 - a small toolkit that routes
Give one agent two or three related tools, then ask a question that needs more than one of them.
You are done when: a single question triggers more than one tool and the agent stitches the results into one answer.
Level 2 - hand back data, not prose
You want to drop the result into an app, not read a paragraph. Make the agent fill a typed shape.
You are done when: you get back a real object with the right types (a list is a list, a number is a number), not text you have to parse.
Level 3 - push it
Pick one:
tool_context(tool_context.agent.state.get(...)/.set(...)), then ask "what's on my list?".get_model(model_id="us.anthropic.claude-sonnet-4-20250514-v1:0"). Compare answer quality and tokens.You are done when: your assistant remembers something across turns, or you can state the Haiku-versus-Sonnet trade-off from your own run.
Notice this
Poke at it
Write two tools that could both plausibly answer the same question. Which one does the agent pick, and how does editing the descriptions change that?
All reactions