Skip to content
Back to Insights

From RAG to Agents: Building a Grounded Assistant on Amazon Bedrock

How we built the assistant on this site – retrieval that keeps it honest, a relevance floor that makes it refuse, and one real tool call that turns a conversation into a booked meeting.

Saurabh Mehrotra
Saurabh Mehrotra
Director at Xpergia

There is an assistant in the corner of this page. It answers questions about our work, declines everything else, and will book a meeting with us on a real calendar if you ask it to. We built it partly because prospects kept asking us questions at 11pm, and partly because we wanted the pattern we recommend to clients running in public where anyone can prod it.

This is how it works, and more usefully, why it is built this way rather than some other way.

The problem with a bare language model on a company website

Point a capable model at your website with a friendly system prompt and you get something that reads well and cannot be trusted. It will describe services you do not offer, because your industry generally offers them. It will quote pricing that sounds plausible. Asked about a technology you have never touched, it will produce a paragraph about your extensive experience with it.

None of this is the model malfunctioning. It is doing exactly what it was trained to do — produce likely text — and “likely” is not the same as “true of this company”. For a consultancy, where the entire proposition is that we know what we are talking about, a confidently wrong assistant is worse than no assistant.

So the design constraint was set before any code: the assistant may only say things we have actually published.

Retrieval, and the floor beneath it

The standard answer is retrieval-augmented generation. Fetch relevant content, put it in the context window, tell the model to answer from it. That is necessary but not sufficient, and the gap is where most implementations fall down.

Here is the failure mode. Someone asks about something you have never written about. Retrieval dutifully returns the four least irrelevant chunks it can find, because a similarity search always returns its top matches — there is no natural “nothing here” result. The model receives some marginally-related text and an instruction to be helpful, and produces an answer that is technically grounded in something and substantively about nothing.

The fix is a relevance floor. Every retrieved chunk carries a similarity score, and anything below a threshold is discarded. If nothing survives, the assistant is told explicitly that no relevant company knowledge was found, and instructed to decline and point the visitor at a person.

That single mechanism does more for trustworthiness than any amount of prompt refinement. It also makes the assistant’s behaviour legible: when it says “I don’t have anything on that”, it is reporting a real state of the system, not performing modesty.

Try it. Ask ours about something we have obviously never done. It will refuse, and it will offer you the contact page instead. That is the design working.

Why the knowledge base is generated, not curated

The obvious way to build the knowledge base is to write one: assemble a folder of documents describing the company, embed them, done. We tried that first and abandoned it within a fortnight.

The problem is drift. The website changes — a new case study, revised service copy, a product repositioned. The hand-written knowledge base does not, because updating it is a separate task that nobody owns. Within a month the assistant is confidently describing a version of the company that no longer exists, and the failure is invisible until a prospect notices.

So the knowledge base is generated from the website’s own content as part of the deploy. Our site content lives as structured markdown; a build step flattens each entry into readable prose and publishes the result to a shared bucket. The assistant polls that bucket, notices new content, and re-embeds.

The consequences are worth spelling out, because this is the part I would most want to steal if I were reading someone else’s write-up:

  • The website is the single source of truth. There is no second copy to maintain, so there is no drift.
  • Publishing is deploying. A new case study becomes answerable within minutes of going live, with no separate release for the assistant.
  • The failure mode is safe. If content generation breaks, the assistant has less to say and says less. It does not start improvising.

This last point is a general principle for agent design: when something breaks, the agent should get quieter, not more creative.

Bedrock, and why the hosting choice is usually the deciding factor

The assistant runs on Claude via Amazon Bedrock. The model choice is mostly about quality of instruction-following — we need something that reliably honours a refusal instruction under pressure, and it does. The hosting choice matters more, and it is the thing clients ask about first.

Through Bedrock, the model call happens inside our own AWS account, in a region we choose, authenticated by an instance role. There is no API key sitting in an environment variable to leak, no third-party account in the data path, and prompts are not used to train anyone’s model. When a client’s data policy says “our data does not leave our tenancy”, this is the answer that gets past their security review — the same pattern works on Azure OpenAI for organisations standardised there.

I would go further: for most enterprise agent projects, where the model runs is a bigger constraint than which model it is. Model quality is converging and swappable. Data residency is contractual.

The one tool that matters

The assistant has one real capability beyond answering: it can book a meeting. It checks genuine availability and writes to a real calendar, entirely server-side.

We deliberately resisted giving it more. There is a strong pull, once you have an agent with tool access, to keep adding tools — it could look up your order, update your preferences, send a summary email. Every one of those sounds useful and every one makes the agent less reliable, because now it has to choose correctly between more options on every turn, and each new tool is a new surface to secure.

One tool, doing the thing that actually converts an interested visitor into a conversation, has been worth more than a menu would have been.

The unglamorous half

Things that are not interesting to write about and are most of why this works in production:

A hardened scope. The system prompt defines what the assistant is for and, explicitly, what it must refuse: general knowledge, coding help, other companies, writing tasks, and any attempt to talk it out of its own instructions. Prompt injection is not hypothetical on a public endpoint; it arrives within days.

Rate limiting. Per IP and per session, sitting behind edge-level protection. A public LLM endpoint is a cost-amplification target — one script can turn your inference budget into someone’s afternoon entertainment.

Short answers by construction. The assistant is instructed to answer in one to three sentences, and the token limit enforces it. Long answers on a website chat widget go unread, and every extra sentence is another chance to say something you did not intend.

Session handling with a sliding expiry. Enough history for the conversation to make sense, bounded so that memory and token costs stay predictable.

Never revealing internals. The assistant declines questions about its own construction. This article exists precisely so that curiosity has somewhere to go that we control.

What we would tell you before you build one

If you are putting a grounded assistant on your own site:

  1. Decide the remit first, in writing. What it is for and what it must refuse. That list is your guardrail specification, not documentation you write afterwards.
  2. Build the relevance floor early. It is the highest-leverage component and it is easy to bolt on late and get wrong.
  3. Generate the knowledge base from content you already maintain. Anything requiring a human to remember to update it will drift.
  4. Assume the endpoint is hostile. Rate limits, injection resistance, and scoped tool credentials from day one.
  5. Give it one action worth taking. Then resist adding a second until the first is demonstrably reliable.

The pattern generalises well beyond a website widget. A support agent grounded in your help centre and ticket history, an internal agent grounded in your runbooks, a procurement agent grounded in your supplier data — same shape: retrieve, refuse when you have nothing, act narrowly, log everything.

The case study on this assistant covers the outcomes, and our agent development page covers how we do this for clients. Or ask the assistant itself — it is right there, and it will tell you when it doesn’t know.

Key Takeaways

  • A relevance floor – declining when retrieval finds nothing – does more for trust than any prompt engineering
  • Generating the knowledge base from the website's own content removes the drift between what the site says and what the assistant says
  • Bedrock keeps model calls inside your own AWS account and region, which is usually the deciding factor for enterprise data policy
  • One well-scoped tool call beats a long list of capabilities the agent might use

Saurabh Mehrotra

Director at Xpergia

Part of the Xpergia team helping enterprises transform through practical AI implementation.

Explore other Articles

Technical

Model Context Protocol in the Enterprise: What It Solves, and What It Doesn't

MCP standardises how agents reach your tools and data, which removes a real integration tax. It does not solve permissions, auditability, or knowing which tools an agent should have.

August 1, 2026 7 min read
Saurabh Mehrotra Director at Xpergia
Read more
Technical

Optimising Neo4J Bulk Import

Lessons from loading billion-node graphs – trading off speed, cost, and data quality. If you've worked with Neo4J's bulk import tool on anything beyond a toy dataset, you'll know that the defaults don't cut it.

February 3, 2023 9 min read
Saurabh Mehrotra Director at Xpergia
Read more
Technical

Generative AI Learning Series: Part 1 - Introduction to Artificial Intelligence

Learn what Artificial Intelligence is, why it became necessary, and how it evolved into Generative AI. Welcome to the first installment of our comprehensive series on Generative AI.

August 13, 2026 10 min read
Vikram K Senior Software Engineer
Read more
Technical

Generative AI Learning Series: Part 2 - Evolution of Artificial Intelligence

Trace the 70-year timeline that led to modern Artificial Intelligence and Generative AI. In Part 1, we established what AI is, cleared up common misconceptions, and defined where Generative AI fits into the grand hierarchy.

August 14, 2026 12 min read
Vikram K Senior Software Engineer
Read more
Technical

Generative AI Learning Series: Part 3 - Understanding Machine Learning

Discover how Machine Learning transforms computing by learning patterns from data, exploring its workflow, paradigms, and interactive simulations. In Part 2, we explored how AI evolved from relying on rigid, handwritten rules (Symbolic AI) to systems that can adapt.

August 18, 2026 12 min read
Vikram K Senior Software Engineer
Read more
Technical

Generative AI Learning Series: Part 4 - Neural Networks Explained

Discover how human biology inspired Deep Learning, and explore the mathematical magic behind artificial neurons and deep networks. In Part 3, we saw how Machine Learning shifted the paradigm from explicitly writing rules to teaching computers via examples.

August 19, 2026 14 min read
Vikram K Senior Software Engineer
Read more
Technical

Generative AI Learning Series: Part 5 - Demystifying the Magic: How Neural Networks Actually Learn

Understand the core mechanics of how modern AI systems actually improve themselves. Imagine giving the same math exam to two students. Student A scores 35/100, while Student B scores 95/100. Student B didn't become better overnight.

August 20, 2026 12 min read
Vikram K Senior Software Engineer
Read more
Technical

Generative AI Learning Series: Part 6 - Why Traditional Neural Networks Were Not Enough

Understand the limitations of early neural networks when dealing with memory, context, and sequential data. So far, we’ve learned how a neural network works. It can identify cats in images, predict house prices, classify spam emails, and recognize handwritten digits.

August 21, 2026 11 min read
Vikram K Senior Software Engineer
Read more
Technical

Generative AI Learning Series: Part 7 - Recurrent Neural Networks (RNNs)

Discover how AI learned to remember the past with Recurrent Neural Networks, unlocking the power of sequential data. "Traditional Neural Networks could recognize patterns, but they had no memory.

August 22, 2026 11 min read
Vikram K Senior Software Engineer
Read more
Technical

Generative AI Learning Series: Part 8 - Long Short-Term Memory (LSTM): Teaching AI What to Remember

Learn how to teach AI what to remember and what to forget using Long Short-Term Memory networks. Welcome back to our Generative AI series! In Part 7, we explored how Recurrent Neural Networks (RNNs) gave AI the gift of memory.

August 24, 2026 13 min read
Vikram K Senior Software Engineer
Read more
Technical

Generative AI Learning Series: Part 9 - Transformers: The Breakthrough That Changed AI Forever

Discover the Transformer architecture, the attention mechanism, and how parallel processing laid the foundation for ChatGPT and modern Generative AI. Welcome back! In [Part 8], we saw how LSTMs gave AI a "smart memory," allowing it to remember important details and forget irrelevant ones.

August 25, 2026 15 min read
Vikram K Senior Software Engineer
Read more
Technical

Generative AI Learning Series: Part 10 - The Complete Transformer Architecture Explained Simply

Discover the inner workings of the Transformer architecture, including Positional Encoding, Encoders, Decoders, and Multi-Head Attention. Welcome back to our beginner-to-advanced Generative AI series!

August 26, 2026 15 min read
Vikram K Senior Software Engineer
Read more
Technical

Generative AI Learning Series: Part 11 - Birth of Generative AI: The Moment AI Started Creating

Discover how Artificial Intelligence transitioned from analyzing data to creating completely new content, and where Generative AI fits in the technology landscape.

August 27, 2026 16 min read
Vikram K Senior Software Engineer
Read more
Technical

Generative AI Learning Series: Part 12 - Large Language Models (LLMs): The Technology Behind ChatGPT, Gemini, and Claude

Understand the core technology powering modern AI assistants, how they learn, and how they generate text. If the Transformer architecture we discussed in Part 10 is the "engine," then a Large Language Model (LLM) is the complete vehicle.

August 28, 2026 14 min read
Vikram K Senior Software Engineer
Read more
Technical

Generative AI Learning Series: Part 13 - Demystifying Prompts, Tokens, Context Windows, Temperature, and Hallucinations

Master the essential inner mechanics of Large Language Models, including prompt engineering, tokenization, context windows, temperature scaling, and hallucinations.

August 31, 2026 15 min read
Vikram K Senior Software Engineer
Read more
Technical

Generative AI Learning Series: Part 14 - Popular Generative AI Models: Understanding What Makes Each Unique

Explore the Generative AI landscape and understand the unique strengths of models like ChatGPT, Gemini, Claude, Midjourney, and more. By this point in the blog series, you've learned: Now it's time to meet the actual AI models that are shaping today's world.

September 1, 2026 12 min read
Vikram K Senior Software Engineer
Read more
Technical

Generative AI Learning Series: Part 15 - Practical Real-World Applications (Part 1)

Discover how Generative AI is transforming healthcare, education, software development, marketing, and everyday life. So far in this series, we've learned what AI is, how it evolved, and the mechanics behind Machine Learning, Deep Learning, Neural Networks, Transformers, and Large Language Models.

September 2, 2026 11 min read
Vikram K Senior Software Engineer
Read more
Technical

Generative AI Learning Series: Part 16 - Practical Real-World Applications (Part 2)

Explore how AI is becoming a universal digital assistant across various professional domains, from lawyers to scientists. In the previous part, we explored how Generative AI is transforming Healthcare, Education, Software Development, Marketing, Customer Support, Finance, Agriculture, Manufacturing,…

September 3, 2026 10 min read
Vikram K Senior Software Engineer
Read more
Technical

Generative AI Learning Series: Part 17 - Prompt Engineering: The Art and Science of Communicating Effectively with AI

Master the most critical skill in the AI era by learning how to craft clear, structured, and effective prompts to get the best possible results from Large Language Models.

September 4, 2026 12 min read
Vikram K Senior Software Engineer
Read more
Technical

Generative AI Learning Series: Part 18 - AI Agents: From Answering Questions to Completing Tasks

Discover the evolution from basic chatbots to autonomous AI Agents that can plan, reason, use tools, and execute complex workflows. So far in this series, we've explored Artificial Intelligence, Machine Learning, Deep Learning, Transformers, Large Language Models, and Prompt Engineering.

September 7, 2026 12 min read
Vikram K Senior Software Engineer
Read more
Technical

Generative AI Learning Series: Part 19 - Challenges and Limitations of Generative AI: Risks, Responsibilities, and Ethical Questions

Explore the risks, ethical challenges, and responsibilities associated with Generative AI, from hallucinations and deepfakes to data privacy. So far, this blog series has focused primarily on the extraordinary capabilities of Generative AI.

September 8, 2026 15 min read
Vikram K Senior Software Engineer
Read more
Technical

Generative AI Learning Series: Part 20 - The Future of Generative AI

Explore where AI is heading and what it means for humanity by diving into Multimodal AI, AGI, ASI, and the future workplace. We have now reached the final part of this series. So far, we've explored: Now let's look ahead. What might AI become over the next decade and beyond?

September 9, 2026 16 min read
Vikram K Senior Software Engineer
Read more
Strategy

What Enterprise AI Agents Actually Are (And What They Aren't)

Everyone is selling AI agents. Very little of what's being sold is an agent. Here's the distinction that decides whether your project delivers or quietly stalls.

July 14, 2026 8 min read
Saurabh Mehrotra Director at Xpergia
Read more
Strategy

Agentic Workflow Automation: Where Agents Beat RPA, and Where They Don't

Rule-based automation is cheaper, faster and more reliable than an AI agent – right up to the point where the input varies. A practical framework for deciding which half of your process belongs to which.

July 28, 2026 7 min read
Saurabh Mehrotra Director at Xpergia
Read more