_beta_builtin_memory_tool.py — anthropic-sdk-python Source File
Architecture documentation for _beta_builtin_memory_tool.py, a python file in the anthropic-sdk-python codebase. 8 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR ca69ff78_767e_b6e6_385a_2992d126613b["_beta_builtin_memory_tool.py"] 181147dc_44bb_d809_7c9c_46aedfe56891["_models"] ca69ff78_767e_b6e6_385a_2992d126613b --> 181147dc_44bb_d809_7c9c_46aedfe56891 a7a22ac1_2fc9_eecb_0faf_2daedac42d29["types.beta"] ca69ff78_767e_b6e6_385a_2992d126613b --> a7a22ac1_2fc9_eecb_0faf_2daedac42d29 2f4a4b61_2541_5c7b_c70e_93f4b752f987["_beta_functions.py"] ca69ff78_767e_b6e6_385a_2992d126613b --> 2f4a4b61_2541_5c7b_c70e_93f4b752f987 6f841778_0364_167a_4fa4_ad1b5aa754ea["BetaBuiltinFunctionTool"] ca69ff78_767e_b6e6_385a_2992d126613b --> 6f841778_0364_167a_4fa4_ad1b5aa754ea a076b136_74cf_8d21_4bad_0286750910e3["BetaAsyncBuiltinFunctionTool"] ca69ff78_767e_b6e6_385a_2992d126613b --> a076b136_74cf_8d21_4bad_0286750910e3 90b87fb1_b7c6_6103_fd94_a71d362551d6["abc"] ca69ff78_767e_b6e6_385a_2992d126613b --> 90b87fb1_b7c6_6103_fd94_a71d362551d6 89ddcdd7_3ae1_4c7b_41bb_9f1e25f16875["typing"] ca69ff78_767e_b6e6_385a_2992d126613b --> 89ddcdd7_3ae1_4c7b_41bb_9f1e25f16875 37c05070_ca59_d596_7250_de9d1939227f["typing_extensions"] ca69ff78_767e_b6e6_385a_2992d126613b --> 37c05070_ca59_d596_7250_de9d1939227f 2b8fa660_e748_2488_1ba2_f56d432cc4d4["__init__.py"] 2b8fa660_e748_2488_1ba2_f56d432cc4d4 --> ca69ff78_767e_b6e6_385a_2992d126613b style ca69ff78_767e_b6e6_385a_2992d126613b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
from __future__ import annotations
from abc import abstractmethod
from typing import TYPE_CHECKING, Any, cast
from typing_extensions import override, assert_never
from ..._models import construct_type_unchecked
from ...types.beta import (
BetaMemoryTool20250818Param,
BetaMemoryTool20250818Command,
BetaCacheControlEphemeralParam,
BetaMemoryTool20250818ViewCommand,
BetaMemoryTool20250818CreateCommand,
BetaMemoryTool20250818DeleteCommand,
BetaMemoryTool20250818InsertCommand,
BetaMemoryTool20250818RenameCommand,
BetaMemoryTool20250818StrReplaceCommand,
)
from ._beta_functions import BetaBuiltinFunctionTool, BetaFunctionToolResultType, BetaAsyncBuiltinFunctionTool
class BetaAbstractMemoryTool(BetaBuiltinFunctionTool):
"""Abstract base class for memory tool implementations.
This class provides the interface for implementing a custom memory backend for Claude.
Subclass this to create your own memory storage solution (e.g., database, cloud storage, encrypted files, etc.).
Example usage:
```py
class MyMemoryTool(BetaAbstractMemoryTool):
def view(self, command: BetaMemoryTool20250818ViewCommand) -> BetaFunctionToolResultType:
...
return "view result"
def create(self, command: BetaMemoryTool20250818CreateCommand) -> BetaFunctionToolResultType:
...
return "created successfully"
# ... implement other abstract methods
client = Anthropic()
memory_tool = MyMemoryTool()
message = client.beta.messages.run_tools(
model="claude-sonnet-4-5",
messages=[{"role": "user", "content": "Remember that I like coffee"}],
tools=[memory_tool],
).until_done()
```
"""
def __init__(self, *, cache_control: BetaCacheControlEphemeralParam | None = None) -> None:
super().__init__()
self._cache_control = cache_control
@override
def to_dict(self) -> BetaMemoryTool20250818Param:
param: BetaMemoryTool20250818Param = {"type": "memory_20250818", "name": "memory"}
// ... (186 more lines)
Domain
Subdomains
Dependencies
- BetaAsyncBuiltinFunctionTool
- BetaBuiltinFunctionTool
- _beta_functions.py
- _models
- abc
- types.beta
- typing
- typing_extensions
Imported By
Source
Frequently Asked Questions
What does _beta_builtin_memory_tool.py do?
_beta_builtin_memory_tool.py is a source file in the anthropic-sdk-python codebase, written in python. It belongs to the ExtensibilityTools domain, ToolRunner subdomain.
What does _beta_builtin_memory_tool.py depend on?
_beta_builtin_memory_tool.py imports 8 module(s): BetaAsyncBuiltinFunctionTool, BetaBuiltinFunctionTool, _beta_functions.py, _models, abc, types.beta, typing, typing_extensions.
What files import _beta_builtin_memory_tool.py?
_beta_builtin_memory_tool.py is imported by 1 file(s): __init__.py.
Where is _beta_builtin_memory_tool.py in the architecture?
_beta_builtin_memory_tool.py is located at src/anthropic/lib/tools/_beta_builtin_memory_tool.py (domain: ExtensibilityTools, subdomain: ToolRunner, directory: src/anthropic/lib/tools).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free