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:

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
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

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
“The process begins when a user submits a question. In parallel, the question is passed to the input guardrail system and government procedures agent.”article, stated
“If triggered, it stops graph execution and redirects the user to ask questions about government procedures. Otherwise, the agent continues to formulate its response.”article, stated
“The agent either calls a retrieval tool, which allows it to obtain relevant context and metadata from government procedures stored in [Amazon Bedrock Knowledge Bases]”article, stated
“After the most relevant procedures are identified, we fetch their complete documents and metadata from an Amazon DynamoDB table.”article, stated

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
“The solution includes two main components: an input guardrail system and a government procedures agent.”article, stated
“Related procedures, such as renewing and reprinting drivers’ licenses, can be difficult to disambiguate. Additionally, each user question typically requires information from one specific procedure.”article, stated
“By applying this reasoning step selectively, we minimize latency and token usage while maintaining high retrieval accuracy.”article, stated
“This API provides access to a wide selection of LLMs, helping us optimize performance and latency across different subtasks.”article, stated

Models used: Claude 3.5 Sonnet · Claude 3 Sonnet · Haiku 3 · Cohere Multilingual embeddings · Titan embeddings

Scale

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.

“Although Amazon Bedrock Guardrails offers one implementation approach with filters for specific words, content, or sensitive information, we developed a custom solution.”article, stated

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.

“The mixture of chunks returned from standard RAG approaches increases the likelihood of generating incorrect responses.”article, stated

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.

“By embedding summaries rather than document text, the retrieval accuracy improved by 7.8–15.8%.”article, implied
“All three reasoning retrievers consistently outperform standard RAG techniques, achieving 12.5–17.5% higher top-k accuracies.”article, stated

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.

“Sensitive topics are directed to prompts with reduced emoji usage and more empathetic language, whereas neutral topics receive standard templates.”article, stated

Patterns

safety-policy-enforcement (input-guardrails)

A custom LLM classifier blocks harmful or unsafe queries before the procedure agent continues graph execution.

“The input guardrail uses a custom LLM classifier to analyze incoming user queries, determining whether to approve or block requests based on their content.”article, stated

rag-retrieval (reasoning-retrieval)

The assistant retrieves comparative summaries, optionally uses an LLM to disambiguate similar procedures, then fetches complete procedure documents.

“This system initially retrieves comparative summaries that disambiguate similar procedures and then applies a large language model (LLM) to select the most relevant results.”article, stated

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.

“Approved requests are handled by the government procedures agent, which retrieves relevant procedural information and generates responses.”article, stated

model-routing (subtask-optimized-inference)

The system uses Bedrock Converse to select different LLMs across guardrail, reasoning, and response subtasks.

“This API provides access to a wide selection of LLMs, helping us optimize performance and latency across different subtasks.”article, stated

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.

“We evaluated our reasoning retriever against standard RAG techniques using a synthetic dataset of 1,908 questions derived from known source procedures.”article, stated

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.

“we developed a custom solution. This provided us greater flexibility to optimize performance for Rioplatense Spanish and monitor specific types of content.”article, stated

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.

“All three reasoning retrievers consistently outperform standard RAG techniques, achieving 12.5–17.5% higher top-k accuracies.”article, stated

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.

“The condition for this step occurs when the ratio of the first and second retrieval scores falls below a threshold value.”article, stated
“By applying this reasoning step selectively, we minimize latency and token usage while maintaining high retrieval accuracy.”article, stated

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.

“The agent uses this information to craft responses in Boti’s characteristic style, delivering short, helpful, and expressive messages in Argentina’s Rioplatense Spanish dialect.”article, stated
“Sensitive topics are directed to prompts with reduced emoji usage and more empathetic language, whereas neutral topics receive standard templates.”article, stated

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.

“used an LLM to generate descriptions about what made each procedure different from its neighbors. We appended the distinguishing descriptions to the base information to create the final summary.”article, stated

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.

“The system successfully blocked 100% of harmful queries, while occasionally flagging normal queries as harmful.”article, stated

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.

“The optional reasoning step is particularly clever from an LLMOps perspective, as it balances accuracy with latency and token usage by only applying expensive LLM reasoning when needed.”summary, implied

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

“Anthropic’s Claude 3.5 Sonnet delivered the highest performance with 98.9% top-1 accuracy.”article, stated
“Subject matter experts found that Boti’s responses were 98% accurate in voseo usage and 92% accurate in periphrastic future usage.”article, stated

Outcomes

The assistant is deployed through WhatsApp, Argentina's widely used messaging channel, and targets more than 1,300 government procedures.

“This AI assistant has become a preferred communication channel and facilitates more than 3 million conversations each month.”article, stated
“The agent achieves up to 98.9% top-1 retrieval accuracy using the reasoning retriever, which marks a 12.5–17.5% improvement over standard retrieval-augmented generation (RAG) methods.”article, stated