Inspiration

Urban governance across many modern cities is frequently slowed down by manual complaint triage, unorganized citizen reports, and isolated departmental silos. When a citizen reports a pothole, water leak, or street light failure, complaints often sit in generic queues or lack clear root-cause analysis—leading to delayed fixes and frustrated residents.

We created CivicMind to transform urban management into a proactive, intelligent system. We were inspired to build a multi-agent AI framework that doesn't just store complaints, but actively inspects, prioritizes, budget-estimates, and links cross-departmental infrastructure failures in real time.


What It Does

CivicMind is an AI-powered civic intelligence platform driven by an orchestrated multi-agent network:

  • Agent 1 (Classification): Scans incoming issues and image uploads for immediate safety risks, fast-tracking life-threatening emergencies directly to high-priority dispatch portals.
  • Agent 2 (Intake): Parses location context, severity scores, and specific problem details, automatically assigning issues to appropriate departments (Roads, Water, Electricity).
  • Agent 3 (Intelligence): Evaluates underlying infrastructure root causes and constructs a Cross-Department Intelligence Graph to group related collateral damage across sectors.
  • Agent 5 (Prioritization & Budget): Computes priority scores based on traffic and population impact while calculating instant pre-approved budget bounds and SLA resolution targets.
  • Agent 4 (Explainability): Generates clear, human-readable diagnostic explanations for citizens and city officials.
  • Agent 8 (Self-Correction Guardrail): Audits and auto-heals output dictionary schemas in the background before database persistence, ensuring zero system crashes and high data fidelity.

Citizens can stream real-time agent execution telemetry live on screen as they submit complaints, track updates, and query the system using our intelligent assistant. Officials gain access to a unified dashboard featuring emergency alert banners, deduplicated queue metrics, department pie chart breakdowns, and cross-departmental dependency graphs.


How We Built It

  • Backend Architecture: Built with Python and FastAPI, serving both structured JSON REST endpoints and Server-Sent Events (SSE) streaming connections (/api/complaints/submit-stream).
  • AI Core: Integrated Google Gemini for multi-agent reasoning, diagnostic generation, and vision-based complaint intake.
  • Database & Storage: Powered by Firebase Firestore for real-time document persistence and telemetry tracking.
  • Frontend UI: Built using React, Lucide Icons, and Recharts to deliver a responsive dashboard featuring live SSE stream terminals, department pie charts, and graph visualizers.
  • Self-Correction Guardrails: Engineered custom asynchronous reflection wrappers that dynamically detect schema anomalies or generic template fallbacks, re-prompting the LLM to self-heal output payloads on the fly.

Challenges We Faced

  1. Handling LLM Response Inconsistencies: LLMs occasionally output truncated JSON or fall back on dry templates like "Requires manual investigation". We overcame this by building Agent 8 (Self-Correction), an active guardrail layer that validates schema compliance and forces detailed diagnostic reasoning before persisting records.
  2. Real-Time Pipeline Telemetry: Streaming multi-agent intermediate steps to the frontend without blocking server operations required setting up an SSE stream pipeline in FastAPI that yields agent execution events sequentially.
  3. Cross-Department Graph Mapping: Linking isolated complaints into unified infrastructure root-cause hubs required designing robust node and edge mapping logic that filters out single isolated tickets while retaining complex multi-sector intersections.

What We Learned

  • Multi-Agent Orchestration: Designing independent agents with specialized scopes yields far more accurate results than relying on a single monolith prompt.
  • Defensive Guardrail Design: Building self-correction loops at the API boundary dramatically increases backend reliability when building LLM-powered applications.
  • Real-Time UX Design: Exposing intermediate AI reasoning via live stream telemetry significantly increases user trust and engagement during multi-step processing workflows.

What's Next for CivicMind

  • IoT Sensor Integration: Connect smart city water flow sensors and traffic cameras directly to the triage pipeline for automated incident generation.
  • Geospatial Mapping: Expand cross-department graphs onto interactive Mapbox maps with heatmaps for localized infrastructure risk planning.
  • Predictive Maintenance: Utilize multi-year historical complaint clusters to forecast asset failure risks before major pipeline fractures or road collapses occur.

Built With

Share this project:

Updates