Skip to main content

Search

The search endpoints provide unified retrieval across multiple knowledge bases, combining semantic vector search, image similarity, and knowledge graph context.
All API requests require a valid JWT token in the Authorization: Bearer <token> header. The API Gateway decodes the JWT and forwards auth context (user-id, organization-id, user-email, x-platform-role, x-org-role) as headers to downstream services.
This endpoint incurs provider cost and records a billing event via record_external_cost_event(). Credits are deducted from the organization’s wallet based on the configured margin multiplier.
Search across one or more knowledge bases using text queries, images, and/or file content. This is the primary search endpoint used by both the manual search UI and the agent RAG pipeline.

Request Body

string[]
required
Array of KB UUIDs to search across. Must be non-empty.
string
Text search query. At least one of query, images, or files must be provided.
object[]
Image inputs for visual similarity search.
object[]
File content for text-based search.
number
Maximum number of results to return. Default varies by context.

Query Parameters

string
Search source: manual (user-initiated) or agent_rag (automated by agent during chat).
string
Agent UUID (for RAG attribution in search logs).
string
Conversation UUID (for RAG attribution).
string
Message UUID (for RAG attribution).

Response (200)

object[]
Ranked search results from all queried KBs.
string[]
AI-suggested follow-up queries based on the results.

Search Pipeline

The unified search orchestrates multiple discovery methods in parallel:
  1. Semantic search: Embed the query using Gemini Embedding 2, then vector search across all specified KBs
  2. Image search: If images are provided, embed them and search for visually similar content
  3. Graph-informed discovery: Use the knowledge graph to find related documents through entity relationships
  4. Merge and deduplicate: Combine results from all methods, deduplicate, and rank by combined score
  5. Tag discovery methods: Each result is tagged with how it was found (semantic, image, graph)

Search the knowledge graph for entities and relationships matching a query. Returns structured entity data with relationship context.

Path Parameters

string
required
KB UUID.

Request Body

string
required
Search query for entity matching.
string
Optional base64-encoded image for visual entity matching.
string
MIME type of the image (required if imageBase64 is provided).

Response (200)

string
The original query.
object[]
Matched entities.
object[]
Relationships between matched entities.
string
Human-readable context string for LLM consumption.
string[]
Names of entities directly matched by the query.

KB Document Map

Get the document registry for a knowledge base, including summaries and topics for each document. Used by agents for document awareness.

Path Parameters

string
required
KB UUID.

Response (200)

string
KB UUID.
string
KB name.
number
Number of documents.
object[]
Document registry entries.
curl

Search Logs

Get Search History

Get paginated search log history for a knowledge base.

Path Parameters

string
required
KB UUID.

Clear Search History

Clear all search log entries for a knowledge base.