Using Redelay as the FlowDSL Backend
Redelay is a Python/FastAPI event framework — the first FlowDSL integration partner. It automatically generates AsyncAPI documents from Pydantic event models and provides the natural backend for Python-based FlowDSL flows.
What redelay is
Redelay is a Python library that lets you define events as Pydantic models and subscribe to them as FastAPI route handlers. It generates an AsyncAPI document from your Pydantic models automatically — no manual schema writing.
# redelay: define events as Pydantic models
from redelay import event, subscribe
from pydantic import BaseModel
class OrderPlaced(BaseModel):
order_id: str
customer_id: str
total: float
currency: str
@subscribe(OrderPlaced)
async def handle_order_placed(event: OrderPlaced):
# process the order
pass
Running this app with redelay serve generates an AsyncAPI document at /asyncapi.yaml:
asyncapi: "2.6.0"
info:
title: Order Service Events
version: "1.0.0"
channels:
orders/order-placed:
subscribe:
message:
$ref: "#/components/messages/OrderPlaced"
components:
messages:
OrderPlaced:
payload:
type: object
properties:
order_id: { type: string }
customer_id: { type: string }
total: { type: number }
currency: { type: string }
required: [order_id, customer_id, total, currency]
Connecting redelay to FlowDSL
Step 1: Start your redelay service
pip install redelay flowdsl-py
redelay serve --host 0.0.0.0 --port 8090
The AsyncAPI document is now available at http://localhost:8090/asyncapi.yaml.
Step 2: Reference it in FlowDSL
flowdsl: "1.0"
info:
title: Order Processing Flow
version: "1.0.0"
asyncapi: http://localhost:8090/asyncapi.yaml
nodes:
OrderReceived:
operationId: receive_order_event
kind: source
outputs:
out:
packet: "asyncapi#/components/messages/OrderPlaced"
ProcessOrder:
operationId: process_order
kind: action
inputs:
in:
packet: "asyncapi#/components/messages/OrderPlaced"
edges:
- from: OrderReceived
to: ProcessOrder
delivery:
mode: durable
packet: "asyncapi#/components/messages/OrderPlaced"
Step 3: Implement FlowDSL nodes as redelay handlers
The flowdsl-py package provides a redelay integration module that lets you run FlowDSL node handlers as redelay subscribers:
from redelay import subscribe
from flowdsl.redelay import as_flowdsl_node
from pydantic import BaseModel
class OrderPlaced(BaseModel):
order_id: str
customer_id: str
total: float
@subscribe(OrderPlaced)
@as_flowdsl_node(operation_id="process_order")
async def process_order(event: OrderPlaced):
# This handler is automatically registered as a FlowDSL node
# The FlowDSL runtime calls it when packets arrive on the edge
result = await charge_payment(event.order_id, event.total)
return {"orderId": event.order_id, "chargeId": result.charge_id}
Step 4: Register with the FlowDSL runtime
# node-registry.yaml
nodes:
process_order:
address: localhost:8090
runtime: python
version: "1.0.0"
How it fits together
flowchart LR
A["Pydantic models\n(redelay)"] -->|"auto-generates"| B["AsyncAPI doc\n/asyncapi.yaml"]
B -->|"referenced by"| C["FlowDSL document\nasyncapi: ..."]
C -->|"loaded by"| D["FlowDSL Runtime"]
D -->|"calls"| E["redelay handlers\n(FlowDSL nodes)"]
The Go integration — redelay/event-source node
The Go version of redelay ships a single configurable source node that
subscribes to any event on the bus. It lives in go-events/flowdsl and is
registered via a blank import (_ "github.com/redelay/go-events/flowdsl").
Where the old approach required one source node per event type (causing an N × M explosion as events and modules grew), the new approach is one node whose behavior is parameterized by settings:
on_order_placed:
kind: source
nodeType: redelay/event-source
settings:
eventName: orders.order_placed # enum populated at runtime
groupID: fulfillment-pipeline
filter: "payload.total > 100" # optional, server-side
outputs:
- name: Event
message:
$ref: "asyncapi:default#/components/schemas/EventMessage"
How Studio sees it. The eventName setting is a JSON Schema enum whose
values are injected server-side at spec-build time by walking the live module
registry. Studio users pick the event from a dropdown; new events registered
by any module appear automatically — no manifest regeneration required.
Output is always the generic envelope. The node emits EventMessage —
the common wrapper around every event. Per-event payload shape lives in the
AsyncAPI document; in FlowDSL flows, project payload fields via
{{.payload.*}} in edge transforms.
The Python SDK (flowdsl-py) will mirror this pattern once the Go version
stabilizes — reach for the same node ID (redelay/event-source) with
equivalent settings.
Benefits of the redelay integration
| Benefit | How |
|---|---|
| No schema duplication | Pydantic models → AsyncAPI → FlowDSL (one source of truth) |
| Type safety | Pydantic validation for all event schemas |
| FastAPI ecosystem | Use all FastAPI middleware, auth, and tooling |
| Auto-documented | redelay serves AsyncAPI UI at /asyncapi-ui |
| Incremental adoption | Add FlowDSL orchestration without rewriting existing handlers |
Summary
- redelay generates AsyncAPI from Pydantic models automatically
- Reference the generated AsyncAPI in your FlowDSL
asyncapifield - Use
flowdsl-py's redelay integration to run node handlers as redelay subscribers - FlowDSL handles orchestration; redelay handles Python event handling
Next steps
- AsyncAPI Integration — full AsyncAPI integration guide
- Writing a Python Node — implement nodes with
flowdsl-py - Python SDK Reference — full SDK API reference
Building and Publishing FlowDSL Nodes
How to develop, test, version, and publish FlowDSL nodes to the node registry.
Schema Source of Truth
How to assign each port schema to exactly one authoritative source — OpenAPI, AsyncAPI, or native packets — when your modules already expose both an HTTP API and an event bus.

