Python
The Python authoring package is trigora in trigora-python. It does not start Executions. The HTTP client is trigora-client, imported as trigora_client. The CLI compiles and deploys.
from trigora import effect, program, wait_for_event
@programasync def approval(): result = await effect("generate", lambda: 42) review = await wait_for_event("approved") return {"result": result, "review": review}The program id is the file stem, not the function name.
Supported syntax
Section titled “Supported syntax”- Exactly one top-level
@programasync function. Parameters are plain. Defaults are compile-time constants:None, a bool, a finite number, or a string. See Programs. effect(name, fn),wait_for_event(name),sleep(duration), andinvoke(name, *args). Durable operations stay in the program entry.await gather(...)andawait race(...), includingreturn await. Each takes 1–32 direct durable calls. See Structured concurrency.- String-literal effect keys and event names.
- Ordinary computation between durable operations, including objects, arrays, helpers, nested functions, and lambdas. A name assigned in a nested function is a new local unless it is declared
nonlocal. See Supported language semantics.
from trigora import effect, gather
found = await gather( effect("a", lambda: 1), effect("b", lambda: 2),)gather returns one value. Assign it to one local.
Unsupported syntax
Section titled “Unsupported syntax”- Zero or two
@programfunctions, a sync@program, or a bareasync defwith no marker. *args, keyword-only parameters, positional-only parameters, or a mutable literal default on the entry.- A bare
gather(...)orrace(...), an assignment of the call beforeawait, a stored awaitable, a pre-awaited argument,*args, a list, or a nestedgatherorrace. asyncio.gather,asyncio.wait, andasyncio.FIRST_COMPLETED.- Calling the entry yourself. Use
trigora devor Cloud.
Compile with the trigora CLI. See Install and Python client.