Caches

caches.md

Open your agent in the console and select Tools, then open the Caches tab.

This page documents the Caches tab. Related pages:

What a cache does

A cache stores a structured value for a fixed amount of time.

Caches are used for three main purposes:

  • store HTTP or HTTPS Function results for reuse
  • store tokens generated by a JSON Web Token configuration
  • provide cached values that can be substituted into Function arguments during a call

Caches tab

The tab shows a table with these columns:

  • Name
  • Description
  • Cache ID
  • TTL

Available actions:

  • Create
  • Value
  • Edit
  • Delete

Create or edit a cache

Select Create or Edit to open the cache modal.

Name

Use a short, descriptive name.

Recommended style:

  • lowercase
  • underscores between words

Examples:

  • order_status_cache
  • acme_api_jwt
  • crm_lookup_cache

Description

Description is required.

Use it to explain exactly what the cache is for. Keep it clear enough that an operator can tell it apart from other caches at a glance.

Good examples:

  • Most recent order status lookup result
  • Bearer token for Acme service requests
  • Latest CRM contact lookup result

TTL

TTL is the cache lifetime in seconds.

Use shorter TTLs when the value changes frequently. Use longer TTLs when the value is expensive to regenerate and can safely be reused.

View a cache value

Select Value to open the current cache contents in a read-only viewer.

If the cache does not currently contain a value, the viewer shows an empty state.

The UI does not provide a direct way to edit a cache value manually.

How caches work with Functions

When you select a cache in an HTTP or HTTPS Function:

  1. Leilani checks that cache before running the Function.
  2. If the cache has a current value, Leilani can return that value instead of running the Function again.
  3. If the cache is empty or expired, the Function runs normally.
  4. The new result is stored in the cache.

This is useful for:

  • repeated lookups
  • integrations with services that have rate limits or usage costs
  • data the agent may need again during later calls

If a Function uses Hide function output, the result can still be stored in the cache.

Do not use the Function's Cache field to point at a JWT credential cache. That field is for the Function's own output. Use cache ID substitution when a Function needs a cached token or other cached input.

Cache value substitution

Functions can use current cache values as inputs. When a Function argument starts with a cache ID, Leilani uses that cache's value before running the Function.

Example:

11111111-2222-3333-4444-555555555555

If that cache contains a string JWT, the argument becomes the JWT string.

Advanced: append a JSON Pointer after the cache ID when the cache contains an object and only one field is needed:

11111111-2222-3333-4444-555555555555/access_token

Use this pattern for cached credentials, tokens, and reusable lookup values that should be inserted into webhook headers, request bodies, or URI templates.

How caches work with JSON Web Tokens

Each JSON Web Token writes its signed token into a selected cache.

That means:

  • the cache TTL controls the token lifetime
  • Functions can rely on that cache when they need a current token through cache ID substitution

Use a dedicated cache for each token.

Cache design rules

Use one cache per purpose.

Do not reuse the same cache for unrelated data.

In particular:

  • do not use a JWT cache as a Function result cache
  • do not use one cache for several unrelated integrations

Operator guidance

  • Name caches by purpose, not by implementation detail.
  • Write descriptions that make the intended use obvious.
  • Use a separate cache for credentials and a separate cache for Function results.
  • Choose TTL values that match the freshness requirements of the integration.

Limitations and notes

  • Cache values are view-only in the current UI.
  • Cache IDs are shown in the table so you can identify the exact cache when reviewing configurations.