Execute Adhoc Retriever
Execute a retriever ad-hoc without persisting the configuration.
This endpoint allows you to execute a retriever without saving it to the database. Useful for one-time queries, testing configurations, or temporary searches.
Caching: this route does not use the retriever-level execute cache, so
cache_status is always disabled and there is no skip_cache
parameter.
That does NOT mean every response is freshly computed. Individual stages
keep their own caches, which this route cannot switch off, so a stage may
serve a cached result and report cache_hit: true under
stage_statistics.stages[*] on a response whose top-level
cache_status reads disabled. The two fields describe different
caches. If you need a guaranteed fresh execution, persist the retriever
(POST /retrievers) and call /retrievers/{id}/execute with
skip_cache, which this route lacks and which does reach the stages.
Streaming Execution (stream=True): Response uses Server-Sent Events (SSE) format with Content-Type: text/event-stream. Each stage emits events as it executes, formatted as: data: \n\n
Event Types (StreamEventType):
- stage_start: Emitted when a stage begins (includes stage_name, stage_index, total_stages)
- stage_complete: Emitted when a stage finishes (includes documents, statistics, budget_used)
- stage_error: Emitted if a stage fails (includes error message)
- execution_complete: Final event with complete results and pagination
- execution_error: Emitted if entire execution fails
StreamStageEvent Fields:
- event_type: Type of event
- execution_id: Unique execution identifier
- stage_name/stage_index/total_stages: Stage progress info
- documents: Intermediate results (stage_complete only)
- statistics: Stage metrics (duration_ms, input_count, output_count, efficiency)
- budget_used: Cumulative consumption (credits_used, time_elapsed_ms, tokens_used)
Response Headers:
- Content-Type: text/event-stream
- Cache-Control: no-cache
- Connection: keep-alive
- X-Execution-Mode: adhoc
Standard Execution (stream=False, default):
- Returns ExecuteRetrieverResponse after all stages complete
- Includes X-Execution-Mode: adhoc header
- execution_metadata.retriever_persisted = False
Use Cases:
- One-time queries without saving retriever configuration
- Testing stage configurations before persisting
- Dynamic retrieval with varying parameters
- Real-time progress tracking with streaming
Authorizations
Mixpeek API key, sent as Authorization: Bearer mxp_sk_.... Create one in Studio under Settings → API Keys, or with an admin key via POST /v1/organizations/users/{user_email}/api-keys. A missing header returns 403; an invalid or revoked key returns 401.
Namespace id (ns_...), not the namespace name. This scopes the request rather than authenticating it, and it is required on every operation marked x-mixpeek-namespace-scoped.
Body
Request to execute a retriever ad-hoc without persistence.
This combines retriever creation parameters with execution inputs to allow one-time retrieval without saving the retriever configuration.
Use Cases: - One-time queries without polluting retriever registry - Testing retriever configurations before persisting - Dynamic retrieval with varying stage configurations - Temporary search operations
Behavior: - Retriever is NOT saved to database - Execution history is logged but marked as ad-hoc - Response includes X-Execution-Mode: adhoc header - execution_metadata.retriever_persisted = False
Streaming Execution (stream=True): When streaming is enabled, the response uses Server-Sent Events (SSE) format with Content-Type: text/event-stream. Each stage emits events as it executes:
Standard Execution (stream=False, default): Returns a single ExecuteRetrieverResponse with final documents, pagination, and aggregate statistics after all stages complete.
Examples: Simple ad-hoc search: { "collection_identifiers": ["col_123"], "input_schema": {"query": {"type": "text", "required": True}}, "stages": [{ "stage_name": "search", "stage_type": "filter", "config": { "stage_id": "feature_search", "parameters": { "searches": [{ "feature_uri": "mixpeek://text_extractor@v1/embedding", "query": { "input_mode": "text", "text": "{{INPUT.query}}" }, "top_k": 100 }], "final_top_k": 10 } } }], "inputs": {"query": "machine learning"}, "stream": false }
REQUIRED. Ordered list of stage configurations. At least one stage is required for execution.
1Collection identifiers (names or IDs) to query. Can be collection names or IDs. Names are automatically resolved. Can be empty for query-only inference mode (e.g., LLM query analysis without documents). Also accepts 'collection_ids' as an alias for backward compatibility.
OPTIONAL. Input schema defining expected inputs. Each key is an input name, value is a RetrieverInputSchemaField. Omit it (or pass {}) for a stages-only execute whose stages carry hardcoded query values — no dynamic inputs needed.
OPTIONAL. Input values matching the input_schema. These values are passed to stages for parameterization. Omit it (or pass {}) when the stages carry hardcoded query values.
OPTIONAL. Budget limits for execution.
Offset-based pagination using page number sizing.
Best for: Traditional page UIs with page number navigation
How it works:
- Uses page numbers (1, 2, 3...) and page size
- Calculates offset as: (page_number - 1) * page_size
- Simple and familiar for users
- Can jump to any page directly
Tradeoffs:
- Can have "page drift" if data changes between requests
- Example: Items added/deleted causes duplicates or gaps
- Less efficient for large offsets (database must skip N rows)
Use when:
- Building traditional page-numbered UIs
- Users need to jump to specific pages
- Result set is relatively stable
- Working with smaller datasets
Example: Page 1: {"method": "offset", "page_size": 25, "page_number": 1} Page 2: {"method": "offset", "page_size": 25, "page_number": 2}
- OffsetPaginationParams
- CursorPaginationParams
- ScrollPaginationParams
- KeysetPaginationParams
null
DEPRECATED alias for the pagination page size, honored only when 'pagination' is absent — mirrors the by-id execute request. Previously silently ignored on adhoc bodies (BACKE-3445).
1 <= x <= 100null
Enable streaming execution to receive real-time stage updates via Server-Sent Events (SSE). NOT REQUIRED - defaults to False for standard execution.
When stream=True:
- Response Content-Type: text/event-stream
- Events emitted: stage_start, stage_complete, stage_error, execution_complete, execution_error
- Each event is formatted as: data: {json}\n\n
- StreamStageEvent contains: event_type, execution_id, stage_name, stage_index, total_stages, documents (intermediate), statistics, budget_used
When to use streaming:
- Progress tracking for multi-stage pipelines
- Displaying intermediate results as stages complete
- Real-time budget and performance monitoring
- Debugging pipeline execution
When to skip streaming:
- Single-stage or fast pipelines (<100ms)
- No need for intermediate results
- Minimizing overhead is critical
false
true
Response
Successful Response

