Skip to content

Latest commit

Β 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ LangGraph Grok Agent

A production-ready Agentic AI project built with LangGraph, Groq, and Python that demonstrates graph-based AI workflows, multi-step reasoning, tool calling, state persistence, and reactive agents.

This repository contains both a basic LangGraph agent and an advanced reactive agent, making it a great starting point for learning modern AI agent development.


✨ Features

  • πŸ€– LangGraph-powered AI Agents
  • ⚑ Groq LLM Integration
  • πŸ”„ Graph-based Workflow Execution
  • πŸ› οΈ Tool Calling
  • 🧠 Multi-step Reasoning
  • πŸ’¬ Stateful Conversations
  • πŸ’Ύ Checkpoint Support
  • πŸ“œ Execution Logging
  • πŸ”§ Environment Variable Configuration
  • πŸš€ FastAPI Deployment Example
  • πŸ“¦ Modular Project Structure

πŸ“‚ Project Structure

langgraph-grok-agent/
β”œβ”€β”€ langgraph_grok_agent.py          # Basic LangGraph agent implementation
β”œβ”€β”€ langgraph_reactive_agent.py      # Advanced reactive AI agent
β”œβ”€β”€ setup_and_config.py              # Configuration & utility functions
β”œβ”€β”€ requirements.txt                 # Project dependencies
β”œβ”€β”€ .env                             # API keys & environment variables
β”œβ”€β”€ README.md                        # Project documentation
β”œβ”€β”€ checkpoints/                     # Saved LangGraph checkpoints
β”œβ”€β”€ logs/                            # Runtime logs
└── examples/
    β”œβ”€β”€ example_basic.py             # Basic usage example
    β”œβ”€β”€ example_advanced.py          # Advanced workflows
    └── example_api_server.py        # FastAPI deployment example

βš™οΈ Tech Stack

  • Python 3.11+
  • LangGraph
  • LangChain
  • Groq API
  • Pydantic
  • python-dotenv
  • FastAPI
  • Uvicorn

πŸš€ Installation

Clone Repository

git clone https://github.com/Ronit049/LangGraph_Grok_Agent.git

cd langgraph-grok-agent

Create Virtual Environment

Windows

python -m venv .venv

.venv\Scripts\activate

Linux / macOS

python3 -m venv .venv

source .venv/bin/activate

Install Dependencies

pip install -r requirements.txt

πŸ”‘ Environment Variables

Create a .env file in the project root.

GROQ_API_KEY=your_groq_api_key

GEMINI_API_KEY=your_gemini_api_key

▢️ Running the Project

Basic LangGraph Agent

python langgraph_grok_agent.py

Reactive Agent

python langgraph_reactive_agent.py

FastAPI Server

python examples/example_api_server.py

or

uvicorn examples.example_api_server:app --reload

πŸ“– Examples

Basic Example

python examples/example_basic.py

Demonstrates:

  • Building a LangGraph workflow
  • Executing an AI agent
  • Managing graph state

Advanced Example

python examples/example_advanced.py

Demonstrates:

  • Multi-step reasoning
  • Tool execution
  • Dynamic routing
  • Stateful conversations

API Deployment

python examples/example_api_server.py

Demonstrates:

  • FastAPI integration
  • REST API endpoint
  • JSON responses
  • Production deployment

🧠 Agent Workflow

User Input
     β”‚
     β–Ό
Task Analysis
     β”‚
     β–Ό
Reasoning
     β”‚
     β–Ό
Tool Selection
     β”‚
     β–Ό
Tool Execution
     β”‚
     β–Ό
State Update
     β”‚
     β–Ό
Response Generation
     β”‚
     β–Ό
Final Answer

πŸ“¦ Main Components

langgraph_grok_agent.py

  • Basic LangGraph workflow
  • Tool execution
  • Graph state management
  • AI response generation

langgraph_reactive_agent.py

  • Advanced reactive agent
  • Conditional routing
  • Dynamic tool selection
  • Multi-step reasoning
  • Context-aware responses

setup_and_config.py

  • Environment configuration
  • API initialization
  • Logging setup
  • Utility functions

πŸ“ Checkpoints

The checkpoints/ directory stores saved LangGraph execution states, allowing interrupted workflows to resume later.


πŸ“ Logs

Execution logs are written to the logs/ directory for debugging, monitoring, and tracing agent behavior.


🎯 Learning Objectives

This project demonstrates:

  • LangGraph Fundamentals
  • Agentic AI
  • Graph-based AI Workflows
  • Tool Calling
  • State Persistence
  • Multi-step Reasoning
  • Prompt Engineering
  • API Integration
  • FastAPI Deployment

πŸš€ Future Improvements

  • Memory Integration
  • RAG (Retrieval-Augmented Generation)
  • Multi-Agent Collaboration
  • Streaming Responses
  • Human-in-the-Loop Workflows
  • Database Persistence
  • Docker Support
  • CI/CD Pipeline
  • Cloud Deployment (Railway, Render, AWS)

🀝 Contributing

Contributions are welcome!

  1. Fork the repository
  2. Create a feature branch
git checkout -b feature-name
  1. Commit your changes
git commit -m "Add new feature"
  1. Push your branch
git push origin feature-name
  1. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License.


πŸ‘¨β€πŸ’» Author

Ronit Raj

Computer Science Engineering Student | Python Developer | Agentic AI Enthusiast

Skills

  • Python
  • LangGraph
  • LangChain
  • Groq
  • Gemini
  • FastAPI
  • AI Agents
  • Machine Learning
  • Generative AI

⭐ If you found this project useful, please Star the repository and consider contributing!

About

A production-ready Agentic AI project built with LangGraph, Groq, and Python that demonstrates graph-based AI workflows, multi-step reasoning, tool calling, state persistence, and reactive agents.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages