Workflow class is the foundation of Fibonacci. It orchestrates node execution, manages dependencies, and handles workflow lifecycle.
Constructor
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
name | str | Required | Unique workflow identifier |
description | str | None | Human-readable description |
version | str | None | Semantic version (e.g., “1.0.0”) |
timeout | int | None | Maximum execution time in seconds |
memory_config | MemoryConfig | None | Memory backend configuration |
default_retry | RetryConfig | None | Default retry settings for nodes |
input_schema | dict | None | JSON Schema for input validation |
output_schema | dict | None | JSON Schema for output validation |
error_handler | Callable | None | Custom error handler function |
hooks | dict | None | Lifecycle hook functions |
allow_partial_results | bool | False | Return results from successful nodes on failure |
Class Methods
from_yaml
Load a workflow from a YAML file.path(str): Path to YAML workflow file
Workflow instance
Example:
from_yaml_string
Load a workflow from a YAML string.yaml_content(str): YAML content as string
Workflow instance
Example:
from_yaml_url
Load a workflow from a remote URL.url(str): URL to YAML workflow file
Workflow instance
Example:
Instance Methods
add_node
Add a node to the workflow.node(Node): Node instance (LLMNode, ToolNode, etc.)
Workflow (for chaining)
Example:
remove_node
Remove a node from the workflow.node_id(str): ID of node to remove
Workflow (for chaining)
Raises: WorkflowError if node not found or has dependents
get_node
Get a node by ID.node_id(str): Node identifier
Node instance or None
validate
Validate workflow configuration.ValidationResult with valid, errors, and warnings
Example:
execute
Execute the workflow synchronously.inputs(dict): Input data for the workflowtimeout(int): Execution timeout (overrides workflow default)user_id(str): User identifier for memory scopingmetadata(dict): Additional execution metadata
dict with node outputs keyed by node ID
Raises: WorkflowError, NodeExecutionError, TimeoutError, ValidationError
Example:
execute_async
Execute the workflow asynchronously.execute()
Returns: dict with node outputs
Example:
deploy
Deploy the workflow to Fibonacci Cloud.environment(str): Target environmentversion(str): Version tagmessage(str): Deployment message
DeploymentResult with deployment details
to_yaml
Export workflow to YAML.path(str): Optional file path to write
to_dict
Export workflow to dictionary.Properties
nodes
List of nodes in the workflow.memory
Access workflow memory.execution_history
Get execution history.Hooks
Register lifecycle hooks for workflow events:Available Hooks
| Hook | Trigger | Context |
|---|---|---|
on_start | Workflow execution starts | workflow_name, inputs |
on_node_start | Node execution starts | node_id, inputs |
on_node_complete | Node execution completes | node_id, output, duration |
on_error | Error occurs | error, node_id, partial_results |
on_complete | Workflow completes | outputs, duration |
on_retry | Retry attempt | node_id, attempt, error |