Fundamentals
Context Cache
The context cache stores reusable agent context packs for repeated tasks. It is designed for speed and consistency while keeping your application in control of which scopes and tasks are eligible.
Cache Request
const context_pack = await client.agentContext({
scopeIds: [process.env.NEUTRON_SCOPE_ID!],
agentId: "agent_docs",
task: "Answer an integration question",
cachePolicy: {
mode: "prefer_cache",
keyMode: "intent_profile",
ttlSeconds: 600
}
});
Cache Fields
| Field | Purpose |
|---|---|
mode | Controls whether to use, bypass, or refresh cached context. |
keyMode | Controls how similar tasks are grouped for reuse. |
ttlSeconds | Limits how long a cached context pack can be reused. |
scopeIds | Ensures cache entries stay separated by tenant and scope. |
agentId | Keeps context packs specific to an agent’s purpose. |
Freshness
Cached context is best for stable, repeated workflows. Use shorter TTLs for fast-moving data and bypass the cache for sensitive or high-risk actions.
Observability
SDK and API responses can include cache status fields such as hit, miss, stale, or bypassed. Use these fields to track latency, context reuse, and task quality in your own telemetry.