@entrypoint and @task so Agent Server can run it with persistence, streaming, and tracing.
Graph API (default)
Choose the Graph API when you build with LangGraph itself:- Explicit shared state across nodes
- Conditional branching and parallel paths that merge later
- Graph diagrams for debugging and documentation
- Team review of workflow structure
Functional API (other frameworks)
Choose the Functional API when you already have an agent in another framework and want LangSmith Deployment features without rewriting that agent as a graph:- Minimal changes to existing procedural or framework code
- Standard control flow (
if/else, loops, function calls) - Function-scoped values instead of a shared state schema
Side-by-side shape
The same small workflow looks different in each API. This example classifies a number, then returns a message:
You can still combine both APIs in one application when a linear Functional API sub-workflow sits inside a Graph API coordinator, or the reverse.
See also
- Build checklist for the Graph API
- Thinking in the Graph API
- Graph API overview
- Choose the unit of work
- Deploy other frameworks
- Functional API overview
Connect these docs to your agent of choice via MCP for real-time answers.

