Metadata-Version: 2.3
Name: langgraph_func
Version: 0.3.2
Summary: LangGraph Azure Function Agents
Author: job van Creij jobvancreij@gmail.com
Requires-Python: >=3.10,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Dist: azure-functions
Requires-Dist: dacite
Requires-Dist: langgraph
Requires-Dist: openapi-schema-pydantic
Requires-Dist: pydantic
Requires-Dist: requests
Project-URL: Documentation, https://jobaibv.github.io/langgraph_func/
Description-Content-Type: text/markdown

# langgraph-func

[![Docs](https://img.shields.io/badge/docs-latest-blue)](https://jobaibv.github.io/langgraph_func/)

**Expose LangGraph workflows as Azure Function HTTP endpoints.**

## Installation

```bash
poetry add langgraph_func
```

*Requires Python ≥3.10, LangGraph, Azure Functions SDK.*

## Define a Workflow

```python
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)

```yaml
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

```python
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

```python
from langgraph_func.graph_helpers.call_subgraph import call_subgraph, FunctionKeySpec

def test(state, **kwargs):
    output = call_subgraph(
        state=state,
        function_path="blueprint_a/graphA",
        payload_builder=lambda s: {"input_text": s.input_text},
        base_url=kwargs.get("function_base_url"),
        function_key=FunctionKeySpec.INTERNAL
    )
    return {"child_update": output["update"]}
```

## Documentation

See [GitHub Pages](https://jobaibv.github.io/langgraph_func/) for full API reference and examples.

