Flows

Flow resource

Access flows through client.flows in the Vi SDK.

Flows represent training workflows that define how models are trained, including dataset configuration, model architecture, hyperparameters, and training schedules. Flows can be executed to create training runs.

📋

Prerequisites

Get started with Vi SDK →


Methods

list()

List all training workflows in your organization.

# Basic listing
flows = client.flows.list()

for flow in flows.items:
    print(f"Flow: {flow.flow_id}")
    print(f"Created: {flow.metadata.time_created}")
# Iterate through all pages with details
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)}")
# Find recent flows (last 7 days)
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")
# Collect all flows
all_flows = list(client.flows.list().all_items())
print(f"Total flows: {len(all_flows)}")

Parameters:

ParameterTypeDescriptionDefault
paginationPaginationParamsPagination settingsNone

Returns: PaginatedResponse[Flow]


get()

Get a specific training flow.

# Basic usage
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)}")
# Display detailed information
flow = client.flows.get("flow_abc123")
flow.info()  # Prints formatted flow summary
# Inspect flow blocks
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}")
# Access flow settings
flow = client.flows.get("flow_abc123")

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

# Tolerations
print("\nTolerations:")
for key, values in flow.spec.tolerations.items():
    print(f"  {key}: {values}")
# Access specific properties
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:

ParameterTypeDescription
flow_idstrFlow identifier

Returns: Flow


delete()

Delete a training flow.

# Delete a flow
deleted = client.flows.delete("flow_abc123")
# Delete with confirmation
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:

ParameterTypeDescription
flow_idstrFlow identifier

Returns: DeletedFlow


Response types

Flow

Main flow response object.

from vi.api.resources.flows.responses import Flow
PropertyTypeDescription
organization_idstrOrganization ID
flow_idstrUnique identifier
specFlowSpecFlow specification
metadataResourceMetadataMetadata
self_linkstrAPI link
etagstrEntity tag

Methods:

MethodReturnsDescription
info()NoneDisplay formatted flow information

FlowSpec

from vi.api.resources.flows.responses import FlowSpec
PropertyTypeDescription
namestrDisplay name
schemastrSchema version identifier
tolerationsdict[str, list[str]]Toleration rules
settingsdict[str, Any]Global settings
blockslist[FlowBlock]Pipeline blocks
training_projectstr | NoneTraining project/dataset ID

FlowBlock

from vi.api.resources.flows.responses import FlowBlock
PropertyTypeDescription
blockstrBlock type identifier
settingsdict[str, Any]Block-specific settings
styledict[str, Any]UI/display styling

Related resources