Retrieve Knowledge Base
Embed query and return the top-k matching chunks from the KB.
Auth: write:agents. Chunks are customer data, same threat
model as /agents/{id}/logs.
Tenant scoping: a kb_id from another tenant returns 404 just
like the read endpoint — no existence leak.
Rate limit: BUCKET_KB_RETRIEVAL at 30 req/min/tenant — same
budget as the other outbound-call endpoints (MCP discovery,
validate-llm, models-live).
Dual-surface model: this endpoint is one of three KB retrieval
paths. The Java agent runtime queries Pinecone directly at deploy
time via its own mirror (off the hot path through this BE); the
streamkap-tools MCP server exposes streamkap_kb_retrieve and
proxies through this endpoint for third-party agents.
POST
/knowledge-bases/{kb_id}/retrieveAuthorization
AuthorizationBearer token · headerrequiredPath parameters
kb_idstringrequiredRequest body
requiredapplication/jsonquerystringrequiredmin length 1 · max length 4096
top_kintegermin 1 · max 50 · default: 5
Responses
200
Successful Response
matchesKbRetrieveMatch[]requiredShow propertiesHide properties
Array of
KbRetrieveMatchchunk_idstringrequiredtextstring | nullShow propertiesHide properties
Any of:
string
stringnull
nullscorenumberrequiredmetadataobject | nullShow propertiesHide properties
Any of:
object
objectnull
null422
Validation Error
detailValidationError[]Show propertiesHide properties
Array of
ValidationErrorlocstring | integer[]requiredShow propertiesHide properties
Array of
string | integerAny of:
string
stringinteger
integermsgstringrequiredtypestringrequiredinputanyctxobject