The Functional API allows you to add LangGraph features like persistence, memory, human-in-the-loop (interrupts), and streaming to your existing code with minimal changes. Unlike the Graph API which requires a DAG structure, the Functional API works with standard language primitives like if statements, for loops, and function calls.
Key building blocks:
entrypoint: A wrapper that takes a function as the starting point of a workflow. It manages execution flow, long-running tasks, and interrupts.task: Represents a discrete unit of work (e.g., an API call) that can be executed asynchronously within an entrypoint. Tasks return a future-like object that can be awaited.