Quickstart
Alpha (0.1.x) — MIT licensed. Public API may change before 1.0.
Install
Section titled “Install”pip install lexigram-workflowMinimal example — Pipeline
Section titled “Minimal example — Pipeline”Create a simple multi-step pipeline, wire it via the module, and execute it.
import asyncio
from lexigram import Applicationfrom lexigram.workflow import Pipeline, step, WorkflowModule
async def main() -> None: app = Application(name="wf-demo")
# Wire the workflow subsystem app.add_module(WorkflowModule.configure())
async with Application.boot(name="wf-demo") as app: pipeline = Pipeline()
@step(name="greet") async def greet(ctx: dict) -> str: return f"Hello, {ctx.get('name', 'world')}!"
@step(name="shout") async def shout(ctx: dict) -> str: return str(ctx.get("greet", "")).upper()
pipeline.add_step(greet) pipeline.add_step(shout)
result = await pipeline.execute({"name": "Lexigram"}) print(result) # "HELLO, LEXIGRAM!"
asyncio.run(main())Minimal example — Graph workflow
Section titled “Minimal example — Graph workflow”For directed-graph workflows with branching and conditional routing:
from lexigram.workflow import WorkflowBuilder, WorkflowEnginefrom lexigram.workflow.graph.node import AbstractWorkflowNode
class GreetNode(AbstractWorkflowNode): name = "greet" async def execute(self, state: dict) -> dict: return {"message": f"Hello, {state.get('name', 'world')}!"}
class ShoutNode(AbstractWorkflowNode): name = "shout" async def execute(self, state: dict) -> dict: return {"message": state.get("message", "").upper()}
builder = WorkflowBuilder()builder.add_node(GreetNode())builder.add_node(ShoutNode())builder.add_edge("greet", "shout")
engine = WorkflowEngine(builder.build())result = await engine.execute("greet", initial_state={"name": "Lexigram"})if result.is_ok(): wf_result = result.unwrap() print(wf_result.final_state)Wiring
Section titled “Wiring”from lexigram.workflow import WorkflowModule
app.add_module(WorkflowModule.configure())configure() accepts an optional BulkOperationConfig and optional SagaStoreProtocol for durable saga state. The module exports PipelineProtocol.
Next steps
Section titled “Next steps”- GUIDE.md — pipelines, graph workflows, sagas, bulk operations
- ARCHITECTURE.md — internal design, providers, container bindings
- CONFIGURATION.md — every config key with defaults
- HOWTOS.md — graph branching, sagas, state persistence, versioning
- API.md — full reference