Skip to content

TriggerFlow Overview

In production you usually want signals to trigger work immediately, not wait for a static DAG. TriggerFlow is built around when → to → emit.

Core mechanism: when → to → emit

  • when waits/listens and opens a branch
  • to binds and runs a handler
  • completion (implicitly or explicitly) emit(s) a signal that downstream to or when can react to

Trigger types

  • event: explicit emit()
  • runtime_data: set_runtime_data() triggers events by key
  • flow_data: set_flow_data() triggers events for all executions

Minimal example

python
from agently import TriggerFlow, TriggerFlowEventData

flow = TriggerFlow()

@flow.chunk
async def greet(data: TriggerFlowEventData):
  return f"Hello, {data.value}"

flow.to(greet).end()
result = flow.start("Agently")
print(result)

Next: Core Concepts.