Skip to content

fix(docs): correct BetaAsyncAbstractMemoryTool docstring for async usage#1307

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

fix(docs): correct BetaAsyncAbstractMemoryTool docstring for async usage#1307
abdelhadi703 wants to merge 1 commit intoanthropics:mainfrom
abdelhadi703:fix/async-memory-tool-docstring

Conversation

@abdelhadi703
Copy link
Copy Markdown

Summary

The docstring example for BetaAsyncAbstractMemoryTool was copy-pasted from the synchronous BetaAbstractMemoryTool class without being updated for async usage, causing TypeError when following the example verbatim.

Bug Details

Three errors in the docstring example:

  1. Wrong base class: BetaAbstractMemoryTool (sync) → should be BetaAsyncAbstractMemoryTool
  2. Sync method definitions: def view(...) → should be async def view(...)
  3. Sync client: Anthropic() → should be AsyncAnthropic()

Changes

  • Use BetaAsyncAbstractMemoryTool as base class
  • Use async def for method definitions
  • Use AsyncAnthropic client
  • Add await to the run_tools call

Testing

The corrected example now works:

from anthropic import AsyncAnthropic
from anthropic.types.beta import BetaMemoryTool20250818ViewCommand

class MyMemoryTool(BetaAsyncAbstractMemoryTool):
    async def view(self, command: BetaMemoryTool20250818ViewCommand):
        return "view result"

client = AsyncAnthropic()
# ... works correctly

Fixes #1290

The docstring example for BetaAsyncAbstractMemoryTool was copy-pasted from
the synchronous BetaAbstractMemoryTool class without being updated for async
usage, causing TypeError when following the example verbatim.

Changes:
- Use BetaAsyncAbstractMemoryTool as base class (was BetaAbstractMemoryTool)
- Use async def for method definitions (was sync def)
- Use AsyncAnthropic client (was Anthropic)
- Add await to the run_tools call

Fixes anthropics#1290

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@abdelhadi703 abdelhadi703 requested a review from a team as a code owner March 28, 2026 00:48
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