Academy · Platform · Data

Sorting documents into types

In one line. Give a collection a list of document types — Invoice, Contract, Receipt — and an agent that reads each incoming document and marks it with the one type it is. You’ll be able to. Make the list of types, build the agent that sorts, have every new document sorted as it arrives, know what happens to a document that fits none of the types, and send each type to its own stage. Where this lives. Studio ▸ Data ▸ Collections ▸ <collection> — its Taxonomy, Agents and Lifecycle tabs — and Studio ▸ Agents ▸ Agent Toolkit ▸ Agents for the agent that sorts.

How sorting works

Sorting takes three pieces, and each lives in a place you already know:

Piece What it is Where
The list of types A taxonomy whose Type is Document Classification, with one label per type: Invoice, Contract, Receipt. The collection’s Taxonomy tab
The agent that sorts An agent whose Output is that taxonomy. It reads the document and picks exactly one of the types — or none, when none fits. Studio ▸ Agents ▸ Agent Toolkit ▸ Agents
Sorting on arrival That agent set as the collection’s intake agent, so every document that lands is sorted. The collection’s Agents tab

The agent decides from each label’s description, so the description is where you say what belongs in the type. A type is a label’s name — not a value inside a label — so make one label per type.

Step 1 — Make the list of types

  1. Open Studio ▸ Data ▸ Collections, select the collection, and open its Taxonomy tab.
  2. Click Taxonomy at the foot of the list. In Create Taxonomy, fill in Taxonomy Name (Document type) and Description (What kind of document this is), set Type to Document Classification, and click Submit. (Page Classification sorts each page on its own instead — use it when one file holds several documents.)
  3. Select the new taxonomy. On its Labels tab click Label. In Create Label, enter the Label Name Invoice and a Description that says what belongs — A bill asking for payment: a supplier, an amount due and a due date. Click Add.
  4. Add Contract and Receipt the same way, each with its own description; on the last one click Add and exit.

Many types at once: the Import labels tab of the same dialog takes a list from a file — Choose File, then Upload & Create.

Tip. Keep one list per decision. “What kind of document is this?” is one taxonomy; “how urgent is it?” is another, sorted by another agent.

Step 2 — Build the agent that sorts

  1. Open Studio ▸ Agents ▸ Agent Toolkit ▸ Agents and click + Agent ▸ Agent.
  2. On Persona, name it Document sorter and write what it decides: Decide which one of the listed document types this document is. If it is none of them, leave the type empty.
  3. On Output, turn on Structured output. Under Taxonomy, pick your list in Taxonomy / learner. Under Labels, click Add all — each row carries a type and its description, and you can sharpen a description here.
  4. Still on Output, turn on Auto-annotate document. This is what writes the chosen type onto the document. Without it the agent answers in its playground, but the documents in the collection are never marked.
  5. Click Save Agent, then try it in the playground on a sample document.

Good to know. Sorting gives a document a type, not a score: a sorted document’s type carries no confidence number, so there is nothing to set on Confidence score for it.

Step 3 — Sort every document as it arrives

Open the collection’s Agents tab.

  • With no agent yet, use Assign to: and pick Document sorter from Pick from your roster….
  • If the collection already has an intake agent, click + Change Intake and pick the sorter under Re-assign this collection to:. A collection has one intake agent, so this replaces the one it had.

From now on every document that lands is sorted, and its type shows on the document.

What happens to a document that fits none of the types

The product has no built-in “Other” or “Unclassified” type. When none of your types fits, the agent may leave the document without a type: nothing is written, and the document carries no type at all.

To catch those documents, give them a type of their own:

  1. Add a label Other to your list with a description such as Anything that is not an invoice, a contract or a receipt. Add it to the sorter’s Labels too (Add all again).
  2. Send Other to a stage a person works in — the next section shows how — and turn on Send to Inbox (human review) on that stage, so each one appears in the project’s Inbox for someone to look at.

A document the agent leaves without any type still moves on like the others (next section). With the default lifecycle it lands in L1 Review, a stage that already sends each document to the Inbox; with your own routing, the last block below sends it to a person.

Where a sorted document goes next

Sorting marks the document; it does not by itself send each type somewhere different. After the sorter writes a type, the platform moves the document along the collection’s lifecycle:

  • If the lifecycle has a stage named L1 Review — the default lifecycle does — every sorted document goes there, whatever its type.
  • Otherwise it moves on to the one Automated stage the stage it arrived in leads to. That stage can send each type its own way.

Sending each type to its own stage

In the collection’s Lifecycle tab (Taxonomy, lifecycle, tags & events shows how to add and edit stages):

  1. The destinations. Add a stage for each place a type should go — Invoices, Contracts, Receipts, and Needs sorting for Other and for any document left with no type. On a stage a person works in, turn on Send to Inbox (human review) and choose who sees it in Can be viewed by (under Show Advanced Settings).
  2. The sorting stage. Add a stage Sort by type and open it with its pencil (Edit Stage). Click Show Advanced Settings, set Workflow Type to Automated and Automation Type to Conditional, and list every destination in Can be moved to. Leave Confidence threshold at 0.
  3. One block per type. One block is already there; click Add for each further type. In each block, under Label Conditions, pick that type as the Label and leave its slider at 0; open the row’s list menu and turn on Is Mandatory. Set Success to that type’s stage and leave Failure empty.
  4. The way out for a document with no type. Click Add once more. In this last block add one row per type — each with Is Mandatory on and the Gate of every row after the first set to OR — and set Failure to Needs sorting, leaving Success empty. The block passes when the document carries any type, so only a document with none goes to Needs sorting.
  5. The way in. On the stage new documents arrive in, include Sort by type in Can be moved to (under Show Advanced Settings), and no other Automated stage.
  6. No L1 Review. Rename or remove the stage called L1 Review: while it exists, sorted documents go straight to it and never reach Sort by type.

Why each setting matters:

  • Is Mandatory — without it, a condition on a type the document does not have counts as met, so every block would pass.
  • Failure left empty on the type blocks — every block’s choice is carried out. A Failure stage on the Invoice block would also receive every contract and receipt; only the last block, which fails just for a document with no type, has one.
  • Sliders at 0 — a sorted document’s type carries no score, so any threshold above 0 fails every document.

A document with no type passes none of the type blocks; the last block sends it to Needs sorting, where a person sorts it.

Where to go next

Prefer learning inside the product? The same academy lives in the platform's Learn menu — every screen links to the chapter that explains it.

See the platform live