Skip to main content

Structure Types and the Type Library

Define a data shape once as a Structure Type in the Type Library, then reuse it for work item columns, custom tool inputs and outputs, and inside other types.

A Structure Type is a named, reusable data shape you define once and use in many places in a thunk. Instead of describing the same object — a contact, an address, a line item — separately on every column and tool that handles it, you define it one time, give it a name, and then refer to it by that name wherever a structured value is needed.

Structure Types build on the idea in Schematized State: the more specific the shape of a property, the better an AI agent can read and fill it in. A Structure Type is the most specific shape you can give a structured value, and it is shared, so every place that uses it stays consistent.

What a Structure Type is

A Structure Type is an object shape with a fixed set of fields. For example, a Contact type might have name, email, and company fields. Each field has a name, a description, and a type of its own.

You define and manage these types in the Type Library tab, alongside the thunk's Properties. A type defined there is available to the whole thunk.

Defining a type

In the Type Library, add a type, give it a meaningful name, and add its fields. For each field you choose a type, just as you do for a work item column:

  • a basic type such as Text, Number, Yes/No, Date, URL, File, Image, Address, Location, or Country;

  • a fixed list of allowed values (an enumeration) on a Text field, so the agent can only record one of the choices you listed;

  • another Structure Type, so you can compose larger shapes out of smaller ones; or

  • a list of any of the above — for example a list of Text, or a list of another type.

Every field of a Structure Type is required. Structure Types are strict by design: when the shape is fixed and complete, an AI agent cannot leave a field out or invent an extra one, which is what makes the type reliable to read and write. Give each field a clear description for the same reason you would on a column — it tells the agent exactly what belongs there.

Referring to another type

A field can itself be a Structure Type, so you can compose larger shapes out of smaller ones. A Contact can have a company field whose type is an Organization; an Order can have an items field that is a list of LineItem.

Two rules keep these references sound:

  • Define the referenced type first. A field can only use a type that already exists.

  • References cannot form a loop. If Contact uses Organization, then Organization cannot use Contact back, directly or through other types.

Using a Structure Type

Once a type exists, it appears as a first-class entry in the type picker — alongside the basic types — everywhere a structured value is chosen. You can use it as:

  • the type of a work item column (the column then reads as the type's name, such as Contact, or List of Contact);

  • the input or output type of a custom tool, so a tool can take or return a whole structured object instead of loose values (see Custom Tools); and

  • the type of a field inside another Structure Type.

For how lists of values — including lists of a Structure Type — are shown and configured, see Format a list property.

Reuse, rename, and delete

The point of a named type is that there is one definition and one place to change it:

  • Edit once. When you change a type's fields, every column, tool, and other type that uses it picks up the change.

  • Rename safely. Renaming a type updates every place that refers to it, so nothing is left pointing at the old name.

  • Delete only when unused. You cannot delete a type while a work item column or another type still uses it. Remove those uses first, then delete the type.

Structure Type or JSON Object property?

Thunk.AI has two ways to hold a structured value, and they suit different situations:

  • A JSON Object property is a one-off shape defined inline on a single column, often from a pasted example. It is anonymous and not shared — two columns that hold the same kind of object have two separate shapes that can drift apart — and a custom tool cannot take or return it.

  • A Structure Type is the named, shared version of that idea: define it once in the Type Library and reuse it across columns, tools, and other types.

Reach for a Structure Type when the same shape appears in more than one place, when you want a custom tool to take or return it, or when you want a single definition to keep everything consistent. A JSON Object property is fine when the shape is used in exactly one place and nothing else needs to share it.

Did this answer your question?