Metadata-Version: 2.5
Name: kitaru-langgraph
Version: 0.4.0
Summary: LangGraph recording and replay adapter for Kitaru.
Project-URL: Homepage, https://kitaru.ai
Project-URL: Documentation, https://docs.zenml.io/kitaru/adapters/langgraph
Project-URL: Repository, https://github.com/zenml-io/kitaru
Project-URL: Issues, https://github.com/zenml-io/kitaru/issues
Project-URL: Changelog, https://github.com/zenml-io/kitaru/blob/develop/plugins/packages/langgraph/CHANGELOG.md
Author-email: ZenML GmbH <info@zenml.io>
License-Expression: Apache-2.0
Keywords: ai-agents,kitaru,langgraph,recording,replay
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.11
Requires-Dist: genai-prices<0.2,>=0.1.1
Requires-Dist: kitaru>=0.27.7
Requires-Dist: langchain-core<2,>=1.5.3
Requires-Dist: langchain<2,>=1.3.14
Requires-Dist: langgraph<2,>=1.2.10
Provides-Extra: deepagents
Requires-Dist: deepagents<0.8,>=0.7.4; extra == 'deepagents'
Description-Content-Type: text/markdown

# Kitaru LangGraph adapter

Record and replay LangGraph agent runs with Kitaru.

## Install

```bash
uv add kitaru-langgraph
```

Install `kitaru-langgraph[deepagents]` to also record agents built with `deepagents.create_deep_agent` through `KitaruGraphRunner.from_agent_factory`. The `langchain.agents.create_agent` factory and direct graph wrapping work without the extra.

## Model providers

This distribution does not install any model-provider packages. Model strings passed to `init_chat_model`, such as `"openai:gpt-5-nano"`, require the matching LangChain provider package (for example `langchain-openai`) in the agent environment. Install the provider package for each model your agent uses.

## Use

```python
import uuid

from langchain.agents import create_agent

from kitaru_langgraph import KitaruGraphRunner

runner = KitaruGraphRunner.from_agent_factory(
    create_agent,
    factory_kwargs={"model": "openai:gpt-5-nano", "tools": []},
    agent_id=uuid.UUID("018f0000-0000-7000-8000-000000000100"),
)
result = runner.invoke({"messages": [{"role": "user", "content": "Hello"}]})
print(result)
```

Wrap an existing compiled graph directly with `KitaruGraphRunner(graph)` when you build the graph yourself. The runner accepts the same invocation arguments as the wrapped runnable. Kitaru workers provide task, replay, and authentication context through the standard task environment.

Replay support depends on how the graph was constructed. See the [LangGraph adapter guide and capability matrix](https://docs.zenml.io/kitaru/adapters/langgraph) for supported invocation methods, overrides, tool policies, interrupts, and failure behavior.

Before LangGraph 1.2.19, LangGraph trace policies could omit middleware span inputs before callbacks received them, so with Deep Agents 0.7.9 and later some built-in middleware spans record `inputs: {}`; this does not prove that the hook received empty state. LangGraph 1.2.19 and later apply trace policies only to LangChain tracers, so Kitaru records the state each hook received. Model and tool call inputs are recorded on every supported version. See the [adapter guide](https://docs.zenml.io/kitaru/adapters/langgraph) for details.

Deep Agents runs its built-in middleware before custom middleware, including Kitaru's. A built-in rejection, such as a parallel write to the same file, therefore takes precedence over Kitaru's static or history tool policy. Keeping the same Deep Agents version when replaying avoids changes to these built-in rules across versions.

Tool attempts that return a native result without executing a tool are recorded with `execution: short_circuited`. An error `ToolMessage` remains a completed result with its native error status, so history replay can return it to the model rather than turn it into a raised exception.

## Links

- [Kitaru documentation](https://docs.zenml.io/kitaru)
- [Source code](https://github.com/zenml-io/kitaru)
- [Issue tracker](https://github.com/zenml-io/kitaru/issues)

Licensed under Apache-2.0.
