Skip to content

Dineshkumar-Ponnusamy/Multi-Agent-Langgraph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Multi-Agent LangGraph Demo

This project implements a simple multi-agent system using LangGraph and LangChain with Groq's API. The system consists of two main nodes: a planner node that decomposes user input into individual, achievable tasks, and an executor node that processes these tasks into a formatted output.

Overview

The application creates a state graph where:

  • The Planner Node acts as a software architect, using an LLM to break down user input into measurable steps
  • The Executor Node generates detailed, actionable implementation guidance for each planned task using the LLM, producing a structured markdown implementation plan
  • The workflow demonstrates multi-agent orchestration using LangGraph's state management, with enhanced logging, error handling, and state tracking

Features

  • Task decomposition using LLM-based planning with JSON parsing and fallback handling
  • Detailed execution guidance generating actionable implementation steps for each task
  • Stateful agent orchestration with comprehensive logging and error handling
  • Integration with Groq's fast inference API and automatic primary/fallback model selection
  • Simple and extensible architecture with modular prompts and state management

Technologies Used

  • LangGraph: Framework for building multi-agent workflows and state machines
  • LangChain Groq: Integration for using Groq's models with LangChain
  • python-dotenv: Environment variable management

Prerequisites

  • Python 3.x
  • Groq API key

Installation

  1. Clone or download the project files
  2. Install dependencies:
pip install -r requirements.txt
  1. Create a .env file in the project root and add your Groq API key:
GROQ_API_KEY=your_groq_api_key_here

Usage

Run the main script:

python multi_agent_langgraph.py

The script processes a predefined sample input, generates a detailed implementation plan, and saves the final output to output.md.

To customize the input, modify the user_input variable in the if __name__ == "__main__": block.

Sample Output

With the default input "Help me with MVP for a new simple tool which creates documents with diagrams for given github repository", the system generates a structured markdown implementation plan and saves it to output.md. The output includes detailed, actionable steps for each planned task, formatted as follows:

# Implementation Plan

## Task 1: [Task Description]

1. [Detailed actionable step]
2. [Another step with code snippet if relevant]
3. ...

## Task 2: [Task Description]

...

Code Structure

  • multi_agent_langgraph.py: Main application script containing the agent graph definition, state management, and execution logic
  • requirements.txt: Python dependencies
  • .env: Environment configuration (not included in repository)
  • output.md: Generated output file containing the implementation plan (created after running the script)

API Configuration

The application primarily uses the llama-3.1-8b-instant model via Groq's API, with automatic fallback to llama-3.1-70b-versatile if the primary model fails. Ensure your Groq API key has access to these models.

Extending the Executor

The executor node is implemented to generate detailed, actionable implementation steps for each planned task using the LLM. To customize the execution guidance, modify the EXECUTOR_PROMPT_TEMPLATE in the script.

About

This project implements a simple multi-agent system using LangGraph and LangChain with Groq's API. The system consists of two main nodes: a planner node that decomposes user input into individual, achievable tasks, and an executor node that processes these tasks into a formatted output.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages