AWS Builder Center
🛠️ Domain 1 Hands-On: Build a Company Policy RAG Assistant

🛠️ Domain 1 Hands-On: Build a Company Policy RAG Assistant

Build a policy assistant with Amazon Bedrock Knowledge Bases and practice retrieval, citations, metadata filtering, and document updates.

Series: Come Prepare with Me: AWS Certified Generative AI Developer – Professional (4 articles)

  1. …
  2. 3
    🛠️ Domain 1 Hands-On: Build a Company Policy RAG Assistant This article

🛠️ Domain 1 Hands-On: Build a Company Policy RAG Assistant

An employee asks:
“How many days can California employees work remotely?”
A general-purpose AI model does not automatically know your company’s policies. To answer using those documents, the application needs to retrieve relevant information and provide it to the model.
In the previous article, we explored the theory behind Domain 1: Foundation Model Integration, Data Management, and Compliance of the AWS Certified Generative AI Developer – Professional (AIP-C01) exam.
Now, let’s apply those concepts by building a Company Policy RAG Assistant using Amazon Bedrock Knowledge Bases. 🚀

🎯 What We’re Building

Our assistant uses fictional company policies to answer questions about remote work and equipment reimbursement.
Through this project, we’ll explore how to:
  • Prepare documents and metadata.
  • Generate and store embeddings.
  • Retrieve relevant policy passages.
  • Generate answers with source references.
  • Filter documents by location.
  • Refresh the knowledge base after a policy changes.
I built and tested this version in the AWS console. The sample documents, metadata files, screenshots, and detailed setup instructions are available on GitHub.

🏗️ Project Architecture

The solution uses:
  • Amazon S3 to store policy documents and metadata.
  • Amazon Bedrock Knowledge Bases to manage ingestion and retrieval.
  • Amazon Titan Text Embeddings V2 to create document embeddings.
  • Amazon S3 Vectors to store and search the vectors.
  • Amazon Nova Lite 1.0 to generate answers from retrieved information.
There are two main workflows:
Ingestion: Documents → Parsing and chunking → Embeddings → Vector store
Question answering: Question → Retrieve relevant passages → Provide context to Nova Lite → Generate answer with source references
The embedding model helps locate relevant information. The generation model uses that information to compose an answer.
📌 This project uses semantic search. Hybrid search is not implemented in this S3 Vectors setup.

📁 1. Prepare the Documents and Metadata

I created three fictional ExampleCo policies:
  • California Remote Work Policy: Initially allowed up to three remote days per week.
  • Arizona Remote Work Policy: Allowed up to two remote days per week.
  • Equipment Reimbursement Policy: Allowed up to $300 per calendar year, subject to the policy conditions.
The remote-work policies contain similar wording but different allowances. This gives us a useful test: can the assistant find the policy for the correct location?
Each document also has a metadata file containing attributes such as  location ,  category ,  policy_id , and  version .
For example:
remote-work-california.txt
remote-work-california.txt.metadata.json
Metadata helps narrow retrieval and track document versions. The metadata filename must match its document’s full filename, with  .metadata.json  appended.


☁️ 2. Upload the Files to Amazon S3

I uploaded all six files to a  policies/  prefix in an S3 bucket.
The bucket stores the original documents and metadata. The knowledge base accesses these files through its service role.
For your own implementation, use a private bucket and keep public access blocked.


🧩 3. Configure the Knowledge Base

In Amazon Bedrock, I created a knowledge base with a vector store, named  company-policy-kb , and connected the S3 source.
For document processing, I selected:
  • Parsing: Amazon Bedrock default parser.
  • Chunking: Fixed-size.
  • Maximum tokens per chunk: 300.
  • Overlap: 10%.
The parser extracts text, while chunking divides content into pieces that can be retrieved independently.
These are starting settings for the lab. Because our policies are short, each may fit into a single chunk; this dataset does not establish the best chunk size for larger documents.

Next, I selected Titan Text Embeddings V2 and the quick-create option for Amazon S3 Vectors.
An embedding represents content numerically so that the retrieval system can compare a question with document passages based on similarity.


🔄 4. Synchronize the Source

After creating the knowledge base, I selected the data source and ran Sync.
During ingestion, Bedrock processes the documents, creates chunks, generates embeddings, and stores them in the vector index.
I confirmed that synchronization completed successfully before testing.


🔎 5. Test Retrieval First

Before generating answers, I selected Standard retrieval only and asked:
“How many days can California employees work remotely?”
The California policy appeared first and contained the original allowance of three days per week. The Arizona and equipment policies also appeared as lower-ranked results.
Initially, seeing all three documents looked unexpected. However, retrieval returns ranked candidates up to the configured result limit. With such a small dataset, multiple documents can be returned.
The important observation was that the relevant California policy ranked first.

💡 Lesson: Inspect retrieval before troubleshooting generation. If the relevant information is missing from the retrieved context, changing the generation prompt may not fix the problem.

💬 6. Generate Answers and Inspect Citations

I switched to Standard retrieval with answer generation and selected Amazon Nova Lite 1.0.
Then I asked:
“How many days can California employees work remotely, and do they need approval?”
The assistant answered that California employees could work remotely up to three days per week and that manager approval was required.
The response included source-reference markers, connecting the answer to the retrieved information.

A citation improves traceability, but we still need to verify that the answer accurately reflects the referenced content.

🏷️ 7. Filter by Location

Next, I applied a manual metadata filter:
location = California
I left Model generated filter disabled and asked:
“How many days can employees work remotely?”
The assistant returned the California allowance of three days per week.
Notice that the question did not mention California. The filter explicitly narrowed retrieval to documents with the matching location attribute.

💡 Lesson: Mentioning “California” in a question influences relevance. Applying a metadata filter explicitly restricts eligible results.
📌 Filtering is not a complete authorization system. A production application must determine and enforce access permissions using the authenticated user’s identity.

🧪 8. Check How Missing Information Is Handled

A useful assistant should also recognize when its documents cannot answer a question.
I asked:
“How many paid vacation days do employees receive? Use only the supplied policies. If they do not contain the answer, say that you do not have enough information.”
None of the policies defined vacation allowances. The assistant responded that it did not have enough information to answer.

This was the appropriate response for this test. It does not prove that the assistant will always avoid unsupported answers; a broader set of questions would be needed to evaluate that behavior.

📝 9. Update a Policy and Retest

For the final experiment, I changed the California remote-work allowance from three to four days per week.
I uploaded the revised source files, synchronized the knowledge base again, and retested:
“How many days can California employees work remotely?”
The assistant now answered four days per week and continued to mention the manager-approval requirement.

The generation model was not retrained. The answer changed because the retrieval system supplied updated policy information.
💡 Lesson: Replacing a source document and updating its indexed representation are separate steps. A reliable RAG application needs a synchronization strategy.

🎓 What This Project Helps Us Practice

This lab connects several Domain 1 concepts:
  • Data preparation: Organizing documents and metadata.
  • Model roles: Using separate models for embeddings and generation.
  • Vector storage: Indexing content for semantic retrieval.
  • RAG: Supplying external context to a foundation model.
  • Metadata filtering: Narrowing results to relevant policies.
  • Source traceability: Checking references against answers.
  • Data maintenance: Synchronizing changed documents.
  • Validation: Testing retrieval, answers, and missing information.
The biggest takeaway for me was that a RAG assistant needs more than a model that produces a convincing response. It also needs relevant evidence, current documents, and tests that reveal when information is missing.
This project demonstrates selected Domain 1 skills using a small fictional dataset. Model customization, advanced indexing, and production governance require additional study and implementation.

🚀 What’s Next?

We’ve connected the Domain 1 theory to a working RAG flow: prepare information, retrieve relevant passages, generate an answer, and verify the result.
Next, we’ll explore Domain 2: Implementation and Integration, followed by a hands-on project connecting generative AI to tools and workflows.
What would you add to this assistant next—conversation history, a user interface, or permission-aware retrieval?

🔗 Resources

Series: Come Prepare with Me: AWS Certified Generative AI Developer – Professional (4 articles)

  1. …
  2. 3
    🛠️ Domain 1 Hands-On: Build a Company Policy RAG Assistant This article
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article