This page contains reference documentation for Anthropic Middleware. See the docs for conceptual guides, tutorials, and examples on using Anthropic Middleware.
Provider-specific middleware for Anthropic's Claude models:
| CLASS | DESCRIPTION |
|---|---|
AnthropicPromptCachingMiddleware |
Reduce costs by caching repetitive prompt prefixes |
ClaudeBashToolMiddleware |
Execute Claude's native bash tool with local command execution |
StateClaudeTextEditorMiddleware |
Provide Claude's text editor tool for state-based file editing |
FilesystemClaudeTextEditorMiddleware |
Provide Claude's text editor tool for filesystem-based file editing |
StateClaudeMemoryMiddleware |
Provide Claude's memory tool for state-based persistent agent memory |
FilesystemClaudeMemoryMiddleware |
Provide Claude's memory tool for filesystem-based persistent agent memory |
StateFileSearchMiddleware |
Search tools for state-based file systems |
Prompt Caching Middleware.
Optimizes API usage by caching conversation prefixes for Anthropic models.
Requires both langchain and langchain-anthropic packages to be installed.
The middleware ta
Middleware that exposes Anthropic's native bash tool to models.
State-based text editor tool middleware.
Provides Anthropic's text_editor tool using LangGraph state for storage.
Files persist for the conversation thread.
Filesystem-based text editor tool middleware.
Provides Anthropic's text_editor tool using local filesystem for storage.
User handles persistence via volumes, git, or other mechanisms.
State-based memory tool middleware.
Provides Anthropic's memory tool using LangGraph state for storage. Files persist for the conversation thread.
Enforces /memories prefix and injects Anthropic's
Filesystem-based memory tool middleware.
Provides Anthropic's memory tool using local filesystem for storage. User handles persistence via volumes, git, or other mechanisms.
Enforces /memories pre
Provides Glob and Grep search over state-based files.
This middleware adds two tools that search through virtual files in state: