This repository demonstrates the comprehensive implementation of Agentic AI systems using LangGraph. Unlike traditional stateless Generative AI, this framework enables the creation of autonomous agents that can plan, execute, remember context, and collaborate to solve complex tasks.
It serves as both a learning curriculum and a reference implementation for building production-ready agentic workflows, covering everything from basic sequential chains to complex multi-agent orchestration with the Model Context Protocol (MCP).
AgenticAI describes systems defined by:
- 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.
- Foundation Level
- Foundations of Agentic AI: Core concepts and principles
- LangGraph Fundamentals: State machines and workflow design
- Intermediate Level
- Advanced LangGraph: Complex routing and error handling
- AI Agents: Agent design patterns and architectures
- Advanced Level
- Agentic RAG: Retrieval-augmented generation with agents
- Production Deployment: Scaling and monitoring strategies
The system is built around these modular and interoperable components:
-
Agents
- Description: Autonomous entities with specific roles, memory, tools, and objectives.
- Examples:
PlannerAgent(decomposes goals),ResearchAgent(gathers data),ExecutionAgent(runs tasks).
-
LangGraph State Machine
- Description: The central orchestrator defining agent transitions, execution flow, and dynamic task routing.
- Key Features: Warning-Stateful DAG, Conditional Routing, Concurrency & Retries.
-
MCP Message Layer
- Description: Protocol for structured message exchange including
Message,Thread,Step, andRunobjects to trace agent reasoning.
- Description: Protocol for structured message exchange including
-
Memory and Context Store
- Description: Long-term and short-term memory (Thread-level history, Agent-specific context, Vector DBs for RAG).
-
Tools and Interfaces
- Description: External capabilities (Web search, Code interpreter, API clients) abstracted as callable nodes.
-
Task Router / Controller
- Description: Mechanism for Centralized Planning or Distributed Negotiation to assign subtasks.
-
Observability & Debugging
- Description: Logging, tracing, and monitoring via LangGraph visualizer and logging middleware.
| Feature | Generative AI (GenAI) | Agentic AI |
|---|---|---|
| Primary Output | Unstructured content (text, image, audio) | Structured outputs from autonomous task execution |
| Execution Flow | Stateless, single-step inference | Stateful, iterative multi-step reasoning with memory |
| Architecture | Monolithic linear pipelines | Modular, event-driven multi-agent systems (DAGs) |
| Decision-Making | Prompt-conditioned output | Goal-oriented planning & dynamic context tracking |
| Autonomy | Passive response to queries | Proactive decision-making |
| Control Flow | Prompt engineering | Finite-state machines & reactive policies |
| Memory | Ephemeral (limited context) | Persistent, structured memory |
| Tool Use | Manually scripted / templates | Dynamic tool selection via MCP |
| Scalability | Limited by model/context size | Horizontal scaling via specialized agents |
| Debuggability | Opaque reasoning | Transparent workflows & traceable nodes |
Agentic_AI_using_LangGraph/
βββ 01_Foundation_of_AgenticAI/ # Basic concepts and functional nodes
βββ 02_Sequential_&_Parallel_workflow/# Linear and parallel chain executions
βββ 03_Conditional_Workflow/ # Dynamic routing based on logic (Router)
βββ 04_Iterative_Workflows/ # Loops and retry mechanisms
βββ 05_Structured_ai_chatbot/ # Schema-driven agent responses
βββ 06_Conversational_ai_chatbot/ # Advanced chatbots with memory
βββ 07_LangsSmith/ # Tracing and observability setup
βββ _img/ # Assets and diagrams
βββ main.py # Entry point for testing
βββ requirements.txt # Project dependencies- Python 3.9+
- Git
- API Keys: OpenAI, Anthropic, or HuggingFace.
We recommend using uv for fast dependency management, but standard pip works as well.
-
Clone the repository
git clone https://github.com/mohd-faizy/Agentic_AI_using_LangGraph.git cd Agentic_AI_using_LangGraph -
Set up the environment
Using
uv(Recommended):uv venv source .venv/bin/activate # macOS/Linux .venv\Scripts\activate # Windows uv add -r requirements.txt
Using
pip:python -m venv venv source venv/bin/activate # macOS/Linux venv\Scripts\activate # Windows pip install -r requirements.txt
-
Configuration Create a
.envfile:cp .env.example .env
Add your keys:
OPENAI_API_KEY=sk-... LANGCHAIN_API_KEY=...
from langgraph.graph import StateGraph, END
from typing import TypedDict
# 1. Define State
class AgentState(TypedDict):
messages: list
# 2. Define Nodes
def agent_node(state: AgentState):
return {"messages": ["Agent processing..."]}
# 3. Build Graph
workflow = StateGraph(AgentState)
workflow.add_node("agent", agent_node)
workflow.set_entry_point("agent")
workflow.add_edge("agent", END)
# 4. Compile & Run
app = workflow.compile()
print(app.invoke({"messages": ["Init"]}))Contributions are welcome! If you find this repository helpful, please star it!
Distributed under the MIT License. See LICENSE for more information.


