Skip to main content

Custom datasets

Thunk-owned tables of reference data, with tools the workflow uses to read and update them

A dataset is a named table that belongs to a thunk. You define its columns, fill it with rows, and the thunk gets tools to query and change those rows while it runs. Datasets hold the reference data a workflow looks things up in: rate cards, routing tables, code lists, lists of records already seen, or state that a conversation keeps between turns.

A dataset is not the workflow. Adding a row does not start any work, rows have no plan, status, tests or AI cost, and the rows never show up as work items.

When to use a dataset

You need

Use

Units of work that move through the Workflow Plan

Work items

Documents the agent searches by meaning

A table of values the workflow looks up or updates exactly

A dataset

Reference data that people keep in a spreadsheet

A record that already lives in another system

A connection or a Custom Database tool to that system

Before writing a lookup table into a custom code tool, or into AI instructions, make it a dataset. The values stay editable without changing code, and every step uses the same copy.

Create a dataset

Datasets are under Datasets in the thunk's left navigation, which you can open once the thunk has a Workflow Plan. Owners and Admins create datasets and change their columns, settings and tools.

  1. Open Datasets and click Add Dataset.

  2. Enter a Name and a Description, then click Create.

  3. On the dataset's Settings tab, add the columns. Every dataset has a Name column. Add the others and choose each one's type, such as Text, Number, Yes/No, Date Time or Calendar Date.

  4. On the Data tab, click Add and choose Add one item using a form to add a row.

Each dataset has three tabs:

  • Data: the rows. Open a row to see or change it. Owners and Admins can click Remove this dataset to delete the dataset, its rows and its tools; this cannot be undone.

  • Settings: the columns, and the owner filter (see Row owners and the owner filter).

  • Tools: the tools the dataset adds, and which ones are turned on.

A dataset's name must not clash with the workflow, a content folder or another dataset. Its tools are named after it, so their names must not clash with the thunk's custom tools or content-folder search tools either.

The tools a dataset adds

Each dataset adds five tools to the thunk's This Thunk tools. For a dataset named "Rate Card":

Tool

What it does

query_rate_card

Returns rows that match a filter, optionally only some columns

add_to_rate_card

Adds a row. It does not start a workflow

get_rate_card_row

Reads one row by id or by Name

update_rate_card_row

Changes columns on one row

delete_rate_card_row

Deletes one row

The tools are on for every step when the dataset is created. Turn them off for a step, or make them conditional, in that step's tool settings like any other This Thunk tool. See Conditional tool availability.

A custom code tool calls the dataset's tools like any other tool:

const input = getTypedInput();
const { data } = await tools.query_rate_card({
  filter: {
    items: [
      { field: "Role", operator: "equals", value: input.role },
      { field: "Region", operator: "equals", value: input.region },
    ],
    logicOperator: "and",
  },
});
const rate = data[0]?.properties["Hourly Rate"];

Filters and paging

A query_ tool takes a filter: a list of items, each with a column name in field, an operator and a value, joined by logicOperator (and or or).

Column type

Operators

Text

contains, doesNotContain, equals, doesNotEqual, startsWith, endsWith, is, not, isAnyOf, isNoneOf, isEmpty, isNotEmpty

Number

=, !=, >, >=, <, <=, isEmpty, isNotEmpty

Yes/No

equals, doesNotEqual, is, not, isEmpty, isNotEmpty

Date Time, Calendar Date

after, onOrAfter, before, onOrBefore, is, not, isEmpty, isNotEmpty

An empty items list returns every row. A query_ tool returns { data, hasMore, nextPageToken }, where each row in data is { id, name, properties } and properties is keyed by column name. Rows come back oldest first, at most 256 per page. While hasMore is true, call again with nextPageToken as pageToken. A query returns no total count.

Row owners and the owner filter

Every row records the user who added it. When a work item was submitted by an end user, including a work item of another thunk that calls this thunk's tools, that end user is the owner. A work item with no end user, such as a scheduled or test work item, records one owner for all such work items, and rows you add on the Data tab belong to you.

By default, anyone who can call a dataset's tools sees every row. To keep users' rows apart, turn on Filter tool results to the invoking user's rows on the dataset's Settings tab. The query_ tool then returns only the calling user's rows, and the get_, update_ and delete_ tools report a row that belongs to someone else as not found. The Data tab still shows every row, and with the filter on it also shows who owns each row.

Use the filter for per-user data, such as a form that a user fills in over several conversations.

Turning the filter on also stops any report that runs over the dataset, until you turn it off again.

Copying and publishing

  • Copying a thunk always copies its datasets and their columns. Rows (up to 500 per dataset) are copied only when the copy also copies work items or content-folder documents.

  • When you publish a thunk as an MCP server, its dataset tools are off by default. Turn one on in the export settings only when callers should use the table directly. It is usually better to publish a custom tool that does the job ("look up a rate") and calls the dataset tools itself. For patterns built this way (a mock of an external system, a store several workflows share, a service that processes and stores records), see Dataset patterns: mock systems and shared stores.

With the Builder MCP

An AI agent that builds thunks through the Builder MCP manages datasets with batch_datasets, and get_definition lists the thunk's datasets in its datasets section. One batch_datasets call can add, rename and delete datasets and columns, and add, change, delete and query rows:

{
  "thunkId": "",
  "operations": [
    { "op": "add", "name": "Rate Card", "description": "Hourly rates by role and region" },
    { "op": "add_column", "dataset": "Rate Card", "name": "Role", "type": "TEXT" },
    { "op": "add_column", "dataset": "Rate Card", "name": "Region", "type": "TEXT" },
    { "op": "add_column", "dataset": "Rate Card", "name": "Hourly Rate", "type": "NUMBER" },
    { "op": "add_row", "dataset": "Rate Card", "values": { "Name": "Senior engineer EU", "Role": "Senior engineer", "Region": "EU", "Hourly Rate": 140 } },
    { "op": "query_rows", "dataset": "Rate Card", "filter": { "items": [{ "field": "Region", "operator": "equals", "value": "EU" }] } }
  ]
}
  • Column types are TEXT, NUMBER, YES_OR_NO, DATE (Date Time) and CALENDAR_DATE.

  • Row values are keyed by column name. update_row and delete_row take the row id returned by add_row or query_rows. Use these row operations, not create_work_item, which starts a workflow.

  • update renames a dataset or changes its description, and filterRowsByOwner: true on add or update turns on the owner filter. delete removes the dataset, its tools and its rows.

  • Renaming a dataset renames its tools and keeps whether they are on for the thunk. Each step's own settings for those tools, code tools that call the old names, and the thunk's MCP export settings for them are not updated: set or fix those again after a rename.

  • Operations run in order. A failed operation does not undo or skip the others, so read each result's status and retry only the failed ones.

  • A batch of only row operations does not repeat every dataset's columns in its reply. Pass returnDatasets: "all" when you want them back.

  • query_rows takes the same filter as the query_ tools and, like the Data tab, returns every row whatever the owner filter.

Did this answer your question?