The route action node lets you direct documents down different paths in your pipeline based on conditions, enabling a single pipe to handle multiple document types.
When to use routing
- Process different document types in one pipe (for example, invoices vs receipts)
- Apply different extraction schemas based on document content
- Skip steps for certain documents
- Send results to different callback URLs based on document properties
Adding a route node
- Open your pipeline in the editor
- Add a Route action node
- Create multiple output edges from the route node, each going to a different downstream path
- Configure conditions on each edge
How it works
The route action evaluates conditions against the data from the previous step and sends the data down the matching path. Only one path is followed per run.
Example: invoices vs receipts
Upload Trigger
↓
Parse Action
↓
Route Action
├── (condition: document_type == "invoice") → Extract Action (invoice schema) → Callback Output
└── (condition: document_type == "receipt") → Extract Action (receipt schema) → Callback Output
In this example:
- The parse action extracts raw text from the document
- The route action checks the parsed content to determine the document type
- Each branch uses a different extraction schema tailored to that document type
Configuring conditions
Conditions are defined on the edges leaving the route node. Each edge has a condition expression that is evaluated against the data flowing through the pipeline.
Condition expressions
Conditions compare field values from the upstream data:
| Expression | Description |
|---|
field == "value" | Exact match |
field != "value" | Not equal |
field contains "text" | Contains substring |
field > 100 | Greater than |
field < 100 | Less than |
Default path
You can designate one edge as the default path. If no other condition matches, the data flows down the default path. This prevents runs from failing when no condition matches.
Always configure a default path to handle unexpected document types. Without a default, runs fail if no condition matches.
Tips
- Use a parse action before the route node to extract text that conditions can evaluate
- Keep conditions simple and mutually exclusive
- Test each path with sample documents to verify routing works correctly
- Name your edges descriptively (for example, “Invoice path”, “Receipt path”) for clarity in the editor