A production-ready, multi-agent AI system that autonomously plans, executes, verifies, and remembers complex tasks — powered by Gemini 3.5 Flash, LangGraph, Model Context Protocol (MCP), Pinecone Vector DB, and real-world APIs.
Given a plain English task like:
"Check the weather in London and format it as a JSON summary"
The AI Operations Assistant:
- 🧠 Recalls past memory — Queries Pinecone for similar tasks already solved before
- 🔌 Connects to MCP Server — Establishes stdio session with
mcp_server.pyvialangchain-mcp-adapters - 📋 Plans intelligently — Gemini 3.5 Flash breaks the task into structured, typed steps using 7 registered MCP tools
- ⚡ Executes autonomously — Runs MCP tool calls (GitHub, OpenWeatherMap, NewsAPI) over stdio transport with retry logic
- ✅ Self-verifies — Validates outputs against expected schemas, catches errors
- 💾 Saves to memory — Stores successful plans as 768-dim vectors in Pinecone for future recall
┌─────────────────────────────────────────────────────────────┐
│ FastAPI Server (:8000) │
│ POST /api/submit │
└──────────────────────────┬──────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ LangGraph StateGraph Workflow │
│ │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ Memory │───▶│ Planner │───▶│ Executor │ │
│ │ Node │ │ Node │ │ Node │ │
│ └──────────┘ └────┬─────┘ └────┬─────┘ │
│ ▲ │ │ │
│ │ └───────┬───────┘ │
│ │ load_mcp_tools() │
│ ┌──────────┐ ▼ │
│ │ Save │ ┌─────────────────────────┐ │
│ │ Memory │◀───│ MCP ClientSession │ │
│ └──────────┘ └────────────┬────────────┘ │
│ │ stdio transport │
│ ▼ │
│ ┌─────────────────────────┐ │
│ │ FastMCP Server │ │
│ │ (mcp_server.py) │ │
│ │ 7 Registered Tools │ │
│ └─────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────┐ │
│ │ Verifier Node │ │
│ └─────────────────┘ │
└─────────────────────────────────────────────────────────────┘
Pinecone Vector DB ──── embeddings ──── Google gemini-embedding-001
This project uses the Model Context Protocol (MCP) to expose modular API tools over standard input/output (stdio) transport via mcp_server.py.
| Category | Tool Name | Description |
|---|---|---|
| 🐙 GitHub | github_search_repos |
Search GitHub repositories matching a query string |
| 🐙 GitHub | github_get_repo |
Get detailed information for a specific GitHub repository |
| 🐙 GitHub | github_get_repos_batch |
Get details for multiple GitHub repositories at once |
| 🌤️ Weather | weather_current |
Get current weather conditions for a specified city |
| 🌤️ Weather | weather_forecast |
Get multi-day weather forecast for a specified city |
| 📰 News | news_search |
Search news articles matching keyword queries |
| 📰 News | news_top_headlines |
Get top headlines by category or country |
Tools are initialized via FastMCP and dynamically loaded into the LangGraph workflow using langchain-mcp-adapters:
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client
from langchain_mcp_adapters.tools import load_mcp_tools
server_params = StdioServerParameters(command="python", args=["mcp_server.py"])
async with stdio_client(server_params) as (read, write):
async with ClientSession(read, write) as session:
await session.initialize()
mcp_tools = await load_mcp_tools(session)ai_ops_assistant/
│
├── main.py # FastAPI server entry point
├── mcp_server.py # FastMCP Server exposing 7 MCP tools over stdio
├── requirements.txt # All Python dependencies
├── .env # Your secret API keys (never commit!)
├── .env.example # Template for .env
├── manifest.json # Tool registry & system config
│
├── agents/ # The "Brains"
│ ├── planner.py # Decomposes tasks into typed step plans via MCP tools
│ ├── executor.py # Executes steps via MCP tool adapters with retries
│ └── verifier.py # Validates outputs against expected schemas
│
├── workflow/
│ └── graph.py # LangGraph StateGraph definition
│ # (Memory→Planner→Executor→Verifier→SaveMemory)
│
├── llm/
│ ├── gemini_client.py # Gemini 3.5 Flash wrapper (JSON generation)
│ └── prompts/ # Strictly typed JSON prompt templates
│ ├── planner_prompt.py
│ └── verifier_prompt.py
│
├── memory/
│ └── vector_store.py # Pinecone + gemini-embedding-001 (768-dim)
│ # save_successful_task / search_similar_tasks
│
├── tools/ # The "Hands"
│ ├── base_tool.py # Abstract ToolInterface + ToolResponse
│ ├── github_tool.py # GitHub REST API implementation
│ ├── weather_tool.py # OpenWeatherMap API implementation
│ ├── news_tool.py # NewsAPI implementation
│ └── langchain_tools.py # Dynamic MCP tool loader utilities
│
├── services/
│ └── workflow_service.py # Bridges FastAPI request to LangGraph
│
└── tests/
└── test_integration.py # Integration test suite
| Layer | Technology |
|---|---|
| LLM | Google Gemini 3.5 Flash (models/gemini-3.5-flash) |
| Tool Protocol | Model Context Protocol (MCP via FastMCP) |
| MCP Adapters | langchain-mcp-adapters over stdio transport |
| Embeddings | Google models/gemini-embedding-001 (768-dim) |
| Orchestration | LangGraph StateGraph (conditional edges, cyclic retry) |
| Vector Memory | Pinecone Serverless Index |
| API Framework | FastAPI + Uvicorn |
| Real-World APIs | OpenWeatherMap · GitHub REST · NewsAPI |
| Runtime | Python 3.10+ |
Make sure you have Python 3.10+ installed:
python --version# Clone the repository
git clone <your-repo-url>
cd ai_ops_assistant
# Create and activate a virtual environment
python -m venv venv
# Windows:
venv\Scripts\activate
# Mac/Linux:
source venv/bin/activate
# Install all dependencies (including mcp & langchain-mcp-adapters)
pip install -r requirements.txtCopy the template and fill in your keys:
cp .env.example .envOpen .env and set the following:
GEMINI_API_KEY=AIzaSy...
GITHUB_TOKEN=ghp_...
OPENWEATHER_KEY=...
NEWSAPI_KEY=...
PINECONE_API_KEY=...
PINECONE_INDEX_NAME=ai-ops-memory| Key | Cost | Link | Steps |
|---|---|---|---|
GEMINI_API_KEY |
Free | Google AI Studio | Sign in → "Get API Key" → Copy |
GITHUB_TOKEN |
Free | GitHub Settings | "Generate new token (classic)" → select public_repo |
OPENWEATHER_KEY |
Free | OpenWeatherMap | Sign up → Verify email → API Keys |
NEWSAPI_KEY |
Free | NewsAPI | Register → Copy key from dashboard |
PINECONE_API_KEY |
Free | Pinecone Console | Create account → Create index (dimension: 768) → Copy API key |
Start the server:
python main.pyExpected startup output:
INFO:memory.vector_store:Successfully connected to Pinecone index 'ai-ops-memory'
INFO:workflow.graph:Successfully compiled LangGraph StateGraph workflow with MCP tool support
INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
Interactive API Docs: http://localhost:8000/docs
curl -X POST http://localhost:8000/api/submit \
-H "Content-Type: application/json" \
-d '{"task": "Check the weather in London and format it as a JSON summary"}'Expected server log flow:
[LangGraph: Memory Node] Querying Pinecone for past memory...
[LangGraph: Planner Node] Creating plan for task...
[MCP Session] Successfully loaded 7 tools via load_mcp_tools()
[LangGraph: Executor Node] Executing step via MCP Tool: 'weather_current' ✅
[LangGraph: Verifier Node] Confidence: 1.0, Issues: 0 → Routing to SaveMemory
[LangGraph: SaveMemory Node] Upserted to Pinecone ✅ {'upserted_count': 1}
curl -X POST http://localhost:8000/api/submit \
-H "Content-Type: application/json" \
-d '{"task": "Find the top 3 Python web frameworks on GitHub by stars"}'curl -X POST http://localhost:8000/api/submit \
-H "Content-Type: application/json" \
-d '{"task": "Find the top 3 AI news headlines from the US today"}'Run a task twice. On the second run, watch the logs — the system will retrieve the previously saved plan from Pinecone vector memory:
# First run — saves vector to Pinecone
curl -X POST http://localhost:8000/api/submit \
-H "Content-Type: application/json" \
-d '{"task": "Get current weather in Tokyo"}'
# Second run — recalls vector memory from Pinecone
curl -X POST http://localhost:8000/api/submit \
-H "Content-Type: application/json" \
-d '{"task": "What is the weather like in Tokyo?"}'| Node | Role | Description |
|---|---|---|
memory_node |
Recall | Embeds task and queries Pinecone for similar past task memories |
planner_node |
Plan | Loads 7 tools via load_mcp_tools() and creates structured step plans with Gemini 3.5 |
executor_node |
Act | Calls FastMCP server tools over stdio transport with exponential retries |
verifier_node |
Verify | Validates results against expected schema; routes on failure |
save_memory_node |
Remember | Saves successful plan + verification as a 768-dim vector to Pinecone |
Q: Cannot find module langchain_mcp_adapters
A: Run
pip install -r requirements.txtto installlangchain-mcp-adaptersandmcp.
Q: 429 Quota Exceeded from Gemini API
A: You hit Google's free tier rate limit (20 requests per minute). Simply wait 10-15 seconds before running the next request.
Q: Pinecone dimension mismatch
A: Your Pinecone index must be created with dimension = 768 to match
models/gemini-embedding-001.
This project is licensed under the MIT License.