Managed RAG on Bedrock: What the Knowledge Base Owns
Ingestion, chunking, embedding, and retrieval as one managed pipeline.
Search across all documentation pages
Ingestion, chunking, embedding, and retrieval as one managed pipeline.
Retrieval-Augmented Generation (RAG) means grounding a model's answer in your own documents instead of relying on what it memorized during training. Building that yourself means writing a document loader, a chunker, an embeddings caller, a vector database client, and a retrieval-then-prompt loop. A Bedrock Knowledge Base replaces all of that with one managed resource. This page builds the mental model for what it owns, what you still configure, and which client you reach for at each stage.
Retrieve and building your own prompt.A Knowledge Base is built from three things you provide and one thing AWS runs for you.
You provide: source documents (an S3 bucket is the common case, but web crawlers, Confluence, SharePoint, and Salesforce connectors also exist as Data Source types), an embedding model (a Bedrock embeddings model, referenced by ARN), and a vector store (a place the resulting vectors live - OpenSearch Serverless is the common default, but Aurora PostgreSQL with pgvector, Pinecone, Redis Enterprise Cloud, MongoDB Atlas, and the newer Amazon S3 Vectors are all supported).
AWS runs: the ingestion pipeline that reads your documents, parses them, splits them into chunks, calls the embedding model, and writes vectors into your chosen store. You trigger this with an explicit Ingestion Job rather than it happening automatically on every S3 write.
# --- Python (boto3) ---
import boto3
agent = boto3.client("bedrock-agent", region_name="us-east-1") # control plane
agent_rt = boto3.client("bedrock-agent-runtime", region_name="us-east-1") # data plane
# Once a Knowledge Base exists and has been ingested, querying it is one call:
resp = agent_rt.retrieve(
knowledgeBaseId="ABCD1234",
retrievalQuery={"text": "What is our refund policy?"},
)
print(resp["retrievalResults"][0]["content"]["text"])// --- TypeScript (AWS SDK v3) ---
import { BedrockAgentClient } from "@aws-sdk/client-bedrock-agent"; // control plane
import { BedrockAgentRuntimeClient, RetrieveCommand } from "@aws-sdk/client-bedrock-agent-runtime"; // data plane
const agent = new BedrockAgentClient({ region: "us-east-1" });
const agentRt = new BedrockAgentRuntimeClient({ region: "us-east-1" });
const resp = await agentRt.send(new RetrieveCommand({
knowledgeBaseId: "ABCD1234",
retrievalQuery: { text: "What is our refund policy?" },
}));
console.log(resp.retrievalResults?.[0]?.content?.text);Notice the import already tells the story: two packages, two clients, two jobs.
Control plane - bedrock-agent. This client creates and configures the Knowledge Base itself: CreateKnowledgeBase (name, IAM role, embedding model, vector store config), CreateDataSource (where documents live, plus chunking and parsing strategy), and StartIngestionJob / GetIngestionJob (run and check the pipeline that turns documents into vectors). You touch this client when you stand up or reconfigure a Knowledge Base, and rarely at request time.
Data plane - bedrock-agent-runtime. This client is what your application calls per user request: Retrieve (get ranked passages back, you build the prompt) and RetrieveAndGenerate (get a final, model-generated answer with citations, in one call). This is the client your request handlers import.
Between the two sits the actual pipeline stage sequence:
Retrieve embeds the query and does a similarity search against the store; RetrieveAndGenerate does that and then feeds the results to a Bedrock foundation model.The vector store is a plug-in point, not something the Knowledge Base replaces: OpenSearch Serverless is the common default because AWS manages it end to end, but Aurora PostgreSQL (pgvector) suits teams already running Postgres, Pinecone and MongoDB Atlas suit teams standardized on those platforms, and Amazon S3 Vectors is a newer, cost-oriented native option worth comparing on price and latency for large, less latency-sensitive corpora.
Two design choices ripple through everything else you build on a Knowledge Base.
Chunking and parsing strategy happens once, at ingestion, and is expensive to change later - a new strategy means re-ingesting everything. Get chunk size and overlap right for your document shapes (short FAQ entries vs long contracts) before scaling ingestion.
Retrieve vs RetrieveAndGenerate is a per-request choice, not a Knowledge Base setting. RetrieveAndGenerate is the fastest path to a working RAG answer - one call, managed prompt construction, citations included. Retrieve hands you the raw ranked passages so you can build your own prompt, mix in tool results, or run your own re-ranking - more code, more control.
A newer capability, the agentic retriever, extends this further: instead of a single similarity search, the retrieval step can reformulate a complex question into sub-queries and chain retrieval steps before generation. This is useful for multi-step or comparison-style questions a single vector search answers poorly. It is a fast-evolving 2026 feature - treat exact configuration parameters as something to verify against current bedrock-agent-runtime documentation rather than fixed API surface.
StartIngestionJob; new files sit unindexed until then.bedrock-agent configures the Knowledge Base and bedrock-agent-runtime queries it; mixing them up is the most common first-time error.Retrieve gives you the passages directly for a custom prompt or a non-Bedrock generation step.The embeddings and vector-search pipeline - parsing, chunking, calling an embedding model, storing vectors, and running similarity search - all as one managed resource instead of hand-rolled infrastructure.
bedrock-agent (boto3) or @aws-sdk/client-bedrock-agent (SDK v3) - the control plane. Querying it at request time uses the separate bedrock-agent-runtime client.
No. It is the common default, but Aurora PostgreSQL with pgvector, Pinecone, Redis Enterprise Cloud, MongoDB Atlas, and Amazon S3 Vectors are all supported vector stores.
You do, by calling StartIngestionJob for the relevant Data Source. It is not automatic on every source-document change.
RetrieveAndGenerate for the fastest path to a working answer. Drop to Retrieve when you need control over the final prompt, want to mix in other context, or need a non-Bedrock generation step.
Stack versions: This page was written for boto3 1.43.x (Python 3.10+) and the AWS SDK for JavaScript v3 (Node.js 18+). Bedrock Knowledge Bases' Agentic Retriever is a fast-evolving 2026 capability - verify exact parameters against current docs.
Reviewed by Chris St. John·Last updated Jul 24, 2026