Building Workflows

Building Workflows

This guide walks you through creating a complete workflow from scratch.

What We’ll Build

A document processing pipeline that:

  1. Extracts text from images (OCR)
  2. Identifies named entities (NER)
  3. Summarizes the content (LLM)
  4. Stores results in a dataset
graph LR
    A[Image Input] --> B[OCR]
    B --> C[NER]
    C --> D[LLM Summary]
    D --> E[Output Dataset]

Step 1: Create the Workflow

Step 2: Add Model Nodes

Add OCR Node

Add NER Node

Add LLM Summary Node

Step 3: Add Output Dataset

Step 4: Connect Nodes with Edges

Step 5: Test the Workflow

Single Execution

Step 6: Activate the Version

Once tested, activate the version for production use:

Complete Code Example

Here’s the full workflow creation in one script:

from seeme import Client

client = Client()

# 1. Create workflow
workflow = client.create_workflow(
    name="Document Processing Pipeline",
    description="OCR → NER → Summary"
)
version = workflow.versions[0]

# 2. Add nodes
ocr_node = client.create_workflow_node(
    version_id=version.id,
    name="OCR",
    entity_type="model",
    entity_id="ocr-model-id",
    config={"input_template": "{{input}}"}
)

ner_node = client.create_workflow_node(
    version_id=version.id,
    name="NER",
    entity_type="model",
    entity_id="ner-model-id",
    config={"input_template": "{{" + ocr_node.id + "}}"}
)

llm_node = client.create_workflow_node(
    version_id=version.id,
    name="Summary",
    entity_type="model",
    entity_id="llm-model-id",
    config={
        "input_template": f"Summarize: {{{{{ocr_node.id}}}}}\nEntities: {{{{{ner_node.id}}}}}"
    }
)

output_node = client.create_workflow_node(
    version_id=version.id,
    name="Output",
    entity_type="dataset",
    entity_id="output-dataset-id",
    config={
        "output_dataset_id": "output-dataset-id",
        "column_mapping": {"summary": f"{{{{{llm_node.id}}}}}"}
    }
)

# 3. Connect nodes
for begin, end in [(ocr_node, ner_node), (ner_node, llm_node), (llm_node, output_node)]:
    client.create_workflow_edge(
        version_id=version.id,
        begin_node_id=begin.id,
        end_node_id=end.id,
        edge_type="data"
    )

# 4. Test
execution = client.execute_workflow(
    workflow_id=workflow.id,
    item="./test.png"
)

# 5. Activate when ready
client.activate_workflow_version(
    workflow_id=workflow.id,
    version_id=version.id
)

print(f"Workflow ready: {workflow.id}")

Best Practices

  1. Name nodes descriptively - Makes debugging easier
  2. Set appropriate timeouts - Account for slow models
  3. Use on_failure wisely - “continue” for optional steps
  4. Test with edge cases - Empty inputs, large files
  5. Version frequently - Easy rollback if issues arise

Troubleshooting

IssueCauseSolution
Node not executingMissing edgeCheck edge connections
Wrong outputTemplate errorVerify node ID references
TimeoutModel too slowIncrease timeout setting
Empty resultsInput formatCheck model input requirements

Next Steps