Blueprint & Executions
Blueprints and executions solve two practical problems:
- Reuse: package a flow as a reusable template
- Concurrency: isolate per-request execution state
Below are scenario‑driven examples with output.
Scenario 1: reuse a flow template
Scenario: the same flow is reused across modules.
Solution: export with save_blue_print() and import with load_blue_print().
python
from agently import TriggerFlow, TriggerFlowEventData
flow = TriggerFlow()
@flow.chunk
async def upper(data: TriggerFlowEventData):
return str(data.value).upper()
flow.to(upper).end()
blueprint = flow.save_blue_print()
flow_2 = TriggerFlow()
flow_2.load_blue_print(blueprint)
result = flow_2.start("agently")
print(result)Output:
text
upper:AGENTLYScenario 2: multiple executions from one flow
Scenario: a shared Flow handles multiple user requests.
Solution: create one execution per request.
python
from agently import TriggerFlow, TriggerFlowEventData
flow = TriggerFlow()
@flow.chunk
def hello(data: TriggerFlowEventData):
return f"hello:{data.value}"
flow.to(hello).end()
exe_1 = flow.create_execution()
exe_2 = flow.create_execution()
print(exe_1.start("A"))
print(exe_2.start("B"))Output:
text
hello:A
hello:BIsolation rules
- runtime_data: execution‑scoped, isolated
- flow_data: flow‑scoped, shared across executions (use with care)