Caching and freshness
Pipeworx caches tool results at the gateway with per-tool TTLs. Agents see the cache state in _meta.cache on every response, and can decide whether to trust prior data or re-call.
What every response tells you
{
"result": {
"content": [...],
"_meta": {
"cache": {
"hit": false,
"ttl_seconds": 300,
"fresh_until": "2026-05-09T16:42:18Z"
},
"tier": "anonymous",
"cost": { "total": 1, "components": [...] }
}
}
}
hit— was this served from cache?ttl_seconds— how long this response remains in cachefresh_until— exact wall-clock time the cache entry expires
Why this matters for agents
Most agent failures fall into one of two cache-related buckets:
- Re-using stale memory as fact. The agent called
fred_get_seriesan hour ago, now is asked again, and just trusts its conversation history. If the data has updated, the agent’s “current value” is wrong. - Hammering the gateway. The agent re-calls every turn even when the data hasn’t moved.
Reading fresh_until resolves both. The agent should:
if (now < remembered_fresh_until) {
// safe to reuse the prior response
} else {
// re-call; the data may have changed
}
TTL by data class
The gateway sets TTL based on how often the underlying source actually changes. Rough buckets:
| Class | TTL | Examples |
|---|---|---|
| Real-time | 30–60s | Stock quotes, weather |
| Hourly | 1h | News, social posts |
| Daily | 24h | FRED economic series, FDA approvals |
| Weekly | 7d | EDGAR company facts (pulled from quarterly filings) |
| Static | 30d | RxNorm concept properties, USPTO patents |
Look at ttl_seconds per call — it’s the authoritative number.
Writing cache-aware agents
In your agent’s loop:
- Store fresh_until alongside results in your scratchpad/memory. When the agent later cites a number, check whether the source is still fresh.
- Use
rememberfor cross-session memory:
Thenremember({ key: "aapl_revenue_fy23", value: { value: 383300000000, fresh_until: "2026-05-09T..." } })recalland check the timestamp before reusing. - For long-lived sessions, refresh data when the agent’s task spans multiple
fresh_untilboundaries.
Cache misses and _meta.cost
A cache hit costs less than a miss in real terms (no upstream call), but the _meta.cost at gateway level is the same — Pipeworx charges per tool invocation, not per upstream call. The cost transparency exists so agents can budget; freshness is the orthogonal concern.
Forced refresh
If you must bypass cache (rare), append ?nocache=1 to the gateway URL:
https://gateway.pipeworx.io/mcp?nocache=1
Cache is then disabled for the connection. Counts every call against your daily quota with no caching benefit. Use sparingly.