Skip to content

AMRENDRASINGH-COM/Multi-Agent-AI-LangGraph-ADK

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“ Project Structure

πŸ“¦ Soojh-AI/
β”œβ”€β”€ πŸ€– chatbot.py          # Interactive chat interface
β”œβ”€β”€ πŸ“Š graph.py            # LangGraph workflow definition  
β”œβ”€β”€ 🎯 node.py             # Graph nodes and state management
β”œβ”€β”€ πŸ› οΈ tools.py            # External research tools
β”œβ”€β”€ 🧠 llm.py              # LLM configurations and models
β”œβ”€β”€ βš™οΈ agent.py            # Google ADK agent setup
β”œβ”€β”€ πŸ“„ README.md           # This file
β”œβ”€β”€ πŸ” .env.example        # Environment variable template
β”œβ”€β”€ πŸ“‹ requirements.txt    # Python dependencies
└── 🚫 .gitignore          # Git ignore rules

πŸš€ Quick Start

Prerequisites

  • Python 3.12+
  • OpenAI API key
  • Git

Installation

  1. Clone the repository

    git clone https://github.com/AMRENDRASINGH-COM/Soojh-ai-git.git
    cd Soojh-ai-git
    
  2. Create virtual environment

    python -m venv venv
    # Windows
    venv\Scripts\activate
    # Linux/macOS
    source venv/bin/activate
    
  3. Install dependencies

    pip install -r requirements.txt
    
  4. Configure environment

    cp .env.example .env
    # Edit .env file and add your OpenAI API key:
    # OPENAI_API_KEY=your_openai_api_key_here
    
  5. Run the application

    # Interactive chatbot
    python chatbot.py
    
    # Or import as module
    from graph import build_graph
    graph = build_graph()
    

πŸ’» Usage Examples

Basic Chat Interaction

from chatbot import chat_with_bot

# Simple conversation
response = chat_with_bot("What is machine learning?")
print(response)

# Research query
response = chat_with_bot("Find recent papers on transformer architecture")
print(response)

Advanced Graph Usage

from graph import build_graph

# Build the LangGraph workflow
graph = build_graph()

# Stream responses for complex queries
events = graph.stream({
    "messages": [("user", "Explain quantum computing with recent research")]
}, stream_mode="values")

for event in events:
    print(event["messages"][-1].content)

Multi-Agent System

from agent import root_agent
from google.adk.apps import AdkApp

# Create ADK application
app = AdkApp(agent=root_agent, enable_tracing=True)

# Start interactive session
session = app.create_session(user_id="user123")

# Query the multi-agent system
for event in app.stream_query(
    user_id="user123",
    session_id=session.id,
    message="Research the latest developments in AI safety"
):
    print(event)

πŸ› οΈ Core Components

🎯 Graph Nodes (node.py)

  • State Management: TypedDict-based state handling
  • LLM Integration: GPT-4o with tool binding
  • Message Processing: Conversation flow management

πŸ“Š Workflow Graph (graph.py)

  • StateGraph: LangGraph-based workflow orchestration
  • Tool Integration: Conditional tool usage based on queries
  • Flow Control: START β†’ Chatbot β†’ Tools β†’ END

πŸ› οΈ Research Tools (tools.py)

  • Wikipedia Integration: Real-time knowledge retrieval
  • Arxiv Access: Academic paper search and analysis
  • Configurable Limits: Response length and result count control

πŸ€– Multi-Agent System (agent.py)

  • Google ADK Integration: Enterprise agent framework
  • Sub-Agent Coordination: Specialized agent delegation
  • LangGraph Bridge: Seamless integration between systems

🎯 Use Cases

πŸ”¬ Research Assistant

  • Academic paper analysis and summarization
  • Cross-reference verification with Wikipedia
  • Literature review automation
  • Citation and reference management

πŸ’¬ Intelligent Chatbot

  • Context-aware conversations
  • Multi-turn dialogue handling
  • Domain-specific knowledge queries
  • Real-time information retrieval

🏒 Enterprise Applications

  • Customer support automation
  • Internal knowledge base queries
  • Research and development assistance
  • Decision support systems

πŸ”§ Configuration

Environment Variables

# Required
OPENAI_API_KEY=your_openai_api_key_here

# Optional
LANGCHAIN_TRACING_V2=true
LANGCHAIN_API_KEY=your_langchain_api_key
LANGCHAIN_PROJECT=soojh-ai

Model Configuration

# In llm.py
llm = ChatOpenAI(
    openai_api_key=OPENAI_API_KEY,
    model="gpt-4o",           # Or gpt-4, gpt-3.5-turbo
    temperature=0.1,          # Adjust creativity
    max_tokens=2000          # Response length limit
)

πŸ“š Dependencies

Core Libraries

  • langchain-openai: OpenAI integration
  • langchain-community: Community tools and utilities
  • langgraph: Graph-based workflow orchestration
  • google-adk: Google Agent Development Kit
  • python-dotenv: Environment variable management

Research Tools

  • wikipedia: Wikipedia API wrapper
  • arxiv: Academic paper access
  • pydantic: Data validation and settings

πŸš€ Advanced Features

Custom Agent Creation

from google.adk.agents import Agent
from google.adk.models.lite_llm import LiteLlm

# Create specialized agent
research_agent = Agent(
    model=LiteLlm(model="openai/gpt-4o"),
    name="research_specialist",
    description="Expert in academic research and analysis",
    instruction="Provide detailed, well-sourced research responses",
    tools=[wikipedia_tool, arxiv_tool]
)

Custom Tool Integration

from langchain.tools import BaseTool

class CustomTool(BaseTool):
    name = "custom_research_tool"
    description = "Specialized tool for domain-specific research"
    
    def _run(self, query: str) -> str:
        # Your custom tool implementation
        return f"Custom research result for: {query}"

# Add to tools list
tools.append(CustomTool())

🀝 Contributing

We welcome contributions! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit your changes: git commit -m 'Add amazing feature'
  4. Push to the branch: git push origin feature/amazing-feature
  5. Open a Pull Request

Development Setup

# Install development dependencies
pip install -r requirements-dev.txt

# Run tests
pytest tests/

# Code formatting
black .
isort .

# Type checking
mypy .

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • LangChain Team: For the excellent LangGraph framework
  • Google Cloud: For the Agent Development Kit
  • OpenAI: For the powerful GPT models
  • Arxiv & Wikipedia: For open access to knowledge

πŸ“ž Support


Made with ❀️ by Amrendra Singh

Soojh AI - Where Intelligence Meets Innovation πŸš€ "@ > README.md


This comprehensive README includes:
- Professional branding with badges
- Clear architecture diagram  
- Complete installation guide
- Usage examples for all components
- Detailed project structure
- Advanced configuration options
- Contributing guidelines
- Professional formatting

Copy and paste this command to create your README.md file![1][2][3][4][5]

About

Add an engaging description with emojis and a relevant link in the repository settings. For your LangGraph multi-agent system, consider something like: "πŸ€– Soojh AI - Advanced LangGraph Multi-Agent System with Supervisor Orchestration, Calculator Tools & Context-Free Search πŸ”βœ¨".

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors