Building an Indic Voice Agent with CUGA
Most useful knowledge is written and digitized in English, while many people who need it speak and think in regional languages such as Hindi, Tamil, Telugu, Gujarati, and Marath...
By AI Engineering Team
Most useful knowledge is written and digitized in English, while many people who need it speak and think in regional languages such as Hindi, Tamil, Telugu, Gujarati, and Marathi. Many users also prefer speaking to typing.
An Indic voice agent can help bridge that gap. This implementation uses CUGA as the agent harness and demonstrates how a voice interface can answer questions in regional languages while grounding its responses in an English agricultural handbook.
The use case: a farm assistant
A farmer asks a question aloud in their own language, such as: How do I distinguish good seed from bad seed? The agent then:
- Listens and converts the speech to text.
- Searches a 154-page agricultural handbook written in English.
- Answers in two to four spoken sentences, using the language of the question and only information from the handbook.
- Speaks the answer and displays the relevant source pages for verification.
If the question concerns cricket or coding, the agent redirects the user to farming rather than generating an unsupported answer.
Where CUGA fits
CUGA, or ConfigUrable Generalist Agent, is IBM Research's open-source agent harness. It manages model wiring, tools, state, and guardrails, allowing an application to define tools and prompts without implementing the full agent loop.
In this application, CUGA is embedded as an SDK in a small web app and provides three main capabilities:
- Model flexibility: A setting can switch between watsonx and OpenAI.
- Knowledge retrieval: The application parses a PDF, divides it into chunks, creates embeddings, and searches it locally with
agent.knowledge.search(). - Conversation isolation: Each question receives a new thread, preventing one user's language or context from carrying over to another.
The central design principle is that CUGA operates as a text-in, text-out system. Voice is added as two thin layers around the agent:
audio ──▶ speech-to-text ──▶ knowledge.search ──▶ CUGA (grounded answer) ──▶ text-to-speech ──▶ audio
This separation makes it possible to build and test the agent with plain text before adding speech input and output. Speech providers can also be changed without modifying the agent itself.
The implementation supports two speech approaches:
- Sarvam AI's cloud speech APIs, called directly from the user's browser.
- Open-source models running on the application's own server, including SraVaani for speech-to-text and Svara for text-to-speech.
The main challenge is cross-lingual retrieval
Speech processing is relatively straightforward. The more difficult problem is cross-lingual retrieval: a Hindi question must retrieve the relevant paragraph from an English document.
Search systems typically convert text into vectors and identify nearby vectors with similar meanings. CUGA's default embedding model is English-only, so Hindi queries produce vectors with little useful semantic information. A Hindi or Tamil question may still retrieve five passages, but they can be unrelated to the question. Because the model is instructed to answer only from the retrieved content, it may correctly respond that the handbook does not cover the subject. Each component works as designed, but the retrieval failure produces no obvious error or warning.
The solution is a multilingual embedding model. This implementation uses intfloat/multilingual-e5-large, allowing equivalent meanings to map to similar vector locations across languages. Integrating the model into CUGA required a small workaround described in the tutorial. Once configured, a single English document can support multiple languages without requiring translated copies.
A practical evaluation step is to ask the agent a question in a non-English language before adjusting its prompt. The first check should be whether the system retrieves the correct pages.
Making responses suitable for speech and maintaining safety
Several implementation details affect the user experience and reliability:
- Write for listening: Markdown, bullet lists, citation tags, and bracketed translations such as “millet (बाजरा)” sound unnatural when read aloud. The prompt asks the model to avoid them, and a lightweight formatter removes any that remain before text-to-speech processing.
- Use inexpensive guardrails: Basic input checks identify obvious off-topic questions. If one passes through, the model begins its response with
OFF_TOPIC, allowing the application to replace it with a polite redirect without making a second LLM call. - Ground every response: The model receives only the retrieved passages and is instructed not to use outside knowledge. The application also shows the source pages to the user.
- Keep keys out of the server: With the Sarvam option, the browser communicates directly with Sarvam. The server receives only text and does not receive the user's key.
Extending the approach beyond farming
The same architecture can support other document-based assistants. Replacing the agricultural handbook with scheme documents, health advisories, or legal guides creates a different domain-specific application. Changing the speech provider can also change the deployment model, such as using cloud services for speed or on-premises infrastructure for data sovereignty, without requiring a rewrite of the agent.
Voice-first, multilingual assistants can make digital services more accessible to people who are poorly served by English-only text interfaces. An open, auditable harness and answers linked to checkable sources provide a basis for evaluating the system's responses.
The approach also relates to IBM Bharat Core, an AI stack built on IBM Sovereign Core for Indic AI workloads on local infrastructure. For deployments that grow from prototypes into secure enterprise applications, such as vernacular KYC systems or multilingual government bots, control over data sovereignty becomes important. CUGA's agent harness can be paired with Bharat Core's Indic connectors and fine-tuned models for applications intended for India's linguistic environment.
CUGA resources
CUGA includes several components and example applications:
- CUGA home page: cuga.dev
- Open-source harness: CUGA on GitHub, released under the Apache 2.0 license
- Documentation: CUGA documentation, covering setup, the SDK, knowledge, policies, and configuration
- Application source: CUGA Apps gallery on GitHub
Example browser-based applications include:
- CUGA Agent: A general-purpose agent using a demo CRM scenario
- CUGA Apps: A dashboard for launching working CUGA applications
- CUGA Policy Playground: Two live agents shown side by side, one with policies and one without