- 🤖 AgenticAI using LangGraph & MCP
AgenticAI describes systems where:
- Autonomy: Agents independently plan and execute subtasks
- Orchestration: Workflows are coordinated via a shared protocol (MCP)
- Composability: Agents and graphs are modular, reusable, and testable
These systems extend beyond classic Generative AI by providing stateful, goal-oriented workflows across multiple collaborative agents.
The Agentic AI system using LangGraph and the Model Context Protocol (MCP) is built around the following modular and interoperable components:
-
Description: Autonomous entities with specific roles, memory, tools, and objectives.
-
Examples:
PlannerAgent
: Decomposes high-level goals into actionable tasks.ResearchAgent
: Gathers relevant data or insights using tools like web search or RAG.ExecutionAgent
: Executes low-level tasks and invokes tools or APIs.
-
Features: Stateful (via memory), tool-using, communicative (MCP-compliant messaging).
-
Description: The central orchestrator defining agent transitions, execution flow, and dynamic task routing.
-
Features:
- Stateful DAG: Nodes = agents/tools; Edges = routing logic.
- Conditional Routing: Based on task output or system state.
- Concurrency & Retry Logic: Supports parallel execution and fault tolerance.
-
Description: Protocol for structured message exchange between agents.
-
Features:
Message
,Thread
,Step
, andRun
objects.- Agent reasoning traceability.
- Shared memory via
Thread
context.
-
Description: Long- and short-term memory stores for agents.
-
Types:
- Thread-level Memory: Conversation history, decisions, intermediate steps.
- Agent Memory: Role-specific memory for internal context and learning.
- External Vector DB (e.g., FAISS, Weaviate): For RAG and semantic retrieval.
-
Description: External capabilities invoked by agents to augment reasoning.
-
Examples:
- Web search, code interpreter, database access, API clients.
-
Integration: Tools are abstracted as callable nodes or plugins within LangGraph.
-
Description: A centralized or decentralized mechanism to assign subtasks to agents.
-
Modes:
- Centralized Planning: Planner decides the full task flow.
- Distributed Negotiation: Agents communicate and reassign tasks dynamically.
- Description: Logging, tracing, and monitoring components to track agent behavior and graph execution.
- Tools: LangGraph visualizer, logging middleware, state inspection.
Feature | Generative AI (GenAI) | Agentic AI |
---|---|---|
Primary Output | Unstructured content (text, image, audio, video) | Structured outputs from autonomous task execution |
Execution Flow | Stateless, single-step inference per prompt | Stateful, iterative multi-step reasoning with memory |
Architecture | Monolithic or linear prompt pipelines | Modular, event-driven multi-agent systems (e.g., DAGs in LangGraph) |
Decision-Making Paradigm | Prompt-conditioned output generation | Goal-oriented planning with long-term memory and dynamic context tracking |
Autonomy | Passive response to human queries | Proactive decision-making and self-directed task execution |
Control Flow Logic | Determined by prompt engineering | Driven by finite-state machines, graphs, or reactive policies |
Memory & State Handling | Typically ephemeral (no memory or limited through hacks like RAG) | Persistent, structured memory for state tracking and dependency handling |
Interactivity Level | Low—requires repeated user input | High—agents plan, recover from failure, and reattempt subtasks |
Tool Use & API Calling | Manually scripted via code or prompt templates | Dynamically selected tools via agent/tool registries and MCP mechanisms |
Adaptability | Fixed behavior per prompt configuration | Context-aware adaptation based on task state and environment |
Scalability | Scaling limited by model size and prompt length | Scales horizontally by orchestrating multiple specialized agents |
Debuggability | Opaque reasoning; difficult to trace | Transparent workflows; traceable node-level decisions |
Learning/Training | Pretrained foundation models; static behavior | Potential for online learning, fine-tuning per agent |
Security/Guardrails | Prompt filtering, static constraints | Embedded policies, role-based access, task-level validation |
Deployment Targets | Front-end apps, content generators, creative tools | Backend automation, orchestration layers, autonomous agent systems |
Example Systems | ChatGPT, Claude, Gemini, DALL·E 3, Sora, MusicLM, MidJourney | AutoGPT, LangGraph + MCP, OpenDevin, OpenAgents, CrewAI, MetaAgent, Devika |
# 1. Clone the repo
git clone https://github.com/mohd-faizy/Agentic_AI_using_LangGraph_-_MCP.git
cd Agentic_AI_using_LangGraph_-_MCP
# 2. Create & activate a virtual environment
python -m venv venv
# Unix/macOS
source venv/bin/activate
# Windows
venv\Scripts\activate
# 3. Install dependencies
pip install -r requirements.txt
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This project is licensed under the MIT License. See the LICENSE file for details.
If you find this repository helpful, show your support by starring it! For questions or feedback, reach out on Twitter(X
).
This repository draws inspiration from the exceptional educational content developed by Nitish, Krish Naik, and the DataCamp course Developing LLMs with LangChain
. The implementations and examples provided here are grounded in their comprehensive tutorials on Generative AI, with a particular focus on LangChain and Hugging Face.
➤ If you have questions or feedback, feel free to reach out!!!