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
Known 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
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp