---
agent:
  instructions: "Use this search API to find relevant content across this site with keywords or natural-language queries, instead of crawling individual pages. Results are returned in Markdown."
  endpoint: "https://mixpeek.com/.well-known/search?q={query}"
  method: GET
  documentation: "https://mixpeek.com/llms.txt"
---

Agent Perception

18 min read

Updated 2026-06-01

# Retrieval Control Planes for AI Agents: Streaming, Cancellation, and Budgets

A technical guide to the control layer around agent retrieval. Learn why agents need streaming partial results, query cancellation, per-agent budget caps, hybrid search planning, and idempotent writes when searching video, audio, images, and documents.

![Ethan Steininger](/people/ethan.webp)

By [Ethan Steininger](/blog/authors/ethan), Founder & CEO, Mixpeek

Agents

Retrieval

Vector Search

Streaming

Budgets

MVS

[Run this on your own data. Try it as you read.Search your own archive →](https://studio.mixpeek.com/namespaces/create?mode=managed&utm_source=homepage&utm_medium=guide_cta&utm_campaign=mvs_onramp)

[One-click templatesStart from a templateEach template deploys a working search app on your own files.Browse templates](/templates)

## The Problem: Agents Do Not Search Like People

  
  
A human search user usually submits one query, waits for a ranked list, clicks a result, and reformulates only if the answer looks wrong. An AI agent behaves differently.  
  
An agent may issue many related searches inside one task:  
  
1\. Search broadly for candidate evidence. 2. Inspect early hits. 3. Refine the query. 4. Search another modality. 5. Cancel stale work. 6. Fetch neighboring context. 7. Ask for a final rerank. 8. Cite the evidence or call another tool.  
  
That loop changes the retrieval system. The hard part is not only vector similarity. It is controlling a fast, speculative, multi-stage search process without letting latency, cost, or stale work grow out of control.  
  
This guide explains the retrieval control plane: the layer that decides what search work starts, what work stops, what results stream back early, and how much an agent is allowed to spend.  
  

## Data Plane vs Control Plane

  
  
A retrieval system has two distinct layers.  
  
The data plane does the search work:  
  
*   Encode queries.
*   Probe vector indexes.
*   Score BM25 postings.
*   Apply metadata filters.
*   Read payloads.
*   Rerank candidates.
*   Return matches.
  
  
The control plane manages that work:  
  
*   Route each query to the right shards and indexes.
*   Stream partial results as shards respond.
*   Cancel work that is no longer useful.
*   Enforce per-agent budgets.
*   Deduplicate retries.
*   Track consistency after writes.
*   Explain which stages ran and why results were filtered.
  
  
Traditional search systems often hide the control plane because human users rarely need to see it. Agent systems cannot. The control plane becomes part of the agent loop.  
  

## Why Multimodal Retrieval Makes Control Harder

  
  
Text retrieval is already multi-stage in production. Multimodal retrieval adds more axes.  
  
A query like "find the clip where the customer says the setup failed while showing the blinking red light" touches several evidence layers:  
  
*   Transcript search for "setup failed"
*   Visual search for device close-ups
*   Object or attribute detection for red lights
*   Temporal joining so speech and visual evidence overlap
*   Reranking so the final result is one clip, not five disconnected rows
  
  
The agent may not know which evidence layer will work. It will try one, inspect partial results, and choose the next move. That means retrieval needs to be interactive at the stage level.  
  
The system must answer operational questions:  
  
*   Should the transcript stage run before the visual stage?
*   Should low-confidence visual matches be streamed early?
*   Should a slow shard keep running after the agent found enough evidence?
*   How many searches can this agent spend on one task?
*   What happens if the agent retries the same upsert or query?
  
  
These are control-plane questions.  
  

## Streaming Partial Results

  
  
Most distributed search systems fan out a query to multiple shards, wait for every shard, merge the results, and return one response. That works for a user-facing page where consistency of the ranked list matters more than interactivity.  
  
Agents benefit from streaming because they can reason over early evidence.  
  
For example, a video archive query fans out to 40 shards. The first five shards return strong evidence within 80 ms. The slowest shard may take 700 ms because it needs to hydrate cold payloads. A human search UI might wait for the full merge. An agent can use early hits to decide:  
  
*   "I have enough evidence. Cancel the rest."
*   "These are all transcript hits. Start a visual confirmation query."
*   "The results are about the wrong product. Reformulate now."
  
  
Streaming is not just a latency trick. It changes the agent policy. The retriever becomes an observable process rather than a black-box function.  
  

### How Streaming Works

  
  
A typical streaming retrieval path looks like this:  
  
1\. The coordinator receives a query plan. 2. It fans out stage work to shards. 3. Each shard returns local top-k candidates as soon as it has them. 4. The coordinator emits partial result events. 5. The coordinator keeps a running merge heap. 6. The agent receives updates and may continue, refine, or cancel.  
  
The stream should carry structured events, not plain text:

{
  "type": "partial\_results",
  "stage": "visual\_embedding",
  "shard": "shard\_07",
  "results": \[
    {
      "document\_id": "clip\_1842",
      "score": 0.82,
      "timestamp": "00:04:12",
      "evidence": "device close-up with red indicator"
    }
  \],
  "merge\_state": {
    "received\_shards": 5,
    "total\_shards": 40
  }
}

This gives the agent enough information to make a control decision before the final list is complete.  
  

## Query Cancellation

  
  
Agents create stale work. A query can become irrelevant while it is still running because the agent changed its plan.  
  
Common stale-work cases:  
  
*   The agent found sufficient evidence from early results.
*   The user interrupted the task.
*   A better query formulation replaced the previous query.
*   A budget rule says the task must stop.
*   A downstream tool returned a contradiction and the search path changed.
  
  
Cancellation must propagate through the system. It is not enough to stop reading the HTTP response. The coordinator should notify shards, shards should stop scanning or payload reads, and expensive rerankers should drop queued candidates.  
  

### Cooperative Cancellation

  
  
Cancellation is easiest when each stage checks a cancellation token:

def run\_stage(query, cancel\_token):
    for partition in candidate\_partitions(query):
        if cancel\_token.cancelled:
            return StageResult(cancelled=True)

        candidates = search\_partition(partition, query)
        yield candidates

In a vector store, cancellation points usually sit between expensive operations:  
  
*   Before reading another object-storage block
*   Before probing another partition
*   Before fetching payloads
*   Before calling a reranker
*   Before joining another modality
  
  
The goal is not instant termination at every CPU instruction. The goal is bounded wasted work.  
  

## Per-Agent Budgets

  
  
Human search budgets are usually implicit. A user submits a query and the system charges or absorbs the cost.  
  
Agent budgets need to be explicit because agents can loop.  
  
A useful budget model tracks several units:  
  
*   Query count
*   Shard work
*   Bytes read from object storage
*   Reranker calls
*   Embedding calls
*   Write volume
*   Wall-clock task time
  
  
Budgets should attach to an agent identity, API key, session, or task id. The retriever should enforce them before starting work and while work is running.  
  
Example budget policy:

{
  "agent\_id": "support\_triage\_agent",
  "task\_budget": {
    "max\_queries": 20,
    "max\_rerank\_candidates": 500,
    "max\_object\_bytes\_read": 1073741824,
    "max\_wall\_time\_ms": 30000
  }
}

This turns runaway retrieval from an infrastructure surprise into a controlled failure:  
  
*   Return partial evidence.
*   Explain which limit stopped the search.
*   Let the agent decide whether to ask the user for permission to continue.
  
  

## Hybrid Search Planning

  
  
Agent queries often mix fuzzy and exact constraints:  
  
*   "Find videos about charger overheating where the transcript says recall."
*   "Find invoices from Acme with line items over 5000."
*   "Find screenshots of the login page with error code AUTH-429."
  
  
Dense embeddings handle semantic similarity. BM25 handles exact terms. Sparse vectors handle learned lexical expansion. Filters handle structured constraints. A control plane decides how to combine them.  
  
Common planning strategies:  
  

### Parallel Fusion

  
  
Run dense, sparse, and BM25 stages in parallel, then fuse with reciprocal rank fusion or distribution-based score fusion.  
  
Use this when the query is exploratory and recall matters.  
  

### Filter First

  
  
Apply metadata filters before vector search.  
  
Use this when filters are highly selective, such as customer id, date range, file type, or known collection.  
  

### Keyword First

  
  
Run BM25 first, then dense rerank.  
  
Use this when exact strings matter: error codes, product SKUs, legal clauses, names, invoice numbers, or drug codes.  
  

### Dense First

  
  
Run dense vector search first, then structured checks.  
  
Use this when the query is conceptual and exact terms are unreliable.  
  

### Adaptive Planning

  
  
Let the agent or coordinator classify the query before choosing a plan:

def choose\_plan(query):
    if contains\_error\_code(query) or contains\_sku(query):
        return "keyword\_first"
    if has\_strong\_filters(query):
        return "filter\_first"
    if asks\_for\_visual\_or\_audio\_evidence(query):
        return "parallel\_fusion"
    return "dense\_first"

The important point: hybrid search is not one fixed formula. It is a planner.  
  

## Idempotency and Write Consistency

  
  
Agent systems write as well as search. They may upsert observations, add memories, create temporary indexes, or promote retrieved evidence into a working set.  
  
Agents also retry. Network calls time out, tools get interrupted, and orchestration frameworks replay steps.  
  
Without idempotency, retries create duplicate vectors or conflicting payloads. Without write consistency, the agent may search immediately after an upsert and fail to find what it just wrote.  
  
Production retrieval systems should support:  
  
*   Idempotency keys for writes
*   Clear conflict behavior when the same key is reused with a different body
*   Read-after-write expectations for the same namespace
*   Diagnostics when a search cannot see a recent write yet
*   Versioned payloads and model identifiers
  
  
The control plane should be able to say:  
  
*   "This write already succeeded."
*   "This retry conflicts with the original body."
*   "This namespace is still building its payload index."
*   "The filter stage returned no results because the indexed field is missing."
  
  
Those explanations matter because the agent can use them to recover.  
  

## Object Storage Changes the Control Problem

  
  
Object storage is attractive for vector data because it is durable, cheap, and scales naturally. It also changes query execution.  
  
Hot in-memory indexes can assume low-latency random access. Object-storage-backed vector stores have to be more careful:  
  
*   Keep routing metadata small and hot.
*   Avoid fetching payloads before candidates are likely to survive.
*   Use centroids, partitions, or compact codes to prune reads.
*   Cache hot shards or hot blocks.
*   Stream results from shards that finish early.
*   Cancel object reads that no longer matter.
  
  
This is why the control plane matters more, not less, when vectors live on object storage. The system has to decide which bytes are worth reading.  
  

## Tool Contracts for Agents

  
  
Retrieval tools should expose control features directly.  
  
A minimal agent retrieval tool should accept:  
  
*   Query text
*   Modalities to search
*   Filters
*   Top-k
*   Budget
*   Whether streaming is enabled
*   A cancellation handle or task id
*   Required evidence fields
  
  
It should return:  
  
*   Results with source ids
*   Scores and stage provenance
*   Timestamps, page numbers, bounding boxes, or speaker turns
*   Partial result events when streaming
*   Diagnostics
*   Budget usage
*   Follow-up handles for inspection
  
  
Example response shape:

{
  "query\_id": "qry\_9e2",
  "status": "partial",
  "budget\_used": {
    "queries": 3,
    "object\_bytes\_read": 18239488,
    "rerank\_candidates": 120
  },
  "results": \[
    {
      "source": "support\_call\_42.mp4",
      "timestamp": "00:08:31",
      "score": 0.91,
      "matched\_stages": \["transcript", "visual\_embedding"\],
      "why": "Transcript mentions setup failure and frame shows red device indicator"
    }
  \],
  "controls": {
    "cancel\_url": "/retrievers/qry\_9e2/cancel",
    "continue\_url": "/retrievers/qry\_9e2/continue"
  }
}

This is the interface an agent can reason over.  
  

## How This Maps to Mixpeek and MVS

  
  
Mixpeek separates the perception layer from the vector storage layer.  
  
The perception layer decomposes media into searchable observations:  
  
*   Transcripts
*   Scene captions
*   OCR text
*   Detected objects
*   Faces
*   Embeddings
*   Timestamps and source lineage
  
  
MVS stores and searches the vector layer on object storage. It is designed for agent access patterns:  
  
*   Streaming partial results as shards respond
*   Query cancellation for stale agent work
*   Per-agent budget caps
*   Dense, sparse, and BM25 hybrid retrieval
*   Payload filters and diagnostics
*   Write consistency for bring-your-own embeddings and managed ingestion paths
  
  
That means a team can start with their own embeddings in MVS, then add managed extraction when they need video, image, audio, or document perception.  
  
Example agent retrieval flow:

from mixpeek import Mixpeek

mx = Mixpeek(api\_key="YOUR\_API\_KEY", namespace="my-namespace")

results = mx.retrievers.execute(
    "agent-media-search",
    inputs={"query": "clip where the customer says setup failed while the red light is visible"},
)

# The retriever's stages (fused feature\_search channels, then a rerank) and its
# budget limits are configured at retrievers.create time and enforced
# server-side: the agent calls execute and reads the ranked documents.
for hit in results\["documents"\]:
    if hit\["score"\] > 0.9:
        break

The key design is not the SDK call. It is the control loop:  
  
1\. Start a bounded search. 2. Stream early evidence. 3. Let the agent inspect the evidence. 4. Cancel stale work. 5. Spend more budget only when the evidence is insufficient.  
  

## Design Checklist

  
  
Use this checklist when building retrieval for agents:  
  
*   Can search results stream before all shards finish?
*   Can an agent cancel an in-flight query?
*   Are budgets enforced per agent, task, or API key?
*   Does the response include budget usage?
*   Can each result cite source object, timestamp, page, region, or speaker?
*   Are dense, sparse, BM25, and filter stages planned separately?
*   Does the retriever explain empty results and filter failures?
*   Are writes idempotent?
*   Can an agent search immediately after a successful write?
*   Are model versions and feature URIs stored with every vector?
*   Can cold object-storage reads be skipped when early results are good enough?
  
  

## Key Takeaways

  
  
1\. Agent retrieval is a control problem, not just a similarity search problem.  
  
2\. Streaming lets agents reason over early evidence instead of waiting for the slowest shard.  
  
3\. Cancellation prevents stale searches from consuming shard, object-storage, and reranker work.  
  
4\. Budgets make autonomous loops operationally safe.  
  
5\. Hybrid search should be planned per query. Dense, sparse, BM25, and filters each solve different parts of multimodal evidence retrieval.  
  
6\. Object-storage-backed vector stores need strong control planes because every unnecessary byte read is avoidable work.  
  
7\. The best retrieval tools return evidence plus controls: source lineage, stage provenance, diagnostics, budget usage, and cancellation handles.  
  

## Further Reading

  
  
*   [Agentic Retrieval](/guides/agentic-retrieval-how-agents-search-differently)
*   [Multi-Stage Retrieval](/guides/multi-stage-retrieval-how-agents-search-unstructured-data)
*   [Multi-Index Search Architecture](/guides/multi-index-search-architecture)
*   [MCP Tool Design for Multimodal Search](/guides/mcp-tool-design-for-multimodal-search)
*   [MVS](/mvs)

## Run this on your own data

Point Mixpeek at the storage you already have and search your video, images, audio, and documents the way this guide describes. Build starts at $25/mo for up to 1M vectors.

[Search your own archive](https://studio.mixpeek.com/namespaces/create?mode=managed&utm_source=homepage&utm_medium=guide_cta&utm_campaign=mvs_onramp)[Read Docs](/docs)

[Explore MVS](/mvs)[See pricing](/pricing)

## Related guides

[

Agent Perception

### Cross-Encoder Reranking: Why Two-Stage Retrieval Beats One-Stage Search

A technical guide to cross-encoder reranking -- the second stage that makes retrieval precise. Covers bi-encoder vs cross-encoder architecture, why full cross-attention beats independent encoding, score calibration, latency budgets, multimodal reranking, and when to add a reranker to your pipeline.

Read guide →](/guides/cross-encoder-reranking)[

Agent Perception

### Multi-Stage Retrieval: How AI Agents Search Unstructured Data at Scale

Multi-stage retrieval splits search into a cheap first stage that finds a few hundred to a thousand candidates and slower stages that filter and rerank them, so the best match ends up first without scoring the whole corpus with an expensive model. This guide covers candidate generation, reciprocal rank fusion, filtering, cross-encoder reranking and LLM checks for video, image, audio and document search.

Read guide →](/guides/multi-stage-retrieval-how-agents-search-unstructured-data)[

Agent Perception

### Visual Document Retrieval: How AI Agents Search Documents Without OCR

A deep dive into how vision-language models are replacing brittle OCR pipelines for document search. Covers ColPali, ColQwen, late interaction scoring, and production architecture for page-as-image retrieval.

Read guide →](/guides/visual-document-retrieval)