Skip to content

feat(agent-framework-python): 7-tool parity - #1730

Closed
mihhhir08 wants to merge 2 commits into
supermemoryai:mainfrom
mihhhir08:feat/agent-framework-7-tool-parity
Closed

mihhhir08 wants to merge 2 commits into
supermemoryai:mainfrom
mihhhir08:feat/agent-framework-7-tool-parity

Conversation

@mihhhir08

Copy link
Copy Markdown

Summary

The 7-tool surface from #1430 / #1432 / #1433 reached the TypeScript tools, the AI SDK and supermemory_openai, but SupermemoryTools in agent-framework-python still exposed only 3 tools, and the docs said "The agent gets three tools".

This adds the missing four, with the same names and model-facing parameters as supermemory_openai:

Tool Parameters
document_list limit, page
document_delete document_id (required)
document_add content (required), title, description
memory_forget memory_id, memory_content, reason (one of id/content required)

get_tools() now returns all seven in the canonical order.

Design notes

  • Scoping: every tool uses the connection's single container_tag, like the existing three.

  • document_delete mirrors the guard in packages/tools (assertDocumentCanBeDeleted). The delete endpoint takes no tag, so the tool fetches the document first and refuses unless:

    • its container-tag set is non-empty and entirely within scope (foreign, shared, empty and missing tags are all refused), and
    • its status is terminal (done / failed).

    Fetching first also resolves a custom ID to the real document ID.

  • document_add doesn't pass the connection's custom_id. That ID keys the conversation document, so reusing it would overwrite the conversation.

  • No dependency change. Every SDK method used exists in supermemory==3.16.0, the package's minimum. I checked the signatures and response fields (container_tags, status, memories, pagination) on both 3.16.0 and 3.59.0.

Tests

tests/test_tools.py grows from 6 name/count checks to behavior tests covering:

  • tag scoping for every new tool
  • all four delete-scope refusals, plus the still-processing refusal and failed-document deletion
  • custom-ID resolution
  • missing-document errors
  • memory_forget argument validation
  • the generated FunctionTool schemas (required and optional parameters match supermemory_openai)
  • one call through FunctionTool.invoke, the path the model actually uses

Verified the way ci-python.yml runs it (build the wheel, install it, pip check, pytest):

Lane Result
Python 3.10 + supermemory==3.16.0 78 passed
Python 3.13 + supermemory==3.59.0 78 passed

Against the previous tools.py, 22 of the new tests fail. mypy passes on tools.py, and black passes on the changed files.

Docs

Updated the integration page and the package README to list all seven tools and the delete guards.

I didn't bump the package version, since I assume releases are cut separately.

The 7-tool surface (supermemoryai#1430, supermemoryai#1432, supermemoryai#1433) reached the TypeScript tools,
the AI SDK and the OpenAI Python SDK, but SupermemoryTools in
agent-framework-python still exposed only search_memories, add_memory
and get_profile.

Add the four missing tools with the same names and model-facing
parameters as supermemory_openai:

- document_list(limit, page)
- document_delete(document_id)
- document_add(content, title, description)
- memory_forget(memory_id, memory_content, reason)

All are scoped to the connection's container_tag. document_delete
mirrors the guard in packages/tools: the delete endpoint takes no tag,
so the document is fetched first and deletion is refused unless its
container-tag set is non-empty and entirely within scope, and unless
processing has reached a terminal done/failed state. Fetching first
also resolves a custom ID to the real document ID.

document_add deliberately does not pass the connection's custom_id,
which keys the conversation document and would otherwise be
overwritten.

Every method used exists in supermemory 3.16.0, the minimum this
package supports, so no dependency change is needed. Tests cover
scoping, the delete guards, argument validation, the generated tool
schemas, and one call through FunctionTool.invoke. They pass in both
CI lanes (Python 3.10 + supermemory 3.16.0, Python 3.13 + 3.59.0).
The integration page said "The agent gets three tools". List all seven
and note the container-tag scoping and delete guards, in the docs page
and the package README.
@mihhhir08

Copy link
Copy Markdown
Author

Quick note on the follow-up. This PR just fills in the four missing tools. While working on it I noticed the tool descriptions have drifted between the TS and Python SDKs (search_memories actually tells the model opposite things about when to search), so I wrote up an idea for a shared spec + conformance tests in #1731.

I haven't built that part yet on purpose. It changes how the SDKs share their tool definitions and needs a call on which wording is the source of truth, so I didn't want to send a big PR you'd end up wanting structured differently. If the direction looks good to you, I'll pick it up right after this one.

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.

2 participants