Controlled Data Volume Pattern

The genie applies filters, aggregation, and pagination before returning data to the LLM, to prevent context-window overflow when working with large datasets.

Design Patterns Architecture

Why This Pattern

This isn't really a stand-alone pattern so much as a discipline every other pattern needs the moment its data volume is unbounded. Token budgets are a hard constraint, and an LLM asked to aggregate a large raw dump fails silently — a subtly wrong summary — rather than obviously, which is more dangerous than an outright error. The judgment call: push aggregation and filtering down into deterministic code, and keep the LLM's job to reasoning over an already-small result, never to being the aggregator itself.

When to Use It

  • The underlying dataset is large enough that returning it in full risks consuming the entire context window.
  • The user needs a summary or filtered view, not every raw record.

When NOT to Use It

  • Never return bulk data straight from a skill. It can consume the entire context and cause lost conversation history, errors, or incorrect data.
  • Don't rely on a knowledge base for definitive answers like sums or counts across many documents — vector stores return the top-N matching fragments, not the full set.

How It Works in Workato

  • Perform aggregation, filtering, and data processing before sending results back as skill output — not after.
  • Implement pagination to return a limited number of records at a time, sending only the relevant fields, plus a message indicating there may be more results.

Source: Agentic Design Cookbook V2.0, pp. 23–24

Put these cookbook patterns to work

Get started