Metadata-Version: 2.4
Name: deepagents-graph-memory
Version: 0.1.6
Summary: Graph-backed context scratchpad for LangChain Deep Agents.
Author-email: Pranav Bedi <pranavbedi80@gmail.com>, Taha Khan <ktaha2005.net@gmail.com>
License-Expression: MIT
Project-URL: Repository, https://github.com/TahaK29/deepagents-graph-memory
Project-URL: Documentation, https://github.com/TahaK29/deepagents-graph-memory#readme
Project-URL: Issues, https://github.com/TahaK29/deepagents-graph-memory/issues
Keywords: deepagents,langchain,langgraph,context,graph,ladybug
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
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
Requires-Python: <3.15,>=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: licenses/OpenSSL.txt
Requires-Dist: deepagents>=0.6.10
Requires-Dist: langchain-core<2.0.0,>=1.4.0
Requires-Dist: wcmatch>=10.1
Provides-Extra: test
Requires-Dist: ladybug==0.20.3; extra == "test"
Requires-Dist: pytest>=8.0.0; extra == "test"
Requires-Dist: pytest-asyncio>=1.0.0; extra == "test"
Requires-Dist: ruff<0.16.0,>=0.12.2; extra == "test"
Dynamic: license-file

# deepagents-graph-memory

[![PyPI](https://img.shields.io/pypi/v/deepagents-graph-memory)](https://pypi.org/project/deepagents-graph-memory/)
[![Python 3.11–3.14](https://img.shields.io/badge/Python-3.11%E2%80%933.14-3776AB)](https://python.org)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)

**Give your agent a record of what it tried and what worked.**

For developers building LangChain Deep Agents that handle long-running tasks
and need to remember a lot of context. The graph connects attempts, evidence,
and results so agents can find earlier work before deciding what to do next.

**Works alongside the virtual filesystem (VFS):** files hold code, logs, and tool
dumps; the graph links findings to their evidence.
For example: **failing test → suspected cause → code change → test result**.

<p align="center">
  <img src="https://raw.githubusercontent.com/TahaK29/deepagents-graph-memory/main/assets/vgs-graph.png" alt="Virtual Graph System: connected reasoning traces" width="50%">
</p>

Inspired by Niels de Jong's Neo4j article,
[From recall to reasoning: How context graphs upgrade an agent’s brain](https://neo4j.com/blog/genai/from-recall-to-reasoning-how-context-graphs-upgrade-an-agents-brain/).
Built by **Pranav Bedi and Taha Khan**, using LadybugDB. Experimental.

## Install

```bash
pip install --upgrade deepagents-graph-memory
```

Requires Python 3.11–3.14 on a [supported platform](https://github.com/TahaK29/deepagents-graph-memory/blob/main/docs/guide.md#requirements).
The graph database, OpenSSL, and search extension come bundled. No database server
or separate search setup. Intel Macs have an upstream dependency build requirement;
see the platform details above.

## Quick start

Set your model provider's API key, then add the graph tools and guidance to your agent:

```python
from deepagents import create_deep_agent
from deepagents_graph_memory import (
    GraphMemoryBackend,
    graph_context_middleware,
    graph_memory_tools,
)

graph = GraphMemoryBackend.create()
agent = create_deep_agent(
    model="google_genai:gemini-3.5-flash",
    tools=graph_memory_tools(graph),
    middleware=[graph_context_middleware()],
)

# Use agent.invoke(...) in your application.
# Close the graph after the agent and all its workers finish:
# graph.close()
```

## Storage options

`GraphMemoryBackend.create()` keeps the graph temporarily while the backend is
open. Use `GraphMemoryBackend.create(path="project.lbdb")` to keep it on a
persistent disk across runs.

The [full guide](https://github.com/TahaK29/deepagents-graph-memory/blob/main/docs/guide.md)
covers deployment, shared agents, graph-only mode, and debugging. Agents choose
what to record; the graph doesn't automatically verify their claims.

[Report an issue](https://github.com/TahaK29/deepagents-graph-memory/issues) · [MIT license](https://github.com/TahaK29/deepagents-graph-memory/blob/main/LICENSE)
