Skip to content

fix: update BetaAsyncAbstractMemoryTool docstring to use async example#1312

Open
yuribodo wants to merge 1 commit intoanthropics:mainfrom
yuribodo:fix/async-memory-tool-docstring
Open

fix: update BetaAsyncAbstractMemoryTool docstring to use async example#1312
yuribodo wants to merge 1 commit intoanthropics:mainfrom
yuribodo:fix/async-memory-tool-docstring

Conversation

@yuribodo
Copy link
Copy Markdown

Summary

The BetaAsyncAbstractMemoryTool docstring example was copy-pasted from the synchronous BetaAbstractMemoryTool without being updated for async usage. Following the example verbatim raises TypeError at instantiation time.

Changes

  • Use BetaAsyncAbstractMemoryTool as the base class (was BetaAbstractMemoryTool)
  • Add async def to method definitions (was def)
  • Replace Anthropic() with AsyncAnthropic()
  • Wrap usage in async def main() / asyncio.run(main())

Before (broken)

class MyMemoryTool(BetaAbstractMemoryTool):  # wrong base class
    def view(self, command: ...):             # missing async
        ...
client = Anthropic()                          # sync client

After (fixed)

class MyMemoryTool(BetaAsyncAbstractMemoryTool):
    async def view(self, command: ...):
        ...
client = AsyncAnthropic()
await client.beta.messages.run_tools(...)

Fixes #1290

The docstring example was copy-pasted from the sync BetaAbstractMemoryTool
without being updated for async usage. Following it verbatim would raise
TypeError at instantiation time.

Changes:
- Use BetaAsyncAbstractMemoryTool as the base class
- Add async/await to method definitions
- Replace Anthropic() with AsyncAnthropic()
- Wrap usage in async def main() / asyncio.run(main())

Fixes anthropics#1290
@yuribodo yuribodo requested a review from a team as a code owner March 29, 2026 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BetaAsyncAbstractMemoryTool docstring contains sync-only example (copy-paste from sync class)

1 participant