Skip to main content

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

pip install langchain-notepad-middleware

Usage

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.

Metadata

Release files for langchain-notepad-middleware 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langchain-notepad-middleware 0.1.1
File Size Uploaded
langchain_notepad_middleware-0.1.1.tar.gz 5.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for langchain-notepad-middleware 0.1.1
File Interpreter ABI Platform
langchain_notepad_middleware-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 12.0 kB

Release files / langchain_notepad_middleware-0.1.1.tar.gz

Download URL langchain_notepad_middleware-0.1.1.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
aa12bfe05d6dc05c171359105f98adf3ba31bebc49f895212d921b7aabad6711
BLAKE2b-256 checksum
How to use checksums
6ce2481a2c5bdb3783b707e29f657eb28b3b451a972cb269190a563db667ba5b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / langchain_notepad_middleware-0.1.1-py3-none-any.whl

Download URL langchain_notepad_middleware-0.1.1-py3-none-any.whl
Size 6.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
60a0a8b7ad9ac9004571333cc534f7a28d92d763c66eaceb7e5266f57696f3d8
BLAKE2b-256 checksum
How to use checksums
fc3f478f6dc336d34fed184a4c6b05ebf87b9b311e3cd05221be8751e2119acd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page