AI-Powered Government Service Assistant with Advanced RAG and Multi-Agent Architecture
city_of_buenos_aires · Government · 2025 · source Agentic: yes · promotional bias: med · source-backed · extracted with prompt 0.5.0 (schema v2)
Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.
Problem
Domain: Government citizen-service assistance
Buenos Aires needed Boti to help citizens navigate more than 1,300 government procedures safely, accurately, and in culturally appropriate Rioplatense Spanish.
Constraints:
- Many procedures are similar and easy for standard RAG to confuse
- The assistant must block harmful, prompt-injection, offensive, or unethical requests
- Responses must preserve Boti's concise public-service voice and local dialect
Architecture
Boti is a LangGraph/Amazon Bedrock assistant fronted by WhatsApp. A user question is sent in parallel to a custom LLM input guardrail and a government procedures agent. If the guardrail blocks the query, graph execution stops and the user is redirected toward procedure questions; otherwise the agent either answers directly or calls a retrieval tool. Retrieval uses comparative summaries in Amazon Bedrock Knowledge Bases, optional LLM reasoning when top retrieval scores are close, and DynamoDB full-procedure documents/metadata before a Bedrock Converse model writes a short Rioplatense Spanish answer.
Diagram confidence: explicit (topology described by the source).
flowchart LR boti-whatsapp-assistant[Boti WhatsApp assistant] --> langgraph-workflow[LangGraph workflow] langgraph-workflow --> input-guardrail-system[Input guardrail system] langgraph-workflow --> government-procedures-agent[Government procedures agent] input-guardrail-system --> bedrock-converse-api[Bedrock Converse API] government-procedures-agent --> reasoning-retriever[Reasoning retriever] government-procedures-agent --> bedrock-converse-api comparative-summary-preprocessor[Comparative summary preprocessor] --> bedrock-knowledge-bases[Bedrock Knowledge Bases] reasoning-retriever --> bedrock-knowledge-bases reasoning-retriever --> dynamodb-procedure-store[DynamoDB procedure store] reasoning-retriever --> bedrock-converse-api dynamodb-procedure-store --> dialect-and-sentiment-prompting[Dialect and sentiment prompting] dialect-and-sentiment-prompting --> government-procedures-agent
Components
| Component | Role | Interacts with |
|---|---|---|
boti-whatsapp-assistant |
Existing WhatsApp citizen-service assistant and user-facing channel for Buenos Aires residents. | langgraph-workflow |
langgraph-workflow |
Orchestrates the parallel guardrail and government-procedures-agent paths, stopping or continuing graph execution based on safety classification. | boti-whatsapp-assistant, input-guardrail-system, government-procedures-agent |
input-guardrail-system |
Custom LLM classifier that approves or blocks requests and provides more detailed content subcategories. | langgraph-workflow, bedrock-converse-api |
government-procedures-agent |
Decides whether to call retrieval, reads returned context, and generates concise Rioplatense Spanish answers. | langgraph-workflow, reasoning-retriever, bedrock-converse-api |
reasoning-retriever |
Three-step retrieval method: retrieve comparative summaries, optionally use LLM reasoning to disambiguate, then retrieve full procedure text. | government-procedures-agent, bedrock-knowledge-bases, dynamodb-procedure-store, bedrock-converse-api |
bedrock-knowledge-bases |
Stores embedded comparative summaries used for semantic retrieval over government procedures. | reasoning-retriever |
dynamodb-procedure-store |
Stores complete procedure documents and metadata, including source URL and sentiment. | reasoning-retriever |
comparative-summary-preprocessor |
Clusters procedure summaries and uses an LLM to append distinguishing descriptions before retrieval. | bedrock-knowledge-bases |
bedrock-converse-api |
Inference access layer for different LLMs across guardrail classification, retrieval reasoning, and answer generation subtasks. | input-guardrail-system, government-procedures-agent, reasoning-retriever |
dialect-and-sentiment-prompting |
Prompt templates and sentiment metadata that preserve Boti voice, local dialect, and more empathetic handling of sensitive topics. | government-procedures-agent, dynamodb-procedure-store |
Data flow
A citizen asks Boti a question in WhatsApp. LangGraph sends the question in parallel to the input guardrail system and the government procedures agent. The guardrail classifies the query as approved or blocked; a blocked result stops graph execution and redirects the citizen. If allowed, the agent either responds directly or calls a retrieval tool. The reasoning retriever first retrieves comparative summaries, optionally invokes an LLM to disambiguate similar procedures, fetches full procedure documents and metadata from DynamoDB, then gives the agent context for answer generation through Bedrock Converse.
4 supporting quotes
Why this architecture
The design separates safety from answer generation and retrieval because a public-sector assistant must avoid harmful content before it generates helpful responses. Standard RAG was not enough for the procedure domain: many government procedures are similar, and most questions require one exact procedure rather than blended chunks. Comparative summaries plus selective LLM reasoning trade extra complexity and cost for higher disambiguation accuracy, while Bedrock Converse lets the team optimize model choice by subtask.
4 supporting quotes
Models used: Claude 3.5 Sonnet · Claude 3 Sonnet · Haiku 3 · Cohere Multilingual embeddings · Titan embeddings
Scale
- Boti already handled more than 3 million conversations per month, so the GenAI layer had to fit a high-traffic public-service channel.“This AI assistant has become a preferred communication channel and facilitates more than 3 million conversations each month.”article, stated
- The assistant targets a large procedure corpus: more than 1,300 government procedures, each with unique logic and exceptions.“The City Government’s website includes over 1,300 government procedures, each of which has its own logic, nuances, and exceptions.”article, stated
- The comparative-summary preprocessor groups procedures into small clusters with an average size of five to make differences explicit.“We clustered the base summaries into small groups, with an average cluster size of 5, and used an LLM to generate descriptions about what made each procedure different from its neighbors.”article, stated
- Retrieval evaluation used 1,908 synthetic questions weighted by procedure webpage visit frequency, indicating the metric was tuned toward likely citizen demand.“We evaluated our reasoning retriever against standard RAG techniques using a synthetic dataset of 1,908 questions derived from known source procedures.”article, stated“The metrics are proportionally weighted based on each procedure’s webpage visit frequency, making sure that our evaluation reflects real-world usage patterns.”article, stated
Alternatives considered (roads not taken)
Amazon Bedrock Guardrails as the primary safety layer
Rejected because: The team needed more flexibility for Rioplatense Spanish and content monitoring, so they built a custom classifier.
Standard chunk-based RAG over procedure sections
Rejected because: Similar procedures and mixed chunks raised the risk of incorrect responses for questions that usually need one exact procedure.
Summary-only embedding retrieval without LLM disambiguation
Rejected because: Summary embeddings improved over section chunks, but reasoning retrievers added another 12.5-17.5% top-k improvement.
One prompt style for every government procedure
Rejected because: Sensitive topics need less emoji and more empathetic language, so sentiment metadata routes to different prompt templates.
Patterns
safety-policy-enforcement (input-guardrails)
A custom LLM classifier blocks harmful or unsafe queries before the procedure agent continues graph execution.
rag-retrieval (reasoning-retrieval)
The assistant retrieves comparative summaries, optionally uses an LLM to disambiguate similar procedures, then fetches complete procedure documents.
tool-use-orchestration (procedure-agent-tools)
The government procedures agent calls a retrieval tool for procedural context and metadata or responds directly when retrieval is not needed.
model-routing (subtask-optimized-inference)
The system uses Bedrock Converse to select different LLMs across guardrail, reasoning, and response subtasks.
eval-driven-development (retrieval-and-dialect-evaluation)
The team evaluated guardrails, retrieval accuracy, and dialect fidelity with synthetic questions, weighted metrics, and subject-matter expert review.
Tradeoffs
Whether to use platform guardrails or a custom guardrail classifier.
Chose custom LLM classifier over Amazon Bedrock Guardrails alone.
Rationale: The team needed more flexibility for Rioplatense Spanish and specific content monitoring.
How to improve procedure retrieval accuracy.
Chose comparative summaries plus optional LLM reasoning over standard chunk or summary embedding RAG only.
Rationale: The reasoning retriever delivered higher top-k accuracy for similar procedure disambiguation.
When to spend extra LLM tokens during retrieval.
Chose run LLM disambiguation only when the first and second retrieval scores are close over always reasoning over every retrieved result.
Rationale: Selective reasoning preserves the accuracy benefit of LLM comparison while limiting latency and token usage on easy queries.
How to keep the assistant culturally appropriate across procedure types.
Chose dialect-specific prompt engineering plus sentiment-routed templates over a generic Spanish assistant style for every query.
Rationale: The source treats local dialect and topic sensitivity as product requirements, so answer generation encodes voseo, concise style, and more empathetic handling of sensitive procedures.
Gotchas (what bit them)
Standard RAG confused similar government procedures.
Root cause: Citizen questions often target a single specific procedure, and related procedures can differ only in subtle requirements.
Resolution: Create comparative summaries that encode what makes each procedure different from nearby procedures.
Custom guardrails can block some legitimate queries.
Root cause: The safety classifier is optimized to catch harmful content and may occasionally over-block normal queries.
Resolution: The system favors safety while monitoring false positives and maintaining procedure-focused redirection.
Retrieval gains come with extra complexity and cost.
Root cause: The reasoning retriever adds comparative-summary preprocessing and optional LLM reasoning beyond standard embedding retrieval.
Resolution: Use the LLM reasoning step only when retrieval scores are too close or procedure disambiguation is needed.
Evaluation
Buenos Aires evaluated harmful-query blocking, retrieval top-k accuracy, visit-frequency-weighted synthetic question performance, and Rioplatense Spanish fidelity via subject-matter experts.
Metrics: harmful query blocking · top-1 retrieval accuracy · top-k retrieval accuracy · voseo accuracy · periphrastic future accuracy · monthly conversations
Outcomes
- Boti handles more than 3 million conversations each month.
- The reasoning retriever achieved up to 98.9% top-1 retrieval accuracy.
- The system improved top-k retrieval accuracy by 12.5-17.5% over standard RAG methods.
The assistant is deployed through WhatsApp, Argentina's widely used messaging channel, and targets more than 1,300 government procedures.