Creating Your First Workflow
Learn how to create and manage workflows to orchestrate your data processing.
Workflows allow you to chain multiple functions together to create complex data processing pipelines. Instead of calling individual functions, you can define a workflow that orchestrates the flow of data between them.
Start in the UI (Recommended)
For first-time users, we highly recommend building your first workflow in the bem UI. The visual builder makes it easy to design your pipeline and configure your logic without writing JSON manually.
- Drag and Drop to Infer: You can simply drag and drop a sample file (like a PDF or image) onto the canvas.
bemwill automatically infer the first node of your workflow and suggest a schema based on the file content. - Start from Scratch: Alternatively, you can start with a blank canvas and add any primitive you need-whether it's a Transform, Route, or any other available function.

Through the UI, you can start adding nodes, such as classifiers/routers, their routes, and the next step for each route.

If you don’t have a schema top of mind for a Transform or Analyze node, feel free to drag and drop a file into the Output Schema editor (or click “Infer Schema from File”, and select your desired file. After a bit, bem will infer a schema. Simply click Save at the top right when you’re ready.

Testing a Workflow in UI
Once you’re feeling good about the 1st iteration of your workflow, click Tests in the top right navigation bar, drag and drop up to 5 files in the Input area and click Run. The files will enter the workflow and go through each step. You can verify the result of every step, and in Transform and Analyze, it will run evals automatically.

Creating a Workflow via API
Once you are comfortable with the concepts, you can programmatically create workflows using the /v2/workflows endpoint. A workflow definition requires a mainFunction and can optionally include relationships to define the flow. You will need to separate create functions and reference them from here. Remember, a function can be referenced from multiple workflows if you want to reuse them.
Example Request
1POST /v2/workflows
2{
3 "name": "invoice-processing-workflow",
4 "displayName": "Invoice Processing",
5 "mainFunction": {
6 "functionID": "fn_123",
7 "versionNum": 1
8 },
9 "relationships": [
10 {
11 "sourceFunction": {
12 "functionID": "fn_123",
13 "versionNum": 1
14 },
15 "destinationName": "approve",
16 "destinationFunction": {
17 "functionID": "fn_456",
18 "versionNum": 1
19 }
20 }
21 ]
22}Managing Workflows
You can list, get, update, and delete workflows using the /v2/workflows endpoints. Workflows also support versioning, allowing you to iterate safely.