How nohithadachepalli/policy_drift_agent works
Policy Drift Agent compares submitted operational cases with written SOPs, recalls historical outcomes, and produces evidence-backed recommendations for human review. The primary flow runs from case submission through policy comparison, memory recall, analysis, and a recommendation; recorded decisions and outcomes enrich persistent memory. The README documents additional policy, dashboard, insights, timeline, and demo capabilities. Some route and frontend wiring is inferred from documented responsibilities because those source excerpts were not sampled.
Main entry points: api.ts REST API client · main.py FastAPI application · cases.py Case endpoints · hindsight_service.py Persistent memory client
Components 22
Web application
- App shell
frontend/src/App.tsx - Case submission
frontend/src/pages/AnalyzeCasePage.tsx - Recommendation review
frontend/src/pages/RecommendationView.tsx - Policy library and detail
frontend/src/pages/PolicyLibraryPage.tsx - Dashboard
frontend/src/pages/DashboardPage.tsx - Memory, insights, demo
frontend/src/pages/MemoryTimelinePage.tsx - REST API client
frontend/src/services/api.ts
API surface
- FastAPI application
backend/app/main.py - Case endpoints
backend/app/routes/cases.py - Policy endpoints
backend/app/routes/policies.py - Memory endpoints
backend/app/routes/memory.py - Insights and dashboard endpoints
backend/app/routes/insights.py - Demo endpoints
backend/app/routes/demo.py
Policy analysis
- Case analysis orchestrator
backend/app/services/analysis_service.py - SOP comparison
backend/app/services/policy_service.py - SOP definitions
backend/app/models/database.py - LLM reasoning client
backend/app/services/groq_service.py
Memory and learning
- Drift metrics and insights
backend/app/services/insight_service.py - Persistent memory client
backend/app/services/hindsight_service.py
Other components
- Operations user
- Hindsight Cloud
- Groq API
Connections 33
- Operations user → App shell: uses
- App shell → Case submission: shows
- App shell → Policy library and detail: shows
- App shell → Dashboard: shows
- App shell → Memory, insights, demo: shows
- Case submission → REST API client: submits case
- REST API client → FastAPI application: REST requests
- FastAPI application → Case endpoints: dispatches
- FastAPI application → Policy endpoints: dispatches
- FastAPI application → Memory endpoints: dispatches
- FastAPI application → Insights and dashboard endpoints: dispatches
- FastAPI application → Demo endpoints: dispatches
- Case endpoints → Case analysis orchestrator: analyzes case
- Case analysis orchestrator → SOP comparison: compares steps
- SOP comparison → SOP definitions: reads SOPs
- Case analysis orchestrator → Persistent memory client: recalls cases
- Case analysis orchestrator → LLM reasoning client: requests reasoning
- LLM reasoning client → Groq API: completion request
- Persistent memory client → Hindsight Cloud: recall and retain
- Case analysis orchestrator → Case endpoints: returns recommendation
- Case endpoints → Recommendation review: returns result
- Recommendation review → REST API client: records decision
- REST API client → Case endpoints: decision request
- Case endpoints → Persistent memory client: retains outcome
- Policy endpoints → SOP definitions: reads policies
- Insights and dashboard endpoints → Drift metrics and insights: requests metrics
- Drift metrics and insights → SOP definitions: reads policy data
- Drift metrics and insights → Persistent memory client: loads experiences
- Memory endpoints → Persistent memory client: manages memories
- Demo endpoints → Persistent memory client: runs demo memory
- REST API client → Policy endpoints: fetches policies
- REST API client → Insights and dashboard endpoints: fetches summaries
- REST API client → Memory endpoints: fetches timeline