tan-en-yao's picture
docs: update source for pothole stats
aac90c4
|
Raw
History Blame Contribute Delete
11.4 kB

A newer version of the Gradio SDK is available: 6.28.0

Upgrade
metadata
title: FixMyNeighborhood App
emoji: πŸ™οΈ
colorFrom: blue
colorTo: green
sdk: gradio
sdk_version: 6.0.0
app_file: app.py
pinned: false
tags:
  - mcp-in-action-track-enterprise
  - mcp-in-action-track-consumer
  - mcp-in-action-track-customer
  - mcp-in-action-track-creative
  - agents
  - mcp-client
  - multi-agent
  - smolagents

FixMyNeighborhood - Multi-Agent AI Infrastructure Reporter

MCP 1st Birthday Hackathon Hugging Face Spaces Gradio Claude MCP smolagents License: MIT

Potholes cause thousands of cyclist injuries yearly, and broken streetlights leave most public-housing residents feeling unsafe at night. That's why we built FixMyNeighborhoodβ€”an AI-powered system that makes reporting these problems simple and fast.

FixMyNeighborhood is an autonomous multi-agent AI platform that helps NYC residents report infrastructure problemsβ€”potholes, broken streetlights, blocked drainsβ€”directly to the city. Powered by a Full Multi-Agent Controller (MAC) architecture, it handles the paperwork, follow-ups, and routing automatically.

You simply describe the issueβ€”our AI agents take care of the bureaucracy.

Demo

Watch Demo Video

Social Media

X Post

Architecture Overview

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                        Gradio UI (app.py)                       β”‚
β”‚                   Streaming + Real-time Updates                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚   Security Layer        β”‚
                    β”‚  Rate Limit β”‚ Validationβ”‚
                    β”‚  Prompt Guard β”‚ Masking β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              Autonomous Controller (Claude Sonnet)              β”‚
β”‚                                                                 β”‚
β”‚   FULL AUTONOMY: Plans β†’ Reasons β†’ Delegates β†’ Self-Evaluates  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           β”‚                    β”‚                    β”‚
           β–Ό                    β–Ό                    β–Ό
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚ 🎯 Triage  β”‚       β”‚ πŸ” Researchβ”‚       β”‚ πŸ“‹ Report  β”‚
    β”‚   Agent    β”‚       β”‚   Agent    β”‚       β”‚   Agent    β”‚
    β”‚  (Haiku)   β”‚       β”‚  (Haiku)   β”‚       β”‚  (Haiku)   β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           β”‚                    β”‚                    β”‚
           β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚     MCP Server        β”‚
                    β”‚      (8 Tools)        β”‚
                    β”‚                       β”‚
                    β”‚  Weather.gov (real)   β”‚
                    β”‚  Photon/OSM (real)    β”‚
                    β”‚  NYC Open Data (real) β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Quickstart

1. Run on HuggingFace Spaces

Visit: FixMyNeighborhood Space

2. Local Development

# Clone
git clone https://huggingface.co/spaces/MCP-1st-Birthday/fixmyneighborhood-app
cd fixmyneighborhood-app

# Install
pip install -r requirements.txt

# Configure
export ANTHROPIC_API_KEY=your_key_here

# Run
python app.py

3. Example Session

User: "There's a huge pothole on Broadway near Times Square"

🎯 Triage Agent
  └─ Geocoding Address β†’ βœ“ Manhattan, NYC

πŸ” Research Agent
  └─ Looking Up City Records β†’ RD-MN-0042, 3 complaints
  └─ Checking Nearby Reports β†’ 2 reports (1 open)
  └─ Getting Weather β†’ 45Β°F, Clear

πŸ“‹ Report Agent
  └─ Getting Department Info β†’ DOT (24-48h response)
  └─ Generating PDF Report β†’ πŸ“„ FMN-20251129

---
Report ID: FMN-20251129-001
Priority: Medium
Department: NYC DOT
Expected Response: 24-48 hours

Key Features

Feature Description
Autonomous Controller Claude Sonnet makes ALL decisions - plans, reasons, delegates
3 Specialized Workers Triage, Research, Report agents (Claude Haiku)
8 MCP Tools Real APIs (Weather.gov, Photon, NYC Open Data)
Multi-turn Conversation Controller maintains context across messages
Image Analysis Claude Vision identifies infrastructure issues from photos
Real-time Streaming See agent progress as it happens

MCP Tools

Tool Description Data Source
geo_search_address Geocode addresses to coordinates Photon API (OpenStreetMap)
validate_address Validate NYC addresses NYC GeoSearch API
cityinfra_lookup_asset Look up infrastructure assets NYC Open Data (DOT)
get_nearby_reports Find nearby 311 reports NYC 311 Open Data
weather_get_current Get current weather conditions Weather.gov (NOAA)
get_department_info Get responsible department & SLA NYC 311 SLA Data
pdf_generate_report Generate PDF report ReportLab (local)
sendgrid_send_email Send email notification Resend API

Tech Stack

Component Technology
UI Framework Gradio 6.0
Agent Framework smolagents (HuggingFace)
LLM Provider Anthropic Claude (via LiteLLM)
Controller Model Claude Sonnet 4.5
Worker Models Claude Haiku 4.5
Maps Folium (Leaflet.js)
Tool Protocol Model Context Protocol (MCP)

Security

Layer Protection
Rate Limiting Per-session sliding window (prevents abuse)
Input Validation Length limits, HTML/XSS detection
Prompt Injection Pattern detection for jailbreaks
Cross-User Isolation gr.State per-session (no data leakage)
Output Masking PII anonymization in logs
Error Handling User-friendly messages, no stack traces exposed

Geographic validation is handled by MCP tools (validate_address, geo_search_address) using real NYC APIs.

Project Structure

fixmyneighborhood-app/
β”œβ”€β”€ app.py                    # Gradio UI entry point
β”œβ”€β”€ config.py                 # Environment config
β”‚
β”œβ”€β”€ agents/                   # Multi-agent system
β”‚   β”œβ”€β”€ controller.py         # Autonomous MAC (Claude Sonnet)
β”‚   β”œβ”€β”€ subagents.py          # Worker definitions (Claude Haiku)
β”‚   β”œβ”€β”€ prompts.py            # System prompts
β”‚   β”œβ”€β”€ reasoning.py          # ReasoningTrace for observability
β”‚   └── thought_parser.py     # Parse agent thinking/tool calls
β”‚
β”œβ”€β”€ core/                     # Core utilities
β”‚   β”œβ”€β”€ session.py            # Session management
β”‚   β”œβ”€β”€ events.py             # Event types and handling
β”‚   └── image_analysis.py     # Claude Vision integration
β”‚
β”œβ”€β”€ tools/                    # MCP integration
β”‚   β”œβ”€β”€ mcp_client.py         # MCP server client
β”‚   └── mcp_tools.py          # smolagents tool wrappers
β”‚
β”œβ”€β”€ security/                 # Security layer
β”‚   β”œβ”€β”€ rate_limiter.py       # Per-session rate limiting
β”‚   β”œβ”€β”€ input_validator.py    # Input sanitization
β”‚   β”œβ”€β”€ prompt_guard.py       # Prompt injection detection
β”‚   β”œβ”€β”€ output_masker.py      # PII masking
β”‚   └── error_handler.py      # Friendly error messages
β”‚
β”œβ”€β”€ observability/            # Logging & tracing
β”‚   β”œβ”€β”€ structured_logger.py  # JSON-friendly logging
β”‚   β”œβ”€β”€ decision_tracker.py   # Agent decision tracking
β”‚   └── audit_trail.py        # Request lifecycle audit
β”‚
β”œβ”€β”€ ui/                       # UI utilities
β”‚   β”œβ”€β”€ mapping.py            # Folium map display
β”‚   β”œβ”€β”€ logging.py            # Log capture & parsing
β”‚   β”œβ”€β”€ chat_messages.py      # Chat message formatting
β”‚   └── timeline.py           # Agent execution timeline
β”‚
└── docs/                     # Detailed documentation
    β”œβ”€β”€ architecture.md       # Full architecture details
    β”œβ”€β”€ security.md           # Security deep-dive
    β”œβ”€β”€ ux.md                 # UX & streaming
    └── observability.md      # Logging & tracing

Environment Variables

Variable Required Description
ANTHROPIC_API_KEY Yes Anthropic API key
MCP_SERVER_URL No MCP server URL (defaults to HF Spaces)
GRADIO_THEME No UI theme (default: gstaff/xkcd)

Documentation

Hackathon

Track 2: MCP in Action - Full-autonomous multi-agent system with MCP tools for real-world citizen value.

License

MIT