NashTech Blog

Meet AgenticRAG: Asking Meaningful Questions to the AI Agent

Table of Contents
Hi! How may I help you?

Welcome back to our journey to AgenticRAG! The last article, Meet AgenticRAG: Indexing Knowledge using Akka Workflows, provides a step-by-step guide to indexing documents in MongoDB Atlas DB using Akka Workflows.

With the indexing in place, the next step is to wire the embeddings (indexed documents) into a RAG search query. For that we need a class that will provide an abstraction to be used by AskAkkaAgenticAiAgent to make RAG queries.

Add Knowledge Class

This utility will retrieve the relevant content (indexed documents) from MongoDB Atlas and augment the user request (question) with the retrieved content.

Update AskAkkaAgenticAiAgent with Knowledge

The changes done to the AI Agent are:

  1. Inject Knowledge utility
  2. Add knowledge to the question, i.e., retrieve the content and augment the question
  3. Pass the knowledge to the LLM. This will allow the LLM to answer the question meaningfully

Inject Knowledge via Bootstrap

At last, to inject the Knowledge class into AskAkkaAgenticAiAgent, we need to add it via Bootstrap

Lets Ask Question!

1. Set OpenAI API Key as environment variable

2. Start the service locally

3. Use curl/postman to call the Endpoint

The difference between present response and earlier response is – the current response is retrieved from indexed documents in place of from a general LLM.

Next Steps

Now the knowledge index is wired in the AI Agent. However, we are still receiving response(s) in a stream fashion. Due to which the response(s) are visible incrementally. Also, any conversation with an AI Agent via a LLM model is stateless, which makes it difficult to retain the context of an ongoing conversation. To tackle this we will look into UI Endpoints and User Session History in upcoming blog(s), so stay tuned 🙂

Further Reading

Picture of Himanshu Gupta

Himanshu Gupta

Himanshu Gupta is a Principal Architect passionate about building scalable systems, AI‑driven solutions, and high‑impact digital platforms. He enjoys exploring emerging technologies, writing technical articles, and creating accelerators that help teams move faster. Outside of work, he focuses on continuous learning and sharing knowledge with the tech community.

Leave a Comment

Your email address will not be published. Required fields are marked *

Suggested Article

Scroll to Top