diff --git a/src/anthropic/lib/tools/_beta_builtin_memory_tool.py b/src/anthropic/lib/tools/_beta_builtin_memory_tool.py index 4e9a55ddc..05a10c944 100644 --- a/src/anthropic/lib/tools/_beta_builtin_memory_tool.py +++ b/src/anthropic/lib/tools/_beta_builtin_memory_tool.py @@ -176,25 +176,32 @@ class BetaAsyncAbstractMemoryTool(BetaAsyncBuiltinFunctionTool): Example usage: ```py - class MyMemoryTool(BetaAbstractMemoryTool): - def view(self, command: BetaMemoryTool20250818ViewCommand) -> BetaFunctionToolResultType: + import asyncio + + + class MyMemoryTool(BetaAsyncAbstractMemoryTool): + async def view(self, command: BetaMemoryTool20250818ViewCommand) -> BetaFunctionToolResultType: ... return "view result" - def create(self, command: BetaMemoryTool20250818CreateCommand) -> BetaFunctionToolResultType: + async 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-5-5", - messages=[{"role": "user", "content": "Remember that I like coffee"}], - tools=[memory_tool], - ).until_done() + async def main() -> None: + client = AsyncAnthropic() + memory_tool = MyMemoryTool() + message = await client.beta.messages.run_tools( + model="claude-sonnet-5-5", + messages=[{"role": "user", "content": "Remember that I like coffee"}], + tools=[memory_tool], + ).until_done() + + + asyncio.run(main()) ``` """