Metadata-Version: 2.4
Name: langchain-notepad-middleware
Version: 0.1.1
Summary: A LangChain agent middleware that provides a plain-text scratchpad/notepad.
Author-email: Izzet Sezer <sezer@imsezer.com>
License: MIT
Project-URL: Homepage, https://github.com/izzet-sezer/NotePadMiddleware
Project-URL: Repository, https://github.com/izzet-sezer/NotePadMiddleware
Project-URL: Issues, https://github.com/izzet-sezer/NotePadMiddleware/issues
Keywords: langchain,middleware,notepad,scratchpad,agent
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: langchain>=0.1.0
Requires-Dist: langchain-core>=0.1.0
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Dynamic: license-file

# LangChain Notepad Middleware

A production-grade LangChain middleware that provides a plain-text persistent "scratchpad" (notepad) for agents to store intermediate state across multi-hop tasks.

## Installation

```bash
pip install langchain-notepad-middleware
```

## Usage

```python
from langchain.agents import create_agent
from langchain_middleware_notepad import NotePadMiddleware

# Create an agent with the middleware
agent = create_agent(
    model="openai:gpt-4o",
    tools=[...],  # Your other tools
    middleware=[NotePadMiddleware()],
)
```

## How it Works

The middleware injects a system prompt instructing the model to use the notepad for scratchpad memory. It also registers 5 tools for manipulating the notepad state:

1.  **`notepad_append(text)`**: Append text to the note.
2.  **`notepad_replace(text)`**: Overwrite the entire note.
3.  **`notepad_read()`**: Read the current note content.

The state is stored in a simple string field `notepad` within the agent state.
