A multi-agent AI system that helps citizens write clear, formal, well-addressed emails to government officials — anywhere in the world.
Emails sent to the wrong department or tier of government are ignored or never reach the decision-maker.
Missing key details — exact location, duration, prior reports — means officials can't act on the complaint.
Every country has different tiers of government. What's a city issue in London is a state issue in Bavaria.
Writing formal government correspondence takes 15–20 minutes and requires a level of confidence many don't have.
| Agent | Model | Key Responsibility | Tools |
|---|---|---|---|
| Input Agent | Small | Classify intent, extract location, route to specialist | — |
| Complaint Agent | Large | Gather mandatory fields in ≤3 turns; force draft at turn 3 | Web Search |
| Ideas Agent | Large | Research existing programs; analyse tradeoffs; confirm addressee tier | Web Search |
| Email Writer | Large | Generate draft → show for approval → handle revisions with tone support | Web Search |
| Review Agent NEW | Small | Check grammar, tone, structure — every draft, every revision | — |
Pauses graph execution and waits for user input. On resume, the node re-executes from the beginning — mocks and guards must account for this.
Routes based on state: category → complaint/ideas; conversation_complete → email_writer; draft_approved → END or loop back.
Persists full state between interrupts so multi-turn conversations survive page refreshes and server restarts.
except blocks swallowed errorsLangChain's core classes auto-instrument. Every ChatOpenAI, ChatAnthropic, and LangGraph node sends traces automatically.
ideas_agent → web_search (3×) → LLM call → interrupt
email_writer → web_search → LLM call → review_agent → interrupt
Total: 8 LLM calls, 4 search calls, 3.2s, 4,200 tokens
Works for London, Bavaria, NYC, Bangkok, Algiers — detects the right government tier automatically.
Every agent searches the web before responding. Opens with real findings, not generic questions.
Identifies local vs city vs state vs national official. Finds contact details via live search.
Every draft passes through the Review Agent before the user sees it. Grammar, tone, structure — checked silently.
Formal, Assertive, or Diplomatic — choose the right register for your situation.
Open directly in Gmail, default email app, or download as .txt. No copy-paste needed.
Isolated tests for each agent function. No LLM calls. Tests routing logic, state parsing, prompt extraction. Fast — runs in <1s.
Full LangGraph runs with mocked LLMs. 5 global locations × complaint + idea + routing + write-now intent. Covers all agent transitions.
12 real-world cases through live LLMs. LLM-as-judge scores 6 criteria: addressee tier, contact hints, required terms, no wrong locations, tone, specificity.
The system finds officeholder names by searching the web at runtime. This works most of the time, but search results lag reality — a newly elected mayor like Mamdani in NYC may not surface confidently from a live query. Without a curated, up-to-date knowledge base (RAG) of current officeholders, the agent has to hedge: "I cannot confirm the current Mayor from a reliable source."
With RAG: a structured database of officials, updated on each election, would give every query an authoritative ground truth to look up instead of guessing from snippets.
Official contact pages, email addresses, and office structures vary wildly across governments. Some are easy to find; others are buried or missing entirely. The agent can only be as good as the search results it receives.
Every city and state has its own government structure, tier logic, contact conventions, and language. A single generic system tuned for "anywhere in the world" will always produce mediocre results for specific localities.
The right architecture is one deployment per jurisdiction — a city of New York instance, a Bavaria instance — each backed by:
Rather than one global app, the production model is a white-labeled civic portal deployed per city or state — nyc.civicmail.gov, bavaria.civicmail.de — each maintained by the local authority with their own verified data. The AI layer remains shared; the knowledge layer is local.
When agent responses are inconsistent, AI Studio is faster for diagnosis than a Python REPL. Fix the prompt there, then bring it back to code.
LangSmith wasn't an add-on — it caught bugs that were invisible otherwise. In multi-agent systems, silent failures are the norm without tracing.
Focusing on civic emails — not "all emails" — let us build smarter agents. The Complaint Agent knows to ask about prior reports. The Ideas Agent knows to check government tiers.
Applications need to be grounded in proprietary or real-world data to justify the complexity. For generic tasks with no unique context, newer Claude models can handle them directly — no pipeline needed.
105 tests passing · 5 agents · 6 global regions · Full LangSmith tracing
Let's see it in action — then open the floor for questions.