Skip to content

Getting Started

Install from PyPI:

Terminal window
pip install flexiflow

FlexiFlow ships with optional extras for common use cases:

Terminal window
pip install flexiflow[reload] # hot-reload with watchfiles
pip install flexiflow[api] # FastAPI integration
pip install flexiflow[dev] # pytest + coverage

The flexiflow CLI lets you register components, send messages, and hot-swap rules without writing Python.

Terminal window
flexiflow register --config examples/config.yaml --start
Terminal window
flexiflow handle --config examples/config.yaml confirm --content confirmed
flexiflow handle --config examples/config.yaml complete
Terminal window
flexiflow update_rules --config examples/config.yaml examples/new_rules.yaml

For programmatic control, use the engine directly:

from flexiflow.engine import FlexiFlowEngine
from flexiflow.config_loader import ConfigLoader
config = ConfigLoader.load_component_config("config.yaml")
engine = FlexiFlowEngine()
# Register and interact
component = engine.create_component(config)
await engine.handle_message(component.name, "start")
await engine.handle_message(component.name, "confirm", content="confirmed")

You can set FLEXIFLOW_CONFIG to point at your config file and omit --config from every CLI invocation:

Terminal window
export FLEXIFLOW_CONFIG=/path/to/config.yaml
flexiflow register --start
flexiflow handle confirm

Before running anything, you can validate and inspect your configuration:

from flexiflow import explain
result = explain("config.yaml")
if result.is_valid:
print(result.format())

This shows what components will be created, which states are registered, and flags any issues before you commit to a run.