Documentation

Customer data & cache fields

Attach business context to every AI request. Surface user IDs, experiment buckets, and metadata without storing full payloads.

What are cache fields?

Cache fields let you tag AI requests with business identifiers that echo back in every response and appear in your observability dashboard. They bridge the gap between your application's context and ModelRiver's processing pipeline.

When you define cache fields on a workflow, ModelRiver extracts matching values from your request payload and includes them in:

  • The API response under customer_data
  • The Request Logs table for filtering and search
  • Webhook payloads for downstream processing
  • Timeline views in Observability

Configuring cache fields

Add cache fields when creating or editing a workflow:

  1. Navigate to Workflows in your project
  2. Open an existing workflow or create a new one
  3. In the Cache Fields section, enter field paths separated by commas or newlines

Field path syntax

Use dot notation for nested data and indexes for arrays:

PathExtracts from
user_idTop-level user_id field
metadata.segmentNested metadata.segment value
messages.0.contentFirst message's content field
metadata.experiment.bucketDeeply nested experiment bucket

Example request and response

Request:

JSON
1{
2 "workflow": "support-summarizer",
3 "messages": [{"role": "user", "content": "Summarise this ticket"}],
4 "metadata": {
5 "user_id": "usr_abc123",
6 "segment": "enterprise",
7 "experiment": {"bucket": "v2"}
8 }
9}

Response includes:

JSON
1{
2 "customer_data": {
3 "metadata.user_id": "usr_abc123",
4 "metadata.segment": "enterprise",
5 "metadata.experiment.bucket": "v2"
6 }
7}

Best practices

  • Keep it selective: Cache only the fields you need for observability. Avoid caching sensitive or high-cardinality data.
  • Use consistent naming: Standardise field paths across workflows so dashboards and filters work uniformly.
  • Don't replace persistence: Customer data is for observability echo, not a substitute for your database. Treat it as a convenient annotation layer.
  • Leverage in debugging: Filter Request Logs by customer data values to trace specific users or experiments.

Next steps