Skip to main content
POST
Query Agent Knowledge Base Rag

Headers

x-api-key
string | null

Your API key for programmatic access. Send it in the x-api-key header; you can create and manage keys from the Developers page.

Path Parameters

agent_id
string
required

The id of an agent. This is returned on agent creation.

Example:

"agent_3701k3ttaq12ewp8b7qv5rfyszkz"

Query Parameters

branch_id
string | null

The ID of the branch to use

Example:

"agtbranch_0901k4aafjxxfxt93gd841r7tv5t"

Body

application/json
query
string
required

Query to run against the agent's knowledge base RAG index.

Minimum string length: 1
Example:

"How do I reset my password?"

use_agent_defaults
boolean
default:true

When true (the default), retrieval uses the agent's own RAG settings, reproducing exactly what the agent would retrieve. Set to false to retrieve with neutral default RAG settings instead (the agent's embedding model is always kept, since it determines which vector index exists). Useful for auditing the knowledge base independently of how a particular agent is tuned.

max_documents_length
integer | null

Optional maximum total character length of document chunks returned. Overrides the selected RAG settings for this query only.

Required range: 0 < x <= 50000
max_retrieved_rag_chunks_count
integer | null

Optional maximum number of document chunks retrieved. Overrides the selected RAG settings for this query only.

Required range: 0 < x <= 20

Response

Successful Response

retrieval_query
string
required

Raw query used for retrieval (echoes the request query).

chunks
AgentKnowledgeBaseRagChunkResponseModel · object[]
required

Ranked chunks the agent would retrieve, after distance and length filtering.