EAí gateway and the city's MCP server
The bridge between citizens on WhatsApp and the city's AI agents.
My role
Second-largest contributor to the gateway, contributor to the MCP server and author of most of the evals and prompts API in 2025.
- 500 → 50 ms
- average latency versus the Python version
- 220
- of my commits on the evals API in 2025
Problem
The EAí assistant takes text and voice messages over WhatsApp. The Python gateway had become a bottleneck, and the agents needed standard access to city tools.
Solution
I worked on the Go rewrite of the gateway. The webhook answers 202 and enqueues to RabbitMQ, and workers call Google Agent Engine or Letta, with voice notes transcribed through Speech v2 first. On the official MCP server I built hybrid token verification (Keycloak JWT or service token), stateless HTTP transport so it runs with multiple replicas, and the web search tool backed by Surkai.
Highlights
- Consumers re-register after a RabbitMQ drop, with backoff retries and dead-lettering.
- MP3, OGG, OPUS, M4A and other formats are transcribed before reaching the agent.
- The citizen data service calls the MCP server to find each person's family health clinic automatically.
- An API to version agent system prompts with history and to run evaluations.
Result
According to the team, average gateway latency dropped from about 500 ms to 50 ms compared with the Python version.