Skip to main content
Use these recipes to compose Functional API workflows from entrypoint and task building blocks. For concepts, see the Functional API overview. For an ordered build path, see the Build checklist for the Functional API. The examples use an in-memory checkpointer so results persist on a thread.

Create a simple workflow

This is the even/odd flow from Choosing between Graph and Functional APIs. This version adds a checkpointer so the run has a thread.
An entrypoint takes one positional argument as input. To pass multiple fields, use a dictionary:

Run tasks in parallel

A task starts as soon as you call it and returns a Promise. Collect those promises first, then wait with Promise.all so the work overlaps. This pattern helps I/O-bound work, for example LLM API calls.
Each task generates a paragraph on a different topic. Results join into one string.

Call a graph

The Functional API and the Graph API share the same runtime. A compiled graph is another callable: invoke it from an entrypoint like any other function. A nested graph does not share the outer thread unless you pass config into invoke. Request the injected config on the entrypoint and forward it.

Call other entrypoints

You can call other entrypoints from within an entrypoint or a task. When the child is defined without a checkpointer, invoking it from a parent that has one uses the parent’s checkpointer. Invoking the child on its own does not persist unless you pass a checkpointer.

See also