Flows

Access flows through client.flows in the Datature Vi SDK.

Flows are training workflow configurations. Each flow defines how a model will be trained: dataset selection, model architecture, hyperparameters, and training schedule. When you execute a flow, it creates a run. You can create, update, list, and delete flows through the SDK.

Before You Start

Methods

list()

List all training workflows in your organization.

flows = client.flows.list()

for flow in flows.items:
    print(f"Flow: {flow.flow_id}")
    print(f"Created: {flow.metadata.time_created}")
for page in client.flows.list():
    for flow in page.items:
        print(f"Flow: {flow.flow_id}")
        print(f"  Name: {flow.spec.name}")
        print(f"  Created: {flow.metadata.time_created}")
        print(f"  Blocks: {len(flow.spec.blocks)}")
from datetime import datetime, timedelta

cutoff = (datetime.now() - timedelta(days=7)).timestamp() * 1000

recent_flows = []
for page in client.flows.list():
    for flow in page.items:
        if flow.metadata.time_created > cutoff:
            recent_flows.append(flow)

print(f"Found {len(recent_flows)} recent flows")
all_flows = list(client.flows.list().all_items())
print(f"Total flows: {len(all_flows)}")

Parameters

Name
Type
Description
Required
Default
pagination
object
Pagination settings. See PaginationParams.
Optional
None

Returns: PaginatedResponse[Flow]


get()

Get a specific training flow by ID.

flow = client.flows.get("flow_abc123")

print(f"Flow ID: {flow.flow_id}")
print(f"Name: {flow.spec.name}")
print(f"Blocks: {len(flow.spec.blocks)}")
flow = client.flows.get("flow_abc123")
flow.info()  # Prints formatted flow summary
flow = client.flows.get("flow_abc123")

print(f"Flow: {flow.spec.name}")
print(f"Blocks ({len(flow.spec.blocks)}):")

for i, block in enumerate(flow.spec.blocks, 1):
    print(f"  {i}. {block.block}")
    if block.settings:
        for key, value in list(block.settings.items())[:3]:
            print(f"      {key}: {value}")
flow = client.flows.get("flow_abc123")

print("Global Settings:")
for key, value in flow.spec.settings.items():
    print(f"  {key}: {value}")

print("\nTolerations:")
for key, values in flow.spec.tolerations.items():
    print(f"  {key}: {values}")
flow = client.flows.get("flow_abc123")

print(f"Organization: {flow.organization_id}")
print(f"Schema: {flow.spec.schema}")
print(f"ETag: {flow.etag}")

if flow.spec.training_project:
    print(f"Training Project: {flow.spec.training_project}")

Parameters

Name
Type
Description
Required
Default
flow_id
string
Flow identifier.
Required

Returns: Flow


delete()

Delete a training flow.

deleted = client.flows.delete("flow_abc123")
flow = client.flows.get("flow_abc123")
print(f"About to delete flow: {flow.spec.name}")
print(f"  Blocks: {len(flow.spec.blocks)}")

confirm = input("Delete? (yes/no): ")
if confirm.lower() == "yes":
    client.flows.delete("flow_abc123")
    print("Deleted.")

Parameters

Name
Type
Description
Required
Default
flow_id
string
Flow identifier.
Required

Returns: DeletedFlow


create()

Create a new training flow.

flow = client.flows.create(
    spec={
        "name": "My Training Flow",
        "schema": "v1",
        "blocks": [],
        "settings": {},
        "tolerations": {}
    }
)

print(f"Created flow: {flow.flow_id}")
print(f"Name: {flow.spec.name}")
flow = client.flows.create(
    spec={
        "name": "Production Flow",
        "schema": "v1",
        "blocks": [
            {
                "block": "data_loader",
                "settings": {"batch_size": 32},
                "style": {}
            }
        ],
        "settings": {"learning_rate": 0.001},
        "tolerations": {}
    },
    metadata={"environment": "production", "version": "1.0"}
)

Parameters

Name
Type
Description
Required
Default
spec
object
Flow specification including name, blocks, and settings. Accepts FlowSpec or dict.
Required
metadata
object
Optional metadata attributes as key-value pairs.
Optional
None

Returns: Flow


update()

Update an existing training flow. Uses PATCH semantics: only provided fields are modified.

flow = client.flows.update(
    flow_id="flow_abc123",
    spec={"name": "Updated Flow Name"}
)

print(f"Updated: {flow.spec.name}")
flow = client.flows.update(
    flow_id="flow_abc123",
    spec={"training_project": "project_xyz789"},
    metadata={"status": "active"}
)

Parameters

Name
Type
Description
Required
Default
flow_id
string
Flow identifier.
Required
spec
object
Partial flow specification with fields to update. Accepts FlowSpec or dict.
Optional
None
metadata
object
Optional metadata attributes to update.
Optional
None

Returns: Flow


Response types

Flow

from vi.api.resources.flows.responses import Flow

Properties

Name
Type
Description
Required
Default
organization_id
string
Organization ID
Optional
flow_id
string
Unique identifier
Optional
spec
object
Flow specification (FlowSpec)
Optional
metadata
object
Metadata
Optional
self_link
string
API link
Optional
etag
string
Entity tag
Optional

Methods: info() → prints a formatted flow summary.


FlowSpec

from vi.api.resources.flows.responses import FlowSpec

Properties

Name
Type
Description
Required
Default
name
string
Display name
Optional
schema
string
Schema version identifier
Optional
tolerations
object
Toleration rules
Optional
settings
object
Global settings
Optional
blocks
array
Pipeline blocks (FlowBlock)
Optional
training_project
string
Training project or dataset ID
Optional

FlowBlock

from vi.api.resources.flows.responses import FlowBlock

Properties

Name
Type
Description
Required
Default
block
string
Block type identifier
Optional
settings
object
Block-specific settings
Optional
style
object
UI display styling
Optional

Related resources

Runs API

Execute training runs from flows and check their status.

Models API

Download and inspect model checkpoints from completed runs.

Create A Workflow

UI guide for creating training workflows in Datature Vi.

Manage Workflows

Rename, duplicate, and delete training workflows.