python · intermediate · ~8h
Tiny tool agent
Do not pull a framework. Write a loop: model (stubbed or API) proposes a tool, you validate arguments, execute, append the result, repeat until final answer or max steps.
Requirements
- Tools are a dict of name -> function
- Arguments are validated before the call
- Max 5 steps
- Unknown tools raise a controlled error, not a crash
Skills: Tools & function calling · Agent architecture · Agent safety
Starter
agent.py
python · sandboxed in your browser
Output
Run to see output.
Hints
- Log every call.
- Never eval() model output.