LangGraph Azure Function Agents
Project description
langgraph-func
Expose LangGraph workflows as Azure Function HTTP endpoints.
Installation
poetry add langgraph_func
Requires Python ≥3.10, LangGraph, Azure Functions SDK.
Define a Workflow
from pydantic import BaseModel
from langgraph.graph import StateGraph, START
from typing import Optional
class Input(BaseModel):
input_text: str
class Output(BaseModel):
update: Optional[str] = None
class MergedState(Input, Output):
pass
def test(state: MergedState) -> dict:
return {"update": "ok"}
compiled_graph = StateGraph(input=Input, output=Output) \
.add_node("test", test) \
.add_edge(START, "test") \
.set_finish_point("test") \
.compile(name="test_graph")
Configuration (function-app.yml)
swagger:
title: Test Function App
version: 1.0.0-beta
auth: FUNCTION
ui_route: docs
blueprints:
blueprint_a:
path: blueprint_a
description: |
Groups related graphs.
graphs:
graphA:
path: graphA
source: graphs.graph
auth: FUNCTION
description: |
GraphA ingests raw input.
parentGraph:
path: parentGraph
source: graphs.parent_graph
auth: FUNCTION
description: |
Calls a subgraph from a parent.
Run in Azure Functions
from langgraph_func.func_app_builder.create_app import create_app_from_yaml
app = create_app_from_yaml("function-app.yml")
Deploy with func azure functionapp publish <APP_NAME>.
Calling Subgraphs
class Input(BaseModel):
input_text: str
class Output(BaseModel):
child_update: Optional[str] = None
# create one invoker instance
subgraph = AzureFunctionInvoker(
function_path="blueprint_a/graphA",
base_url=settings.function_base_url,
input_field_map={"input_text": "text"},
output_field_map={"updates": "child_update"},
auth_key=FunctionKeySpec.INTERNAL,
)
compiled_graph = (
StateGraph(input=Input, output=Output)
.add_node("call_graphA", subgraph)
.add_edge(START, "call_graphA")
.set_finish_point("call_graphA")
.compile()
)
Documentation
See GitHub Pages for full API reference and examples.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
langgraph_func-0.3.9.tar.gz
(38.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file langgraph_func-0.3.9.tar.gz.
File metadata
- Download URL: langgraph_func-0.3.9.tar.gz
- Upload date:
- Size: 38.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7849b7fe2f6c5429f61da610011fbcf76d22664007856856740f6e84b9e80b67
|
|
| MD5 |
0f4e0a9c9e602a51e7e5953170367e22
|
|
| BLAKE2b-256 |
98cd53fca3f44cfd96d24da09ae9af55ae731c1dd8d64e3a0d71d360230efeb1
|
File details
Details for the file langgraph_func-0.3.9-py3-none-any.whl.
File metadata
- Download URL: langgraph_func-0.3.9-py3-none-any.whl
- Upload date:
- Size: 60.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
65a7cdfcfe114f89571cbeebbe64f98dbc368d58258693e67fa35ce2eb302465
|
|
| MD5 |
f978633e40b49773e0e69bf2c880fb31
|
|
| BLAKE2b-256 |
9cbfe716d45a0b4cdf5f80a0891b9295b864792525f0d633096c2a4ea7dc9830
|