Skip to content
Trigora
Start building →

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
@program
async 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.

  • Exactly one top-level @program async 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), and invoke(name, *args). Durable operations stay in the program entry.
  • await gather(...) and await race(...), including return 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.

  • Zero or two @program functions, a sync @program, or a bare async def with no marker.
  • *args, keyword-only parameters, positional-only parameters, or a mutable literal default on the entry.
  • A bare gather(...) or race(...), an assignment of the call before await, a stored awaitable, a pre-awaited argument, *args, a list, or a nested gather or race.
  • asyncio.gather, asyncio.wait, and asyncio.FIRST_COMPLETED.
  • Calling the entry yourself. Use trigora dev or Cloud.

Compile with the trigora CLI. See Install and Python client.