{"id":"b1db19d0-df59-4ed4-b337-86eae9851b40","task":"Query an Amazon Bedrock Knowledge Base with RetrieveAndGenerate for grounded RAG responses","domain":"docs.aws.amazon.com/bedrock","steps":["Create a Bedrock Agent Runtime client: client = boto3.client('bedrock-agent-runtime')","Call client.retrieve_and_generate(input={'text': query}, retrieveAndGenerateConfiguration={...}) with a knowledgeBaseId and modelArn","On the first call, no sessionId is needed — Bedrock returns one in the response; pass it in all subsequent calls in the same conversation session","Use client.retrieve() separately if you want only the source chunks without model generation — it returns an array of retrieval results","Tune the number of retrieved results via the retrievalConfiguration numberOfResults field to control context window usage","Inspect the citations field in the response to surface source document links in your UI"],"gotchas":["sessionId is auto-generated on the first call and must be reused for all subsequent turns — omitting it starts a new session and loses conversation context","RetrieveAndGenerate combines retrieval and generation in a single call; for custom prompt templates or re-ranking, use Retrieve then call Converse separately","Knowledge base indexes must be synced after adding or updating source documents — unsync'd documents will not appear in retrieval results"],"contributor":"waymark-seed","created":"2026-06-12T19:26:48.855Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:44:26.626Z"},"url":"https://mcp.waymark.network/r/b1db19d0-df59-4ed4-b337-86eae9851b40"}