How vikas9892/weather-agent works
Outdoor Safety Agent accepts a chat query, carries session context, resolves the location, retrieves live weather, evaluates deterministic SOP policies, resolves conflicts, applies a safety gate, generates an explanation, and validates it before returning the result. The graph preserves the README’s documented fallback branches and separates weather, policy, safety, and response responsibilities. Workflow relationships are cited to the README; source-index evidence supports the internal calls shown. Unsampled implementation details are not inferred.
Main entry points: graph.py LangGraph workflow · weather/gateway.py Weather gateway · policy.py SOP matching · llm/gateway.py LLM gateway
Components 25
Chat and orchestration
- Chat API
app/api/chat.py - LangGraph workflow
app/graph/graph.py - Workflow state
app/graph/state.py - Session memory
app/memory/session.py - Query understanding
app/graph/nodes/understand.py
Weather telemetry
- Location resolution
app/graph/nodes/weather.py - Weather retrieval
app/graph/nodes/weather.py - Weather gateway
app/weather/gateway.py - Weather data model
app/weather/models.py - Open-Meteo provider
app/weather/providers/open_meteo.py - Fallback providers
app/weather/providers/open_weather.py
SOP policy engine
- SOP matching
app/graph/nodes/policy.py - Policy registry
app/policy/registry.py - Rule evaluator
app/policy/evaluator.py - Conflict resolver
app/policy/resolver.py
Safety and response
- Generation gate
app/graph/nodes/safety.py - Safety gate
app/safety/gate.py - Response generation
app/graph/nodes/response.py - LLM gateway
app/llm/gateway.py - Response validator
app/safety/validator.py
External interfaces
- Weather services
- MCP weather tools
mcp/weather_server/tools.py - MCP weather server
mcp/weather_server/server.py - LLM provider
Other components
- User
Connections 25
- User → Chat API: submits query
- Chat API → LangGraph workflow: starts workflow
app/api/chat.py - LangGraph workflow → Session memory: loads and persists
app/graph/graph.py - LangGraph workflow → Query understanding: runs
app/graph/graph.py - Query understanding → LLM gateway: interprets query
app/graph/nodes/understand.py - LangGraph workflow → Location resolution: resolves location
app/graph/graph.py - LangGraph workflow → Weather retrieval: fetches weather
app/graph/graph.py - Weather retrieval → Weather gateway: requests weather
app/graph/nodes/weather.py - Weather gateway → Open-Meteo provider: queries primary
app/weather/gateway.py - Weather gateway → Fallback providers: uses fallback
app/weather/gateway.py - Weather gateway → Weather services: queries provider
- LangGraph workflow → SOP matching: matches SOPs
app/graph/graph.py - SOP matching → Policy registry: selects policies
app/graph/nodes/policy.py - Policy registry → Rule evaluator: provides rules for
- SOP matching → Rule evaluator: evaluates conditions
app/graph/nodes/policy.py - LangGraph workflow → Conflict resolver: resolves conflicts
app/graph/graph.py - LangGraph workflow → Generation gate: checks generation
app/graph/graph.py - Generation gate → Safety gate: evaluates evidence
app/graph/nodes/safety.py - LangGraph workflow → Response generation: generates response
app/graph/graph.py - Response generation → LLM gateway: requests explanation
app/graph/nodes/response.py - LLM gateway → LLM provider: calls model
- LangGraph workflow → Response validator: audits response
app/graph/graph.py - LangGraph workflow → Workflow state: propagates state
app/graph/graph.py - MCP weather server → MCP weather tools: dispatches tools
mcp/weather_server/server.py - MCP weather tools → Weather gateway: uses gateway
mcp/weather_server/tools.py