Summary
Currently, Graph only exposes a .launch() method, which is great for interactive and UI-based workflows (e.g. Gradio apps). However, this design limits the use of Graph in programmatic, server-side, and API-driven contexts.
This issue proposes introducing a .invoke() method, similar to how LangGraph works, enabling graphs to be executed as pure functions and easily exposed as APIs.
Motivation
Many real-world use cases require graphs to be:
- Executed headlessly (without UI)
- Integrated into REST / FastAPI / serverless APIs
- Used in pipelines, backends, or microservices
- Composable and callable like regular Python functions
Summary
Currently,
Graphonly exposes a.launch()method, which is great for interactive and UI-based workflows (e.g. Gradio apps). However, this design limits the use ofGraphin programmatic, server-side, and API-driven contexts.This issue proposes introducing a
.invoke()method, similar to how LangGraph works, enabling graphs to be executed as pure functions and easily exposed as APIs.Motivation
Many real-world use cases require graphs to be: