This is a sophisticated multi-agent system leveraging LangGraph's Swarm architecture, langSmith and OpenAI to coordinate emergency travel assistance. This system demonstrates advanced agent collaboration for handling complex travel emergencies through specialized AI agents.
- Multi-Agent Collaboration: Specialized agents working together to handle complex emergencies
- Real-time Monitoring: Integration with LangSmith for comprehensive tracing and debugging
- Scenario-based Testing: Pre-built emergency scenarios to test system capabilities
- Fault Tolerance: Built-in retry mechanisms and error handling
- Modular Architecture: Easy to extend with new agents, tools, and scenarios
- Interactive Follow-ups: Ability to ask additional questions and get real-time responses
Note: The project uses inMemoryStore (Short Memory) and MemorySaver (Long Memory). Also LangGraph's swarm architecture can spawn multiple agents simultaneously with each agent maintains its own conversation state so complex scenarios (like my #6) can spawn up to 7-8 agents concurrently and each agent using its own api call. ( Laymans Terms : Scenario 6 will cost you!)
My system includes specialized agents for different aspects of travel emergencies:
Agent | Role | Primary Responsibilities |
---|---|---|
Emergency Coordinator | Central Orchestrator | Triage requests, delegate tasks, coordinate responses |
Medical Evacuation Specialist | Medical Emergency Handler | Assess medical situations, arrange evacuations |
Disaster Response Expert | Natural Disaster Specialist | Handle evacuations, assess disaster impacts |
Security Analyst | Security Expert | Evaluate threats, provide safety guidance |
Documentation Expert | Travel Document Specialist | Handle visa/passport emergencies |
Accommodation Finder | Housing Specialist | Secure emergency accommodation |
Communication Coordinator | Communication Expert | Establish reliable communication channels |
Medical Advisor | Health Consultant | Provide medical guidance and recommendations |
Local Resource Locator | Local Support Specialist | Connect with local emergency services |

The system presents various emergency scenarios for selection, including medical emergencies, security threats, and complex multi-tool scenarios. You can add your own in scenarios/emergency_scenarios.py

The Emergency Coordinator analyzing a complex situation and delegating tasks to specialized agents.

The Medical Advisor providing specific guidance for the executive with a heart condition, including local emergency numbers and facility recommendations, shows a succesfull handoff and a perfect agent tool calling and execution

The Communication Coordinator outlining strategies to locate and contact missing team members with user input ( a Follow up) .

Real-time monitoring of agent interactions and system performance in the LangSmith dashboard.
-
Clone the repository
git clone https://github.com/yourusername/emergency-travel-response.git cd emergency-travel-response
-
Set up virtual environment
python -m venv venv # On Unix/macOS: source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Configure environment variables Create a
.env
file in the root directory:# Required OPENAI_API_KEY=your_openai_api_key # Optional (for LangSmith monitoring) LANGCHAIN_TRACING_V2=true LANGCHAIN_API_KEY=your_langsmith_api_key LANGCHAIN_PROJECT=emergency-travel-response
-
Start the system
python main.py
-
Select a scenario from the available emergency situations:
- Medical emergencies
- Security threats
- Natural disasters
- Documentation emergencies
- Communication crises
- Complex multi-aspect scenarios
-
Follow the interactive prompts to see how the agents handle the situation
- Create an account at LangSmith
- Get your API key from the dashboard
- Add LangSmith environment variables to your
.env
file - Run the system to start collecting data
- Trace Visualization: See the flow of agent interactions
- Performance Metrics: Monitor response times and token usage
- Debug Tools: Analyze agent decision-making processes
- Scenario Analytics: Track performance across different emergency types
agents/
: Contains the definitions of all specialized agentstools/
: Contains the emergency tools implementationutils/
: Contains utility functions and formattingscenarios/
: Contains emergency scenario definitionsmain.py
: The main application entry pointrequirements.txt
: Project dependencies
Add new emergency tools in tools/emergency_tools.py
:
def new_emergency_tool(param1: str, param2: int) -> Dict[str, Any]:
"""
Tool description and documentation
"""
# Tool implementation
return {"result": "tool_output"}
Define new agents in agents/agent_definitions.py
:
new_specialist = create_react_agent(
model,
[tool1, tool2],
prompt="""Agent prompt and instructions""",
name="NewSpecialist"
)
Add scenarios in scenarios/emergency_scenarios.py
:
"new_scenario": {
"name": "Scenario Name",
"description": "Scenario description",
"initial": "Initial situation...",
"followup": "Follow-up development..."
}
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- LangGraph YT Playlist for deeper understanding of framework: https://www.youtube.com/watch?v=5h-JBkySK34&list=PLfaIDFEXuae16n2TWUkKq5PgJ0w6Pkwtg&index=2
- YouTube video on building agent swarms: https://www.youtube.com/watch?v=4oC1ZKa9-Hs
- LangGraph docs : https://langchain-ai.github.io/langgraph/tutorials/introduction/
- Integration with real-world emergency services APIs ( TavilyAPI, SerpAPI for actual accomodations, travel expense)
- Mobile application interface ( Locally Hosted LLMs on Devices (<4B) should be able to fulfill this task perfectly)
- Multi-language support ( If this scales )
- Enhanced security protocols ( Currently has none)
- Automated testing suite
- Performance optimization for large-scale deployments
- Support for multiple LLM providers (OpenRouter, Anthropic, Tavily, etc.) with easy provider switching