Query workspace

Use Query workspace (rollout.query) for an authorized, read-only query over a workspace source. Filters use the shared query grammar, for example object:ledger created_at:>=-7d, and order_by accepts comma-separated field:direction keys.

Pick the source

Query has one records contract. Choose the source and filter it with the same grammar on every surface. Filter labels with labels:. Task turn context comes from the authenticated Start context, not a Query setting.

To authenticate a stored step result, query WorkflowStepRun by exact ID, add workflow_run, inputs and outputs to include, and compare the returned reference with the expected value using reference_matches. Only a completed step has a reference.

Tools live on the App, Agent or AI agent step that uses them, so check that consumer for their setup. Use the ToolCall source for execution evidence. Query doesn't expose another consumer's settings, grants or credentials.

Shape the response

fields accepts dotted paths such as data.external_id and data.amount. A path through a list applies to every element, so items.code keeps each item's code and nothing else.

exclude removes dotted paths after that projection, which is useful for dropping source payloads such as data.raw. The record id is always kept.

order_by takes field:direction, such as created_at:desc, and offset skips that many matching rows. on_truncation sets what a truncated read does: ignore, warn (the default) or fail.

An unknown filter field rejects the whole query, even with strict: false. An unknown top-level name in fields or exclude is refused only under strict validation. With strict off, an unknown fields path returns nothing and an unknown exclude path removes nothing. Strict validation also checks operators and enumerated values, and it's on unless you turn it off.

Rich text reads as Markdown: a Task, Project, Objective, Key Result or Milestone description, an Activity body, a Document content, and a Record's rich-text values under data. Every row of a source with rich text also carries a plain-text summary of up to 160 characters. For an Activity, summary is a one-line excerpt, so a step that reads the whole comment or note reads item.body, and names body when it sets fields. Set Rich text as to Document JSON to get the rich-text document instead of Markdown.

The summary is an excerpt of the rich text, so exclude treats it as part of it: excluding description, body, content, data or any data.<field> also removes summary. Excluding summary alone leaves the rich text.

Workflow history

Large workflow-history fields are opt-in. Add error to include for WorkflowRun records, or inputs or outputs for WorkflowStepRun records. They're otherwise neither read from the database nor emitted in node output. Each payload comes with inputs_complete or outputs_complete, which reads false when redaction or a size limit cut the stored value.

Add workflow_run to include on WorkflowStepRun records to get the identity of the run that executed the step, nested under workflow_run:

Field Meaning
id, workflow_id The run and its workflow
release_id, release_name The Release it ran, when it ran one
source_revision The Draft's lock version at admission. It separates two runs of the same Draft taken at different revisions. A Release has none, so it reads null
flow_source The source kind: draft, release, system_definition or chat_preview
status, outcome How the run ended
run_mode, run_type, partial_flow How it ran. run_mode:debug marks a Test run
origin What started it
parent_run_id, source_node_id The run and node it came from

That's enough to tell a published run from a Test run, a replay or a partial one, and to reconcile a step's output with the exact Release that produced it, in one query. The run's flow, inputs, results and credentials are never part of it, and a step whose parent is unavailable has no workflow_run key. WorkflowRun records carry the same identity in their own projection.

The same identity is filterable on WorkflowRun: release:<uuid> filters the published snapshot and flow_source:draft the source kind. order_by accepts source_revision.

Complete and latest-per-group reads

Every result carries a page object with returned_count, exact total_count and truncated. A configured aggregate arrives as aggregate, with series and meta.

When more rows match (on_truncation) controls a partial result: Warn (default) adds a warning to the result, Fail returns query_truncated with both counts, and Ignore accepts the page while keeping truncated: true.

Turn on Fetch all (fetch_all) to page through all matches. The operation fails with query_fetch_limit_exceeded before loading any rows when more than 10,000 match. Narrow the query in that case.

Distinct on (distinct_on) keeps the first row for each group. The node makes the distinct key the first ascending order key, then applies order_by. For example, distinct_on: "data.account_id" with order_by: "created_at:desc" returns the newest Record per account. A data.<field> key must be an active sortable scalar field on the one Object the query selects.

For a Record query, the Object setting restricts results to that Object, exactly like an object:<slug> term in the query. A query that also names a different Object fails instead of returning nothing.