Skip to content

shyamkaitha/SMART_LLM_LangGraph

Repository files navigation

SMART-LLM LangGraph Framework

A production-ready multi-agent robot task planning system using Large Language Models (LLMs) and AI2-THOR simulation environment.

🚀 Features

  • 4-Stage Pipeline: Task Decomposition → Allocation → Code Generation → AI2-THOR Execution
  • Real-Time Execution: Direct AI2-THOR integration with real robot simulation
  • LLM Integration: OpenAI and Anthropic API support
  • Metrics Calculation: SR, TC, GCR, EXE, RU metrics from real execution
  • Production Ready: No demo/simulation code - 100% real execution

📋 Requirements

  • Python 3.8+
  • AI2-THOR
  • OpenAI API key or Anthropic API key
  • Required packages (see smartllm_3agent/requirements.txt)

🛠️ Installation

  1. Clone the repository:
git clone <repository-url>
cd SMART_LLM_LangGraph
  1. Install dependencies:
cd smartllm_3agent
pip install -r requirements.txt
  1. Set up environment variables:
cp env.example .env
# Edit .env with your API keys

🎯 Usage

Basic Usage

cd smartllm_3agent
python3 run_llm_langgraph.py --floor-plan 6 --task-id 1

Available Floor Plans

  • FloorPlan6, FloorPlan15, FloorPlan21
  • FloorPlan201, FloorPlan209, FloorPlan303, FloorPlan414

List Available Tasks

python3 run_llm_langgraph.py --floor-plan 6 --list-tasks

🏗️ Architecture

4-Agent Pipeline

  1. Task Decomposition Agent: Breaks down complex tasks into subtasks
  2. Task Allocation Agent: Assigns subtasks to available robots
  3. Code Generation Agent: Generates executable Python code
  4. Execution Agent: Runs code in AI2-THOR environment

Key Components

  • graph/nodes.py - All 4 agents in unified script
  • graph/graph_batch.py - Complete 4-stage pipeline
  • adapters/skills.py - AI2-THOR skill interface
  • adapters/thor_runtime.py - AI2-THOR environment management
  • run_llm_langgraph.py - Main execution script

📊 Metrics

The framework calculates real-time metrics from AI2-THOR execution:

  • SR (Success Rate): Overall task completion success
  • TC (Task Completion): Binary task completion status
  • GCR (Goal Condition Rate): Percentage of goal conditions met
  • EXE (Execution Rate): Successful execution percentage
  • RU (Resource Utilization): Efficiency of resource usage

📁 Project Structure

SMART_LLM_LangGraph/
├── smartllm_3agent/           # Main framework
│   ├── graph/                 # LangGraph components
│   │   ├── nodes.py          # All 4 agents
│   │   ├── graph_batch.py    # 4-stage pipeline
│   │   ├── schemas.py        # Data models
│   │   ├── edges.py          # Routing logic
│   │   └── validators.py     # Validation functions
│   ├── adapters/             # AI2-THOR integration
│   │   ├── skills.py         # Robot skill interface
│   │   └── thor_runtime.py   # Environment management
│   ├── prompts/              # LLM prompt templates
│   ├── scripts/              # Utility scripts
│   ├── data/                 # Training data and examples
│   ├── logs/                 # Execution logs
│   └── run_llm_langgraph.py  # Main runner
├── final_test/               # Test data
├── provided/                 # AI2-THOR integration scripts
└── README.md

🔧 Configuration

Environment Variables (.env)

OPENAI_API_KEY=your_openai_key
ANTHROPIC_API_KEY=your_anthropic_key
LLM_MAX_TOKENS=4000
ENABLE_VISUAL_DISPLAY=true

Robot Configuration

Robots are automatically configured based on task requirements with full skill sets:

  • GoToObject, PickupObject, PutObject
  • OpenObject, CloseObject, SwitchOn, SwitchOff
  • SliceObject, BreakObject, CleanObject, ThrowObject

🧪 Testing

Run benchmark tests:

cd smartllm_3agent/scripts/testing
python3 run_benchmarks.py

📝 Logs

Execution logs are saved to logs/FloorPlan{ID}_{timestamp}/:

  • decomposed_plan.py - Task decomposition results
  • allocated_plan.py - Task allocation results
  • code_plan.py - Generated Python code
  • log.txt - Complete execution log with metrics

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

📄 License

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

🙏 Acknowledgments

  • AI2-THOR team for the simulation environment
  • LangGraph for multi-agent orchestration
  • OpenAI and Anthropic for LLM APIs

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published