Skip to content

About

A modular AI Agent built with Python and Google Gemini featuring intelligent routing, long-term memory, task management, structured information extraction, and parallel tool execution using ThreadPoolExecutor.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

11 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🤖 Mini AI Agent

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.

Python

Gemini

License

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.


Features

  • 🤖 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

Project Architecture

User
   │
   ▼
Router (Gemini)
   │
   ▼
Execution Plan
   │
   ▼
Orchestrator
   │
   ├──────────────┐
   ▼              ▼
Calculator     Chat
Task Manager   Memory
Extract

🏗️ Architecture

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
Loading

Folder Structure

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

Technologies Used

  • Python 3.12
  • Google Gemini API
  • ThreadPoolExecutor
  • JSON
  • Prompt Engineering
  • Modular Software Architecture
  • dotenv
  • Git & GitHub

Tools

Chat

Handles:

  • Greetings
  • Coding help
  • General questions
  • Explanations

Example:

Hi

Calculator

Example:

Calculate (25+30)*4

Output:

220

Task Manager

Supports:

  • Add Task
  • Show Tasks
  • Complete Task
  • Update Task
  • Delete Task

Example:

Add task buy milk

Memory

Stores user information.

Example:

Remember that my name is Mahaveer

Later:

What is my name?

Extract

Extracts structured information.

Example:

Extract information from:

John lives in Surat.
Email: john@gmail.com
Phone: 9876543210

Returns structured JSON.


Parallel Execution

The orchestrator automatically detects independent tasks.

Example:

Hi, calculate 20+30

Both Chat and Calculator execute simultaneously using ThreadPoolExecutor.


Installation

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

Future Improvements

  • Voice Assistant
  • Web Search Tool
  • Weather Tool
  • Email Tool
  • File Summarization
  • GUI Interface
  • FastAPI Deployment

Author

Mahaveer Regar

B.Tech Electronics & Communication Engineering

SVNIT Surat

About

A modular AI Agent built with Python and Google Gemini featuring intelligent routing, long-term memory, task management, structured information extraction, and parallel tool execution using ThreadPoolExecutor.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages