Skip to content
Trigora
Start building →

invoke

function invoke(program: string, ...args: unknown[]): Promise<unknown>
def invoke(name: str, *args: object) -> object
invoke(child, args).await?

Rust takes one owned value. A tuple is the argument vector. A bare value is a one-element vector. () is empty.

  • program / name / child — program id. TypeScript uses the named default export or the file stem. Python uses the file stem. Rust Program ids use the source file stem. For lib.rs and main.rs, the Cargo package name is used instead.
  • The remaining values are the ordered argument vector. invoke(name) supplies []. An explicit null or None is one element, not an empty vector. Binding follows the child’s language. See Programs.

The child Execution’s result, after the child completes.

invoke starts one child and suspends the parent with { type: "child", executionId }. The child has its own continuation and artifact pin. A committed child result is reused if the parent resumes. The child is not created again for that invoke.

Several invoke calls can sit inside await Promise.all / await Promise.race, await gather / await race, or Rust join / race. See Structured concurrency. A race winner does not cancel a sibling child that already started.

  • An empty program name fails the compile or the start.
  • If the child fails, the parent sees that failure at invoke.
  • Outside an Execution, the call fails.
export default async function analyze(topic, limit = 1) {
return { topic, limit };
}
import { invoke } from "@trigora/sdk";
export default async function research() {
return await invoke("analyze", "tcc", 2);
}

The Python child lives in analyze.py. The program id is the file stem.

from trigora import invoke, program
@program
async def analyze(topic, limit=1):
return {"topic": topic, "limit": limit}
from trigora import invoke, program
@program
async def research():
return await invoke("analyze", "tcc", 2)