Skip to content

fix(python-sdks): v4 API migration for integration packages - #1434

Open
Dhravya wants to merge 7 commits into
feat/ai-sdk-tool-reexportsfrom
fix/python-sdks-v4-api
Open

fix(python-sdks): v4 API migration for integration packages#1434
Dhravya wants to merge 7 commits into
feat/ai-sdk-tool-reexportsfrom
fix/python-sdks-v4-api

Conversation

@Dhravya

@Dhravya Dhravya commented Aug 8, 2026

Copy link
Copy Markdown
Member

Summary

  • agent-framework: proactive search tool descriptions
  • cartesia / pipecat: v4 client.add + hybrid search, dedupe fixes, tests

Stacked on #1433

Test plan

  • pytest in agent-framework, cartesia, pipecat packages

Made with Cursor

…4 APIs

Use client.add and search.memories hybrid mode, improve profile memory
deduplication for string/pydantic items, and add dedupe unit tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
@claude

claude Bot commented Aug 8, 2026

Copy link
Copy Markdown

Claude finished @ved015's task in 1m 59s —— View job


Code Review Complete

  • Fetch PR diff and existing review comments
  • Analyze changes for bugs, security issues, and logic errors
  • Submit review findings

Result: No new issues found. The two issues previously flagged by Cursor Bugbot have been addressed in subsequent commits. PR scores 9/10 — ready to ship.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 8, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
supermemory-mcp 5462e20 Aug 24 2026, 04:27 PM

@Dhravya
Dhravya force-pushed the fix/python-sdks-v4-api branch from 2b9934b to c449b2f Compare August 8, 2026 02:47
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 8, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
supermemory-app 5462e20 Commit Preview URL

Branch Preview URL
Aug 24 2026, 04:30 PM

Dhravya commented Aug 8, 2026

Copy link
Copy Markdown
Member Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more


How to use the Graphite Merge Queue

Add the label Main to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c449b2f. Configure here.

chunk_threshold=0.6,
include_full_docs=include_full_docs,
threshold=0.6,
search_mode="hybrid",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

include_full_docs ignored

Medium Severity

The v4 migration stops passing include_full_docs to search.memories, but the tool still exposes that parameter with a default of True. Callers or agents that set include_full_docs=False get the same hybrid search as when it is True, so documented tool behavior no longer matches runtime.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c449b2f. Configure here.

# Stainless SDK returns pydantic models (attribute access, snake_case).
memory = getattr(item, "memory", None)
if isinstance(memory, str):
trimmed = memory.strip()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dedupe drops chunk-only hits

Medium Severity

extract_memory_text only reads the memory field on dicts and SDK models. Hybrid v4 results that populate chunk or content instead (as cartesia/pipecat handle in this PR) are treated as empty and dropped from deduplicated search output used by middleware and context providers.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c449b2f. Configure here.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overview: Migrates agent-framework, cartesia, and pipecat Python SDKs to the v4 Supermemory API, switching from search.execute to search.memories with hybrid search, updating memory storage to use client.add, and hardening deduplication to handle v4's chunk/content response fields.

Issues found: None — this looks good to ship.

The two issues flagged by Cursor Bugbot have been addressed in subsequent commits:

  1. include_full_docs ignored ✅ Fixed — The parameter is now Optional[bool] = None with a deprecation warning, and the model-facing tool (_search_memories_tool) properly omits it. The README documents the deprecation.

  2. Dedupe drops chunk-only hits ✅ Fixed — All three packages now check ("memory", "chunk", "content") fields when extracting text from v4 search results.

Notable improvements in this PR:

  • Consistent _field() helper across cartesia/pipecat for reading dict or pydantic model fields
  • Date-prefix normalization in deduplication prevents false duplicates between profile and search results
  • Pipecat storage queue with retry-on-failure and proper cleanup drain
  • Cartesia per-turn context injection with legacy fallback for older Line versions

Score: 9/10

Minor observation: The unbounded storage queue in pipecat could grow during sustained API failures, but this is a reasonable tradeoff to avoid data loss.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overview: Migrates agent-framework, cartesia, and pipecat Python SDKs to the v4 Supermemory API, switching from search.execute to search.memories with hybrid search, updating memory storage to use client.add, and hardening deduplication to handle v4's chunk/content response fields.

Issues found: None — this looks good to ship.

The two issues flagged by Cursor Bugbot have been addressed in subsequent commits:

  1. include_full_docs ignored ✅ Fixed — The parameter is now Optional[bool] = None with a deprecation warning at tools.py:97-103, and the model-facing tool (_search_memories_tool at line 212) properly omits it. The README documents the deprecation.

  2. Dedupe drops chunk-only hits ✅ Fixed — All three packages now check ("memory", "chunk", "content") fields when extracting text from v4 search results (e.g., utils.py:100-109 in agent-framework).

Notable improvements in this PR:

  • Consistent _field() helper across cartesia/pipecat for reading dict or pydantic model fields
  • Date-prefix normalization in deduplication prevents false duplicates between profile and search results
  • Pipecat storage queue with retry-on-failure and proper cleanup drain via _drain_storage_queue()
  • Cartesia per-turn context injection with legacy fallback for older Line versions via _agent_accepts_context()
  • OpenAI middleware now properly threads sync client.add calls and adds timeout/redirect handling

Score: 9/10

Minor observation: The unbounded storage queue in pipecat (_storage_queue: deque) could grow during sustained API failures, but this is a reasonable tradeoff to avoid data loss. The _drain_storage_queue() method provides graceful cleanup at teardown.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overview: Migrates agent-framework, cartesia, and pipecat Python SDKs to the v4 Supermemory API, switching from search.execute to search.memories with hybrid search, updating memory storage to use client.add, and hardening deduplication to handle v4's chunk/content response fields.

Issues found: None — this looks good to ship.

The two issues flagged by Cursor Bugbot have been addressed in subsequent commits:

  1. include_full_docs ignored ✅ Fixed — The parameter is now Optional[bool] = None with a deprecation warning at tools.py:97-103, and the model-facing tool (_search_memories_tool at line 212) properly omits it. The README documents the deprecation.

  2. Dedupe drops chunk-only hits ✅ Fixed — All three packages now check ("memory", "chunk", "content") fields when extracting text from v4 search results (e.g., utils.py:100-109 in agent-framework, cartesia's _field() helper at utils.py:50-67, pipecat's equivalent at utils.py:57-73).

Notable improvements:

  • Consistent _field() helper across cartesia/pipecat for reading dict or pydantic model fields
  • Date-prefix normalization in deduplication prevents false duplicates between profile and search results
  • Pipecat storage queue with retry-on-failure and proper cleanup drain via _drain_storage_queue()
  • Cartesia per-turn context injection with legacy fallback for older Line versions via _agent_accepts_context()
  • OpenAI middleware properly threads sync client.add calls via asyncio.to_thread and adds timeout/redirect handling
  • CI workflows pinned to commit SHAs and test against minimum/current dependency versions

Score: 9/10

Minor observation: The unbounded storage queue in pipecat (_storage_queue: deque) could grow during sustained API failures, but this is a reasonable tradeoff to avoid data loss and the _drain_storage_queue() method provides graceful cleanup at teardown.

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