API Reference¶
LangGraphApp¶
LangGraphApp(auth_level=func.AuthLevel.ANONYMOUS, max_stream_response_bytes=1024 * 1024, max_request_body_bytes=1024 * 1024, max_input_depth=32, max_input_nodes=10000, platform_compat=False, _registrations=dict())
dataclass
¶
Wraps LangGraph compiled graphs into Azure Functions HTTP endpoints.
Usage::
from azure_functions_langgraph import LangGraphApp
app = LangGraphApp()
app.register(graph=compiled_graph, name="my_agent")
func_app = app.function_app
This auto-registers:
POST /api/graphs/{name}/invoke— synchronous invocationPOST /api/graphs/{name}/stream— buffered SSE response (not true streaming)GET /api/health— health check with registered graph listGET /api/graphs/{name}/threads/{thread_id}/state— thread state (StatefulGraph only)
Note
The graph argument must satisfy the :class:LangGraphLike protocol
(i.e. have .invoke() and .stream() methods). This avoids a
hard import dependency on langgraph at the library level.
Note
v0.1 streams are buffered — all chunks are collected and returned in a single SSE-formatted HTTP response. True streaming (chunked transfer encoding) is planned for a future release once Azure Functions Python HTTP streaming stabilises.
Note
The default auth_level is ANONYMOUS for local development
convenience. This will change to FUNCTION in v1.0. For production
deployments, always pass auth_level explicitly.
function_app
property
¶
Return an azure.functions.FunctionApp with all routes registered.
register(graph, name, description=None, stream=True, auth_level=None, *, request_model=None, response_model=None)
¶
Register a compiled LangGraph graph.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
Any
|
Any object satisfying :class: |
required |
name
|
str
|
Unique name for this graph (used in URL routes). |
required |
description
|
Optional[str]
|
Optional human-readable description. |
None
|
stream
|
bool
|
Whether to enable the stream endpoint for this graph. |
True
|
auth_level
|
Optional[AuthLevel]
|
Override app-level auth for this graph's endpoints.
When |
None
|
request_model
|
Optional[type[Any]]
|
Optional Pydantic model class for request body (used by the metadata / bridge API, not for runtime validation). |
None
|
response_model
|
Optional[type[Any]]
|
Optional Pydantic model class for response body (used by the metadata / bridge API, not for runtime validation). |
None
|
Raises:
| Type | Description |
|---|---|
TypeError
|
If graph does not satisfy the required protocol. |
ValueError
|
If name is already registered or invalid. |
Source code in src/azure_functions_langgraph/app.py
Request models¶
InvokeRequest¶
InvokeRequest
¶
Bases: BaseModel
Request body for graph invocation.
StreamRequest¶
StreamRequest
¶
Bases: BaseModel
Request body for graph streaming.
Response models¶
InvokeResponse¶
InvokeResponse
¶
Bases: BaseModel
Response body for graph invocation.
HealthResponse¶
HealthResponse
¶
Bases: BaseModel
Health check response.
ErrorResponse¶
ErrorResponse
¶
Bases: BaseModel
Error response body.
GraphInfo¶
GraphInfo
¶
Bases: BaseModel
Information about a registered graph.
Protocol interfaces¶
InvocableGraph¶
InvocableGraph
¶
Bases: Protocol
Protocol for a graph that supports synchronous invocation.
StreamableGraph¶
StreamableGraph
¶
Bases: Protocol
Protocol for a graph that supports synchronous streaming.
LangGraphLike¶
LangGraphLike
¶
Bases: InvocableGraph, StreamableGraph, Protocol
Protocol combining invoke and stream — matches LangGraph's CompiledStateGraph.