Tool Result Cachingpublic

Last verified 1 Dec 2026

Action Gateway connects applications and AI agents to tools through a managed MCP endpoint or SDK, with the accounts and permissions you choose. See What You Can Build for standalone agent examples.

Action Gateway tool result caching stores recent results from eligible read-only tools so repeated calls can reuse them without calling the provider again. Use caching when a short delay in seeing changes is acceptable, such as an agent repeating the same web search during a research task.

Caching is off by default. Enable it on an endpoint version in the Control Panel, an SDK, or the API for all eligible tools or a specific list. Repeated calls through that endpoint version then use cached results automatically, and callers can override caching on individual calls. See Enable Tool Result Caching for setup steps.

Eligible Tools and Matching Calls

Only tools marked eligible in the Action Gateway catalog support caching. These are reviewed read-only, non-destructive tools, though not every read-only tool is eligible.

In the Control Panel, eligible tools display a Cache results option along with their maximum cache lifetime. In the Action Gateway API, GET /v2/action-gateway/tools includes a cache object in the definitions array for eligible tools, with ttlSeconds giving each tool’s maximum cache lifetime in seconds. Catalog eligibility alone does not enable caching; you must opt in on the endpoint version.

A cache hit occurs when a call matches an earlier successful call with the same arguments, tool version, and connection within the same endpoint version, and the stored result is still within the allowed age. Action Gateway returns the stored result without calling the provider. Action Gateway does not share cached results across endpoints or across versions of an endpoint.

If no usable cached result exists, the call is a cache miss: Action Gateway calls the provider and can store a successful result for later calls. Action Gateway does not cache errors.

The endpoint version’s permission policy, argument validation, and provider connection checks still run on every call, including cache hits. Any output view bound to the endpoint version also applies to cached results.

Freshness and Per-Call Controls

Cached results last at most 5 minutes (300 seconds). Several limits can shorten that period, and the shortest limit applies:

  • Tool lifetime: Each eligible tool defines its own maximum cache lifetime (cache.ttlSeconds in the catalog).
  • Endpoint version limit: Setting config.cache.maxAgeSeconds (1-300 seconds) in the version’s SDK or API configuration caps the maximum result age for all cached tools in that version.
  • Provider response headers: For HTTP tools, the provider’s HTTP response cache headers can shorten the lifetime or prevent storage.
  • Per-call freshness: On an individual action_invoke tool call, cache.max_age_seconds sets the oldest cached result the call accepts, in seconds. It can require a fresher result but cannot extend the endpoint version or tool limit, and Action Gateway clamps values above 300 to 300. Setting 0 skips the cache and calls the provider directly. This setting controls only the accepted age on lookup, not the storage lifetime of a newly stored entry.

Changes at the provider do not immediately invalidate cached entries. When a call needs the latest data, bypass caching by setting cache.mode to bypass (or cache.max_age_seconds to 0) on the action_invoke call. A bypass calls the provider without reading or storing a cached result, and it does not refresh or clear an existing entry.

Cache storage is best effort. If caching is unavailable or an entry is evicted, Action Gateway calls the provider normally, so repeated calls are not guaranteed to produce a cache hit.

Cache Status Metadata

On a cache hit, or when a call includes per-call cache controls, the tool result includes a _meta.cache object. The following example shows the metadata returned on a cache hit that is 12 seconds old:

{
  "_meta": {
    "cache": {
      "status": "HIT",
      "age_seconds": 12
    }
  }
}

The status field reports how Action Gateway handles caching for that call:

Status Meaning
HIT Action Gateway returns a cached result without calling the provider. age_seconds reports the result’s age in seconds.
MISS No sufficiently recent cached result is available, so Action Gateway calls the provider.
BYPASS Action Gateway skips caching for this call.

Cache hits always include _meta.cache. MISS and BYPASS appear only when the call includes per-call cache controls.

Cache Fields Across APIs

Several Action Gateway APIs include a cache object with different fields and roles:

Where it appears Fields Purpose
Catalog (GET /v2/action-gateway/tools) cache.ttlSeconds Reports in definitions that a tool supports caching and gives its maximum lifetime in seconds. Does not enable caching.
Endpoint version (config.cache) allEligible, tools, maxAgeSeconds Opts an endpoint version into caching for all eligible tools (allEligible: true) or a specific list (tools), and optionally sets its maximum result age (1-300 seconds).
Tool Search (action_search / POST /tools/search) cache.maxAgeSeconds Advertises that a tool accepts per-call cache controls in this endpoint version, with the version’s allowed age (or 300 if unset; the tool’s ttlSeconds can still be shorter).
Invoke Tool (action_invoke / POST /tools/invoke) cache.mode, cache.max_age_seconds Controls caching for one call (auto or bypass, and the maximum accepted age in seconds).
Tool result (_meta.cache) status, age_seconds Reports whether the result came from cache (HIT, MISS, or BYPASS) and its age in seconds on a hit.

In the HTTP APIs and MCP tool payloads, use each field name with its exact casing: catalog, endpoint version, and search fields use camel case (such as maxAgeSeconds), while per-call controls and result metadata use snake case (such as max_age_seconds and age_seconds). Client libraries may map these names to language conventions, such as maxAgeSeconds and meta.cache.ageSeconds in the TypeScript SDK (DoTs).

Tool Result Caching Pricing

Cache hits incur the standard $0.10 per 1,000 gateway tool calls with no additional provider charge, such as Exa web search or web fetch. Cache misses and bypassed calls incur the tool’s normal charges. See Action Gateway Pricing.

We can't find any results for your search.

Try using different keywords or simplifying your search terms.