A modular AI agent powered by Google's Gemini API that intelligently routes user requests to specialized tools, supports long-term memory, and executes independent tasks in parallel.
This project demonstrates an AI agent capable of routing user requests to specialized tools, maintaining long-term memory, managing tasks, performing calculations, extracting structured information, and executing independent tasks in parallel.
- 🤖 Intelligent Request Routing
- 💬 AI Chat
- 🧮 Safe Mathematical Calculator
- ✅ Task Management (CRUD)
- 🧠 Long-Term Memory
- 📄 Structured Information Extraction
- ⚡ Parallel Tool Execution using ThreadPoolExecutor
- 📁 JSON-based Persistent Storage
- 🛡️ Graceful Error Handling
User
│
▼
Router (Gemini)
│
▼
Execution Plan
│
▼
Orchestrator
│
├──────────────┐
▼ ▼
Calculator Chat
Task Manager Memory
Extract
flowchart TD
A[User Input]
--> B[Gemini Router]
B --> C[Execution Plan]
C --> D[Orchestrator]
D -->|Sequential| E[Tool Execution]
D -->|Parallel| F[ThreadPoolExecutor]
F --> G[Chat Tool]
F --> H[Calculator Tool]
F --> I[Task Manager]
F --> J[Memory Tool]
F --> K[Extract Tool]
E --> G
E --> H
E --> I
E --> J
E --> K
G --> L[Final Response]
H --> L
I --> L
J --> L
K --> L
Mini-AI-Agent/
│
├── agent/
│ ├── tools/
│ │ ├── calculator.py
│ │ ├── task_manager.py
│ │ ├── memory.py
│ │ ├── extract.py
│ │ ├── chat.py
│ │ └── __init__.py
│ │
│ ├── router.py
│ ├── orchestrator.py
│ ├── prompts.py
│ ├── gemini.py
│ └── context.py
│
├── data/
│ ├── memory.json
│ └── tasks.json
│
├── main.py
├── requirements.txt
└── README.md
- Python 3.12
- Google Gemini API
- ThreadPoolExecutor
- JSON
- Prompt Engineering
- Modular Software Architecture
- dotenv
- Git & GitHub
Handles:
- Greetings
- Coding help
- General questions
- Explanations
Example:
Hi
Example:
Calculate (25+30)*4
Output:
220
Supports:
- Add Task
- Show Tasks
- Complete Task
- Update Task
- Delete Task
Example:
Add task buy milk
Stores user information.
Example:
Remember that my name is Mahaveer
Later:
What is my name?
Extracts structured information.
Example:
Extract information from:
John lives in Surat.
Email: john@gmail.com
Phone: 9876543210
Returns structured JSON.
The orchestrator automatically detects independent tasks.
Example:
Hi, calculate 20+30
Both Chat and Calculator execute simultaneously using ThreadPoolExecutor.
Clone the repository
git clone <repository-url>
Install dependencies
pip install -r requirements.txt
Create a .env file
GEMINI_API_KEY=YOUR_API_KEY
Run
python main.py
- Voice Assistant
- Web Search Tool
- Weather Tool
- Email Tool
- File Summarization
- GUI Interface
- FastAPI Deployment
Mahaveer Regar
B.Tech Electronics & Communication Engineering
SVNIT Surat