Skip to content

Basic Flow

Chaining is a signal chain: to() binds a handler to the current signal, completion emits a new signal for the next to().

Linear chain

python
from agently import TriggerFlow, TriggerFlowEventData

flow = TriggerFlow()

@flow.chunk
async def normalize(data: TriggerFlowEventData):
  return str(data.value).strip()

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

flow.to(normalize).to(greet).end()
print(flow.start(" Agently "))

Passing a function directly into to() is a convenience. For reusable, readable flows, define chunks first (see: Chunk section in Core Concepts).

side_branch

Side branches observe without changing the main signal chain.