Buckets:
๐ค Language Agent Architecture Pipeline - CA14
๐ Overview
This project implements a comprehensive demonstration of modern language agent architectures, showcasing the evolution from simple tool usage to sophisticated multi-agent collaboration systems. The pipeline includes four key architectures:
- ๐ ReAct (Reasoning + Acting): Grounded reasoning through tool interaction
- ๐ Reflexion: Self-improving agents that learn from failures
- ๐ง HippoRAG: Associative memory networks for complex reasoning
- ๐ Nexus: Multi-agent collaboration and orchestration
๐ Quick Start
Prerequisites
- Python 3.8+
- pip
- Git
Installation & Execution
- Clone and Setup:
git clone <repository-url>
cd CA14
chmod +x run.sh
- Run Complete Pipeline:
./run.sh
This will:
- Create a virtual environment
- Install all dependencies
- Run comprehensive demonstrations of all 4 agent architectures
- Generate performance analysis and visualizations
- Create HTML reports
- Save all results to organized folders
Manual Execution
- Setup Environment:
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
- Run Individual Components:
# Run main pipeline (ReAct only)
python main.py --config config.json --output results/ --verbose
# Run complete demo with all agents
python demo_all_agents.py
# Generate visualizations
python visualize_results.py
๐ Project Structure
CA14/
โโโ src/ # Source code
โ โโโ agents/ # Agent implementations
โ โ โโโ react_agent.py # ReAct implementation
โ โ โโโ reflexion_agent.py # Reflexion implementation
โ โ โโโ hipporag_agent.py # HippoRAG implementation
โ โ โโโ nexus_orchestrator.py # Nexus implementation
โ โโโ core/ # Core systems
โ โ โโโ memory.py # Memory systems
โ โ โโโ communication.py # Communication protocols
โ โ โโโ state_management.py # State management
โ โโโ utils/ # Utilities
โ โโโ llm_interface.py # LLM provider interface
โ โโโ environment.py # Travel environment
โ โโโ evaluation.py # Performance evaluation
โโโ config.json # Configuration file
โโโ requirements.txt # Python dependencies
โโโ main.py # Main execution script
โโโ demo_all_agents.py # Complete demo script
โโโ run.sh # Complete pipeline script
โโโ visualize_results.py # Visualization script
โโโ test_pipeline.py # Test suite
โโโ results/ # Generated results
โโโ logs/ # Execution logs
โโโ data/ # Raw data files
โโโ plots/ # Performance visualizations
โโโ reports/ # HTML reports
โโโ visualizations/ # Chart outputs
โ๏ธ Configuration
The config.json file allows customization of:
- LLM Providers: OpenAI, Anthropic, Local models, Mock
- Agent Parameters: Max steps, temperature, tokens
- Environment Settings: Failure rates, availability thresholds
- Test Cases: Customizable test scenarios
- Output Options: Result formats and visualizations
Example Configuration
{
"llm": {
"primary_provider": "mock",
"fallback_providers": ["local", "mock"],
"openai": {
"model": "gpt-3.5-turbo",
"api_key": null
}
},
"agents": {
"react": {
"max_steps": 10,
"temperature": 0.3
}
}
}
๐งช Testing & Evaluation
Test Cases
The pipeline includes comprehensive test cases covering:
- Simple flight booking
- Complex multi-step trip planning
- Error handling and recovery
- Tool usage optimization
- Multi-agent coordination
Performance Metrics
- Success Rate: Task completion percentage
- Execution Time: Average time per task
- Reasoning Quality: Quality of agent reasoning
- Tool Usage: Efficiency of tool utilization
- Error Analysis: Failure pattern analysis
๐ Results & Visualization
Generated Outputs
- JSON Results: Detailed execution traces and metrics
- Performance Plots: Comparative visualizations
- HTML Reports: Interactive result summaries
- Log Files: Complete execution logs
Viewing Results
- HTML Report: Open
results/reports/index.html - Performance Plots: Check
visualizations/folder - Raw Data: Examine
results/*/demonstration_results.json
๐ง Advanced Usage
Custom Agent Development
from src.agents.react_agent import ReActAgent
from src.utils.llm_interface import LLMInterface
from src.utils.environment import TravelEnvironment
# Initialize components
llm = LLMInterface(primary_provider="mock")
env = TravelEnvironment()
tools = create_travel_tools(env)
# Create agent
agent = ReActAgent(tools=tools, llm_interface=llm)
# Execute task
result = agent.execute("Plan a trip to Paris")
print(f"Success: {result.success}")
print(f"Answer: {result.final_answer}")
Adding New Tools
def custom_tool(param1: str, param2: str) -> str:
"""Custom tool description"""
# Tool implementation
return f"โ
Custom result: {param1} + {param2}"
# Add to tools dictionary
tools["custom_tool"] = custom_tool
๐ Troubleshooting
Common Issues
Import Errors: Ensure all dependencies are installed
pip install -r requirements.txtLLM Provider Issues: Check API keys and network connectivity
export OPENAI_API_KEY="your-key" export ANTHROPIC_API_KEY="your-key"Memory Issues: Reduce batch size or use smaller models
{ "local": { "model_name": "gpt2", "device": "cpu" } }Permission Errors: Ensure script is executable
chmod +x run.sh
Debug Mode
Run with verbose logging:
python main.py --verbose --config config.json
๐ Theoretical Background
ReAct Framework
- Paper: "ReAct: Synergizing Reasoning and Acting in Language Models"
- Key Innovation: Interleaving reasoning and acting in a loop
- Advantages: Interpretable, grounded reasoning
Reflexion Architecture
- Paper: "Reflexion: Language Agents with Verbal Reinforcement Learning"
- Key Innovation: Self-improvement through reflection
- Advantages: Learning from failures, iterative improvement
HippoRAG System
- Paper: "HippoRAG: Neurobiologically Inspired Long-Term Associative Memory"
- Key Innovation: Dual-memory architecture (neocortex + hippocampus)
- Advantages: Multi-hop reasoning, associative connections
Nexus Framework
- Concept: Hierarchical multi-agent collaboration
- Key Innovation: Specialized agents with intelligent coordination
- Advantages: Scalability, fault tolerance, specialization
๐ฏ Key Features
โ What Works
- Complete Agent Implementations: All 4 architectures fully implemented
- Comprehensive Testing: Multiple test scenarios for each agent
- Performance Visualization: Charts and graphs for analysis
- HTML Reports: Interactive result summaries
- Mock LLM Provider: Works without external API keys
- Travel Environment: Realistic simulation environment
- Memory Systems: Episodic, semantic, and associative memory
- Multi-Agent Communication: Message passing and coordination
๐ง Current Limitations
- Mock LLM Only: Real LLM providers require API keys
- Limited Domain: Currently focused on travel planning
- Simple Environment: Simulated rather than real-world APIs
- Basic Evaluation: Could benefit from more sophisticated metrics
๐ Performance Results
Based on recent test runs:
- ReAct Agent: 100% success rate, ~0.25s average execution time
- Reflexion Agent: 100% success rate, self-improvement demonstrated
- HippoRAG Agent: 90%+ confidence scores, associative reasoning working
- Nexus Multi-Agent: 100% success rate, effective coordination
๐ Future Enhancements
- Real LLM Integration: Add support for OpenAI GPT-4, Claude, etc.
- Extended Domains: Support for more complex planning scenarios
- Advanced Memory: Implement more sophisticated memory systems
- Performance Optimization: Improve execution speed and efficiency
- Production Deployment: Add Docker support and cloud deployment
- Enhanced Evaluation: Add more sophisticated performance metrics
๐ค Contributing
- Fork the repository
- Create a feature branch
- Implement your changes
- Add tests and documentation
- Submit a pull request
๐ License
This project is part of the Advanced AI Systems Course and is intended for educational purposes.
๐ Acknowledgments
- OpenAI for GPT models
- Anthropic for Claude models
- Hugging Face for Transformers library
- The research community for foundational papers
๐ Support
For questions or issues:
- Create an issue in the repository
- Check the troubleshooting section
- Review the logs in
results/logs/
Note: This implementation is designed for educational and research purposes. For production use, additional security, scalability, and reliability measures should be implemented.
๐ Quick Demo
To see the pipeline in action immediately:
# Clone and run
git clone <repo-url>
cd CA14
chmod +x run.sh
./run.sh
# Open results
open results/reports/index.html
The entire pipeline will complete in under 2 minutes and generate comprehensive results showing all four agent architectures in action!
Xet Storage Details
- Size:
- 9.96 kB
- Xet hash:
- 26cbf930cf1cc2844c815f0b01f213dbbb70ef081ddd984381e601448217cb11
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.