The purpose of this project was to test agentic tool calling based on the task assignment. This code will serve as a basis for an AI helper to take tasks and interact with the users contact list. The goal is for an intelligent AI assistant that combines contact management, email automation, and web search capabilities using Google's Gemini AI and LangChain framework. The channels for interaction with this agent will be via Telgram messages and APIs.
- 💡 About The Project
- ✨ Key Features
- 💻 Technologies Used
- 🛠️ Installation & Setup
▶️ Running Locally- 🧪 Testing
- 📌 Project Status
- 🗺️ Future Roadmap
This project demonstrates the power of combining Large Language Models (LLMs) with structured tool calling to create an intelligent assistant capable of:
- Problem Solved: Managing contact information and automating email communications while providing intelligent web search capabilities
- Real-world Application: A virtual assistant that can look up contacts, send emails, and research information - perfect for business automation and personal productivity
- Key Learning: Mastered LangChain's agent framework and Google Gemini's function calling capabilities to create a multi-tool AI system with proper error handling and structured outputs
The assistant showcases critical thinking by validating contact information before attempting actions and problem-solving by gracefully handling failures and providing meaningful feedback to users.
- 🔍 Intelligent Contact Lookup: Search for contacts with structured validation
- 📧 Automated Email System: Send emails to found contacts with custom subjects and body content
- 🌐 Web Search Integration: Research information using Tavily search API
- 🛡️ Error Handling: Robust validation prevents actions on missing contacts
- 🧠 AI-Powered Reasoning: Google Gemini 2.5 Flash provides intelligent decision-making
- 📊 Structured Outputs: Pydantic models ensure type-safe data handling
- 🔄 Streaming Responses: Real-time agent updates for better user experience
- Python 3.8+ - Primary programming language
- Google Gemini 2.5 Flash - Advanced LLM for AI reasoning
- LangChain - Framework for building LLM applications
- Pydantic - Data validation and settings management
- Google Generative AI - Gemini model integration
- Tavily Search API - Web search functionality
- python-dotenv - Environment variable management
- Git - Version control system
- VS Code/PyCharm - IDE support
- Agent-Based Architecture
- Function Calling & Tool Integration
- Structured Output Validation
- Error Handling & Graceful Failures
- Streaming AI Responses
- CRUD Operations (Contact management)
- RESTful API Integration
- Python 3.8 or higher
- pip package manager
- Google Gemini API key
- Tavily Search API key
-
Clone the repository
git clone https://github.com/yourusername/ai-contact-assistant.git cd ai-contact-assistant -
Create a virtual environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Set up environment variables Create a
.envfile in the root directory:GEMINI_API_KEY=your_google_gemini_api_key_here TAVILY_API_KEY=your_tavily_api_key_here
-
Get API Keys
-
Activate your virtual environment
source venv/bin/activate # On Windows: venv\Scripts\activate
-
Run the main application
python main.py
-
Expected Output: The agent will process the automotive repair query and display streaming responses from the AI assistant.
The application includes several test scenarios:
- Automotive Repair Query: Research brake replacement for Ford Fusion 2012
- Contact Lookup: Find and email contacts (Alice/Bob)
- Error Handling: Demonstrates graceful failure for unknown contacts
Modify the inputs_success variable in main.py to test your own queries:
inputs_success = {"messages": [{"role": "user", "content": "Your custom query here"}]}Currently, the project uses manual testing through the main execution block. Future versions will include:
# Planned test commands
python -m pytest tests/
python -m unittest discover tests/- Unit Testing: Planned with pytest
- Integration Testing: Agent workflow validation
- API Testing: Tool function verification
- Error Handling Tests: Edge case validation
The main.py file includes comprehensive test cases that demonstrate:
- ✅ Successful contact lookup and email sending
- ❌ Graceful handling of missing contacts
- 🔍 Complex web search queries with automotive data
🟢 Active Development - Version 1.0 Core Features Complete
- ✅ Core agent functionality implemented
- ✅ Contact lookup system with validation
- ✅ Email automation with error handling
- ✅ Web search integration
- ✅ Structured output handling
This code will serve as a building block for other projects. The tooling structure used here will be used to build a more capable LLM integration that has long term memory for conversations. Also Telegram and API channel will be integrated for triggering access to the LLM along with structured output. The current output was to validate tool choosing based on task received.
- Built with LangChain - Amazing LLM framework
- Powered by Google Gemini - Advanced AI model
- Search functionality by Tavily - AI-powered search
⭐ Star this repository if you found it helpful!
Built with ❤️ using Python, LangChain, and Google Gemini