This is a simple example of building an AI Agent that can:
- Perform math calculations
- Reverse strings
- Answer simple questions
It runs a local LLM (via Ollama) and uses Python tools to execute tasks.
โ
Install Python >=3.8
โ
Install Ollama: https://ollama.com
git clone <repo-url> ai-agent-from-scratch
cd ai-agent-from-scratch
# (optional) create virtualenv
python -m venv venv
source venv/bin/activate
pip install -r requirements.txtMake sure Ollama is running:
ollama serve
ollama pull llama2python main.pyYou can then type questions like:
Calculate 15 plus 7Reverse hello worldWho are you?
- The agent always responds in JSON and picks the correct tool.
- You can add more tools in
tools.py.
MIT