Stores and Tools
Overview
This page covers the shared storage and tool blocks inside global:.
These settings back route-local plugins and router-wide tool behavior.
Key Advantages
- Centralizes shared backing stores instead of repeating them per route.
- Keeps response cache, memory, retrieval, and tool catalogs consistent.
- Lets route-local plugins stay small and focused.
- Makes shared infrastructure dependencies explicit.
What Problem Does It Solve?
Route-local plugins often depend on shared storage or tool state. If those dependencies are configured ad hoc inside each route, the system becomes inconsistent and harder to operate.
These global: blocks solve that by defining shared backing services once.
When to Use
Use these blocks when:
- multiple routes depend on the same response cache or memory backend
- retrieval features need one shared vector store
- the router should expose one shared tool catalog
- backing-store configuration belongs to the whole router rather than one route
Configuration
Response Cache
global:
stores:
response_cache:
backend_type: memory
plugins:
- type: response_cache
configuration:
enabled: true
semantic:
match:
recall: {top_k: 1, min_similarity: 0.8}
The store holds the cache backend. A
response_cache plugin turns caching on: in
global.plugins for every request, or in a decision's plugins for that
decision's requests.
Negation guard
Bi-encoder similarity cannot tell "turn on dark mode" from "turn off dark
mode": opposite-meaning queries often score above the recall's
min_similarity while real paraphrases score below it, so raising the
threshold does not reliably prevent false hits.
Every cache backend therefore applies a lexical guard before it serves a semantic candidate:
- What it catches: negation cues and known antonym swaps in near-identical English token sets.
- What it needs: no model and no setting. It runs for the in-memory, Redis, Valkey, Milvus, Qdrant and hybrid caches.
- What it misses: changes with no cue, word-order-only changes and non-English changes.
Rejections are logged as cache_negation_reject, count as misses, and still
surface the rejected score as cache_similarity in x-vsr-trace. Remote and hybrid
backends reject candidates without an original query and continue checking the
bounded fetched candidate set. The same check also applies to hybrid's Milvus
fallback.
Earlier releases configured it with polarity_guard, including an NLI tier
(nli, lexical+nli) on the in-memory backend. The NLI model is retired and
the router refuses polarity_guard; vllm-sr config migrate removes it.
Memory
The memory store supports three backends: milvus (default), valkey, and qdrant.
A context plugin with a memory source
reads and writes it, in global.plugins for every request or in a decision's
plugins for that decision's requests:
global:
plugins:
- type: context
configuration:
enabled: true
sources:
- type: memory
Milvus backend (default):
global:
stores:
memory:
milvus:
address: milvus:19530
collection: agentic_memory
dimension: 256
Valkey backend (requires Valkey with Search module):
global:
stores:
memory:
backend: valkey
valkey:
host: valkey
port: 6379
dimension: 256
collection_prefix: "mem:"
index_name: mem_idx
metric_type: COSINE
Qdrant backend:
global:
stores:
memory:
backend: qdrant
qdrant:
host: qdrant
port: 6334
collection: agentic_memory
dimension: 256
default_retrieval_limit: 5
default_similarity_threshold: 0.30
All three examples embed with Vela Embedding, which embeddings.default
names, so dimension is one of its sizes: 64, 128, 256, 512 or 768.
- Another model. A store indexed with another model names its deployment
and dimension in an
embeddingblock; see Embeddings. - Any other size makes the Router log
Failed to create memory store: … Memory will be disabled, and run without memory.
The Qdrant example's 0.30 threshold, on plain cosine scores, is a starting point, not a calibrated value. Check unrelated queries and corrected facts before using it with your data.
For full deployment instructions, see:
- Valkey Agentic Memory — Docker, Kubernetes, config reference, tuning, and troubleshooting
- Qdrant — Docker, Kubernetes, config reference, tuning, and troubleshooting
config/runtime/memory/for backend-specific configuration references
query_rewrite.deployment names the openai_chat deployment that rewrites a
query with its conversation before memory search; without it the query is
searched as written. The deployment's limits.max_response_bytes bounds each
rewrite response (1 MiB by default):
global:
model_catalog:
deployments:
rewriter:
provider: openai_chat
endpoint: http://llm.example.com:8000/v1
model: qwen3
stores:
memory:
query_rewrite: {deployment: rewriter}
Hybrid search and reflection
hybrid_mode and reflection.algorithm can be set globally under
global.stores.memory and overridden in a memory source of a decision's
context plugin. The
router refuses to start with any other value, including one set in a recipe's
decisions:
| Field | Accepted values | Default |
|---|---|---|
hybrid_mode | weighted, rrf (exact, lowercase) | weighted |
reflection.algorithm | heuristic, noop | heuristic |
hybrid_mode takes effect only with hybrid_search: true. Older configs that
use hybrid_mode: rerank or algorithm: recency_semantic fail at startup.
Replace them with weighted and heuristic, which is how those values
already ran.
Write path bounds
Automatic persistence first respects the server's restrictions: Memory
enablement, the retention policy, and an explicit store: {auto: false} on the
selected decision's memory source. A Responses request can opt out, but cannot
override them. When policy permits persistence, the value comes from, most
specific first:
- the Responses request's
auto_store; - the decision's value;
global.stores.memory.
Only an omitted value falls back to the next level.
Response handling doesn't wait for persistence. Identity checks and capacity reservation come before the bounded history snapshot, which is taken while the response path still owns the conversation state; protocol encoding and writes then run in the background. Other response-path Replay operations stay synchronous.
Configure global.stores.memory.persistence:
| Field | Meaning | Default |
|---|---|---|
timeout_seconds | Seconds from reservation to timeout, including preparation, queue wait, and writing; 0–9,223,372,036 | 30 |
concurrency | Worker slots, including preparation and writes; 0–64 | 8 |
queue | Reserved attempts waiting for a worker; 0–1024 | 64 |
shutdown_grace_seconds | Seconds to drain writes on reload or shutdown before cancellation; 0–9,223,372,036 | 5 |
Omit a field or set it to 0 to take the default. Negative values and values
above the listed limits fail configuration validation, before workers or queue
storage are allocated. That includes the initial config_source: kubernetes
document, before the controller loads routing CRDs.
Each persistence attempt has these limits:
| Limit | Value |
|---|---|
| Payload: request history, retained Responses history and the current assistant response, counted before think-tag stripping | 1 MiB, shared |
| History items | 256 messages or items |
| Nesting | 32 content levels |
| Structure: history and the current response together | 4096 nodes |
Length checks run before persistence capacity is reserved; text assembly and history copying run only after admission. When an attempt is skipped:
| Outcome | Cause |
|---|---|
skipped / history_too_large, fail_open=true | A limit is exceeded. No capacity is used, and nothing is truncated. |
skipped / memory_info_unavailable, fail_open=true | User identity is missing. |
policy_blocked | The jailbreak or hallucination policy blocked the response. |
Background contexts keep only the span context and tracestate.
For requests with a Router Replay record, accepted attempts reserve capacity
for scheduled and one terminal receipt, protecting both from queue
saturation:
- Receipts can still be lost to storage errors, an expired shutdown drain or a process crash.
- Full capacity rejects new writes with
queue_fullorreceipt_queue_full; retired pools useshutting_down. These stay fail-open and are logged by request ID. - Monitor
llm_plugin_execution_total{plugin_type="memory_persistence", status="rejected"}.
Timeout and cancellation report one terminal outcome even while queued; cancelled jobs do not start. Native embedding calls cannot be interrupted, so active work retains its worker slot and resources until exit. Cancellation does not undo writes already accepted by a backend.
Vector Store
global:
stores:
vector_store:
enabled: true
backend_type: milvus
metadata_store: postgres
Supported backends: memory, milvus, llama_stack, valkey, qdrant.
The uploaded files themselves stay on the Router's disk, in file_storage_dir
(/var/lib/vsr/data by default).
Files on the Router's disk
explains how each deployment keeps that directory writable and how to make it
persistent.
metadata_store controls the registry for vector-store and uploaded-file
metadata. Use postgres for restart-safe local or production-like stacks; the
CLI local runtime will provision Postgres and fill metadata_postgres connection
defaults when metadata_store: postgres is set. Use memory only for ephemeral
local experiments because store and file metadata is lost on router restart.
With embeddings from the model runtime, including Vela Embedding, each new vector store records the identity of the representation that created its vectors:
- Existing stores stay visible, and their uploaded files are kept.
- An incompatible or untagged store returns
409 EMBEDDING_REINDEX_REQUIREDon search or file attach. Create a new vector store and reattach the original uploaded file IDs to generate compatible vectors. - The identity is the Router's. Client metadata cannot replace the
_router_embedding_identityfield. - RAG too. The same check applies to request-time RAG and cached retrieval results.
The llama_stack backend embeds search queries remotely, so it can't be
combined with identity-bound runtime document embeddings. Use memory,
milvus, valkey or qdrant for that. Remote provider identity verification
is a separate capability.
Tools
Tool catalogs belong to decisions, not to global: the select.tools_db_path
of a decision's tools plugin names the catalog its
add mode chooses from.
Data and Security
- Cache, memory, and vector stores can contain prompts, responses, embeddings, retrieved documents, or extracted memories. Configure authentication, encryption, retention, and tenant/user scope for the selected backend.
- Embedding dimensions must match existing collections. Rebuild or migrate an index when the embedding model or dimension changes.
- Tool selection controls what is shown to a model; it does not authorize tool execution. Enforce permissions at the tool service.
- See
complete backend examples
and the full configuration contract in
config/config.yaml.