An introduction to AI agents from first principles, using plain Python and an object-oriented design.
| File | Description |
|---|---|
notebook.ipynb |
Main interactive tutorial - run in Google Colab or locally |
TUTORIAL.md |
Prose version of the tutorial for reference |
A step-by-step Jupyter notebook that builds a simple AI agent from scratch:
- The Simplest Agent — a base
Agentclass that reads a file (perception) and writes a response (action). - Giving the Agent Tools —
AgentV2subclass that holds a dictionary of callable tools (get_current_time_tool,list_files_tool) and dispatches to them via arun()method. - Giving the Agent a Brain —
AgentV3subclass that adds athink()method simulating an LLM: it parses a natural language instruction and returns the right tool key.
The final cell shows exactly how to swap the mock think() for a real LLM (e.g. Google Gemini) by subclassing AgentV3 and overriding a single method.
- Python 3.9+ (uses
zoneinfofrom the standard library) - Jupyter or VS Code with the Jupyter extension
No external packages are required to run the tutorial. The Gemini upgrade snippet in the conclusion requires google-generativeai.