跳转至

函数式 API

task

zerograph.func.task

task(func: Callable) -> Callable

Decorator to mark a function as a discrete work unit.

The decorated function returns a _TaskFuture instead of executing immediately. Call .result() to get the value synchronously or await .aresult() for async execution.

entrypoint

zerograph.func.entrypoint

entrypoint(
    checkpointer: BaseCheckpointSaver | None = None,
    store: Any | None = None,
) -> Callable

Decorator to mark a function as a workflow entry point.

Usage

@entrypoint(checkpointer=InMemorySaver()) def workflow(inp, *, previous=None, store=None, config=None, writer=None): result = my_task(inp["x"]) return result.result()

workflow.invoke({"x": 1})