Entrypoints

The entrypoint decorator on the graph is a helper tool to construct an async function which will open the graph and invoke a callable, and a no-argument synchronous method which will invoke the async function.

For example, the following entrypoint:

@graph.entrypoint
def main(foo: Foo) -> None:
    ...

Is roughly equivalent to:

def _main(foo: Foo) -> None:
    ...

async def _amain() -> None:
    return await graph.resolve(_main)

def main() -> None:
    asyncio.run(_amain())

Note

If your application invoves leveraging scopes, this helper should be avoided.
Only one request scope will be used for the eniterity of the entrypoint call.