Mini Agents — Tool-Use Loop
OpenAI function-calling agent that plans and solves problems using a live todo list
Overview
Built a minimal but complete AI agent using OpenAI's function-calling API. The agent receives an open-ended problem, autonomously breaks it into steps via a todo list, executes each step in order, and returns a final answer — all without human intervention. The project demonstrates the core loop behind every tool-using agent: model decides → tool executes → result feeds back → repeat until done.
Live Demo
Mini Agents — Live Demo
AIType any problem. The agent plans steps, executes them, and returns an answer.
Methods
Key Findings
- The model reliably decomposes open-ended problems into ordered, executable steps before acting
- Dynamic dispatch via globals() keeps the loop generic — any registered Python function becomes a callable tool
- The agent self-corrects by marking steps complete with notes, creating a readable audit trail of its reasoning
- Structured system prompting (plan first, then execute, no clarifying questions) is key to autonomous behavior
Results
Full agent loop in under 60 lines of Python — no framework required
Agent correctly solved the two-train problem end-to-end: estimated Boston–NYC distance, computed meeting time
Todo list rendered live with Rich — completed steps shown in green strikethrough as the agent works
Reusable pattern: swap tools and system prompt to build any tool-using agent on the same loop
Ask About This Project
Have a technical question? Ask here.