Simple AI Agent is a minimal agent built with Gemini API for simple tasks and code execution. It is aimed to be a good start for anyone building AI agents.
- Gemini API Integration: Interact with Google’s Gemini models using your own API key.
- Secure Tool Calls: All file and directory operations are restricted to a configurable working directory for safety.
- Easy Setup: Step-by-step instructions for installing dependencies, configuring your API key, and running the agent.
- Extensible Design: Add new tools in the
tools/directory and expand agent logic inmain.py. - Testing Included: Comprehensive test suite for all core functions and agent methods.
- Flexible Dependency Management: Supports both
pipanduvfor fast, reproducible installs.
Perfect for developers and researchers who want a lightweight, customizable AI agent with strong security guardrails and clear setup instructions.
This guide will help you set up the AI Agent project on your computer and get everything running.
- Python 3.12 or newer
- A Gemini API key get one from Google AI Studio
- Recommended: uv for fast dependency management
Clone this project to your local machine:
git clone https://github.com/evaezekwem/aiagent.git
cd aiagentIt is recommended to use a virtual environment to isolate your dependencies.
Using pip (venv):
python -m venv .venv
source .venv/bin/activateUsing uv:
uv venv
source .venv/bin/activateYou can use either pip or uv:
Using pip:
pip install -r pyproject.tomlUsing uv:
uv pip install -r pyproject.tomlIf you see errors about missing modules (e.g. google), install them directly:
pip install google-genai==1.12.1 python-dotenv==1.1.0or
uv add google-genai==1.12.1
uv add python-dotenv==1.1.0Create a .env file in the project root with your Gemini API key:
GEMINI_API_KEY=your-key-here
IMPORTANT: Modify the config.py file in the /config directory and add the working directory you want the agent to have access to.
This will limit file access to this folder alone.
Basic usage:
python main.py "What is the temperature in San Francisco"Verbose mode:
python main.py "What is the temperature in San Francisco" --verboseUsing uv:
uv run main.py -- "yWhat is the temperature in San Francisco" --verboseUsing python:
python tests.pyUsing uv:
uv run tests.py- If you see
ModuleNotFoundError: No module named 'google', install the required package as shown above. - Make sure your
.envfile is present and contains a valid API key. - For other issues, check error messages for missing dependencies or invalid configuration.
- To add new tools, create Python files in the
tools/directory. - To extend agent logic, update
main.pyand add tests intests.py.