Skip to main content
The Workflow class is the foundation of Fibonacci. It orchestrates node execution, manages dependencies, and handles the full workflow lifecycle from building to deployment and execution.

Constructor

Parameters

Class Methods

from_yaml

Load a workflow from a YAML file.
Parameters:
  • path (str): Path to the YAML workflow file
Returns: Workflow instance Example:

Instance Methods

add_node

Add a single node to the workflow.
Returns self for chaining:

add_nodes

Add multiple nodes at once.
Example:

get_node

Look up a node by ID.

remove_node

Remove a node from the workflow.

validate

Validate the workflow DAG (checks for cycles, missing dependencies, etc.).
Returns: True if valid, raises ValidationError otherwise.

deploy

Deploy the workflow to the Fibonacci platform.
Parameters:
  • api_key (str): API key to use for deployment. Falls back to the configured key if omitted.
  • validate (bool): Validate the workflow before deploying (default True).
Returns: workflow_id string — save this to run the workflow later. Raises: AuthenticationError, ValidationError, DeploymentError Example:

deploy_async

Async version of deploy().

run

Execute the workflow synchronously.
Parameters:
  • input_data (dict): Input data for the workflow.
  • workflow_id (str): Workflow ID to run. Uses the last deployed workflow if omitted.
  • wait (bool): Wait for the run to complete before returning (default True).
  • timeout (float): Maximum seconds to wait for completion (default 300.0).
  • secrets (dict): Runtime secrets injected into the workflow (e.g. {"SLACK_TOKEN": "xoxb-..."}).
Returns: WorkflowRunStatus with fields:
  • .status"completed", "failed", "running", etc.
  • .output_data — dict of node outputs keyed by node ID
  • .error_message — error details if status is "failed"
  • .total_cost — total cost of the run in USD
  • .nodes_executed — number of nodes that ran
Raises: AuthenticationError, ExecutionError, RateLimitError Example:

run_async

Async version of run().

get_status

Get the status of a specific run.

update

Update workflow metadata on the platform.

delete

Delete the deployed workflow.

activate / deactivate

Toggle a deployed workflow on or off without deleting it.

get_stats

Get aggregated statistics for the deployed workflow.
Returns: WorkflowStats with .total_runs, .success_rate, .avg_duration_seconds, .avg_cost.

to_yaml

Export the workflow to a YAML string (and optionally write to a file).

to_yaml_string

Export the workflow to a YAML string (always returns a string, never writes).

to_dict

Export the workflow as a Python dictionary.

Properties

workflow_id

The ID assigned after deployment. None if the workflow has not been deployed yet.

nodes

List of nodes currently in the workflow.

node_count

Number of nodes in the workflow.

YAML Workflows

Load a workflow from a YAML definition file:
Export an existing workflow to YAML:
See the YAML Workflows guide for the full YAML schema.

Complete Example