Skip to content

Mukkandi-Sridhar/react-langgraph-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ReAct Agent with LangGraph

A production-style implementation of a ReAct (Reason + Act) AI Agent built using LangGraph.
This project demonstrates how modern AI agents combine reasoning + tool usage to solve tasks step-by-step.

Unlike basic chatbots, this agent can:

  • Think through problems
  • Decide actions
  • Use tools
  • Observe results
  • Continue reasoning until it reaches the final answer.

This repository serves as a practical reference implementation for building agentic AI systems.


Overview

Large Language Models are powerful but limited when used alone.

The ReAct architecture improves this by allowing the model to:

  1. Reason about the problem
  2. Decide an action
  3. Execute a tool
  4. Observe results
  5. Continue reasoning

This cycle continues until the agent reaches a final answer.

This project demonstrates how to implement this workflow using LangGraph, which enables stateful AI agent execution.


Features

  • ReAct reasoning loop (Think → Act → Observe)
  • Tool integration (web search, recommendation tools)
  • Stateful execution using LangGraph
  • Modular architecture
  • Easy to extend with new tools
  • Production-style project structure

Architecture

User Query
    │
    ▼
Reasoning Node (LLM)
    │
    ▼
Action Selection
    │
    ▼
Tool Execution
    │
    ▼
Observation Returned
    │
    ▼
State Update (LangGraph)
    │
    ▼
Repeat Until Final Answer

This loop enables multi-step reasoning and decision making.


Project Structure

react-langgraph-agent/
│
├── main.py
│   Entry point that runs the agent workflow
│
├── agent/
│   Core reasoning logic and prompt templates
│
├── tools/
│   External tools used by the agent
│   ├── search_tool.py
│   └── recommendation_tool.py
│
├── graph/
│   LangGraph workflow definition
│
├── requirements.txt
│   Project dependencies
│
└── README.md
│   Project documentation

How the Agent Works

Step 1 — User Input

The user submits a task.

Example:

"What are the best AI tools for coding?"

Step 2 — Reasoning

The LLM analyzes the request.

Example reasoning:

Thought: I should search for the latest AI coding tools.
Action: web_search

Step 3 — Tool Execution

The selected tool runs and returns results.

Observation: List of popular AI coding assistants

Step 4 — Continue Reasoning

The agent evaluates the observation.

Thought: I can summarize the best tools now.

Step 5 — Final Answer

The agent returns a structured response.

Example output:

Top AI coding tools:
1. GitHub Copilot
2. Cursor
3. Codeium
4. Tabnine

Installation

Clone the repository:

git clone https://github.com/yourusername/react-langgraph-agent.git
cd react-langgraph-agent

Install dependencies:

pip install -r requirements.txt

Running the Agent

Run the main program:

python main.py

Example interaction:

User: What are the best AI coding tools?

Agent reasoning...
Using web_search tool...

Final Answer:
1. GitHub Copilot
2. Cursor
3. Codeium
4. Tabnine

Tools Included

Web Search Tool

Fetches relevant information from the web.

Recommendation Tool

Provides curated suggestions based on the agent's reasoning.

You can easily add new tools such as:

  • Database query tools
  • API integrations
  • Document retrieval systems
  • Code execution environments

Possible Extensions

This project can be expanded with additional capabilities.

Memory

Enable the agent to remember past conversations.

Multi-Agent Collaboration

Create specialized agents working together.

Retrieval-Augmented Generation (RAG)

Allow the agent to access external knowledge bases.

Evaluation Pipelines

Add automated evaluation for agent performance.

Deployment

Deploy the agent using:

  • FastAPI
  • Docker
  • Kubernetes

Technologies Used

  • Python
  • LangGraph
  • LangChain
  • Large Language Models (LLMs)

Learning Goals

This project demonstrates:

  • Agentic AI architecture
  • Reasoning-action loops
  • Tool usage with LLMs
  • Stateful AI workflows

It is designed for developers interested in building next-generation AI systems beyond simple chatbots.


License

This project is provided for educational and experimental purposes.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages