Skip to content

fix(agentcore): async-native client, task tracking, drop per-package CHANGELOGs#1313

Merged
nicoloboschi merged 2 commits intomainfrom
fix/agentcore-async-native
Apr 29, 2026
Merged

fix(agentcore): async-native client, task tracking, drop per-package CHANGELOGs#1313
nicoloboschi merged 2 commits intomainfrom
fix/agentcore-async-native

Conversation

@nicoloboschi
Copy link
Copy Markdown
Collaborator

Summary

Follow-up fixes for #822.

  • Adapter uses async-native Hindsight client. client.arecall / areflect / aretain directly, instead of wrapping the sync methods in run_in_executor (which spawned a worker thread that then created a fresh event loop per call). Matches the pipecat integration's pattern.
  • Fire-and-forget retention tasks are tracked. asyncio.create_task + self._pending: set[asyncio.Task] + add_done_callback(self._pending.discard) so asyncio's weak-ref bookkeeping can't GC retention mid-flight.
  • Drop deprecated asyncio.get_event_loop(). All three call sites are gone with the executor refactor.
  • Type _format_memories against RecallResult. No more getattr fallbacks — direct attribute access.
  • Drop unimplemented 'hybrid' mode from RecallPolicy docstring.
  • Remove per-package CHANGELOG.md files for both agentcore and pipecat. The canonical changelog lives in hindsight-docs/src/pages/changelog/integrations/<name>.md and is written by ./scripts/release-integration.sh at release-cut time. Per-package files duplicate that and encourage pre-staging Unreleased entries (disallowed by CLAUDE.md).

Test plan

  • uv run pytest tests -v in hindsight-integrations/agentcore/ — 42 pass, 1 skipped (live test, needs HINDSIGHT_API_KEY)
  • New test TestRetainAsync::test_pending_task_tracked_and_completes covers the strong-ref behavior
  • uv run ruff check . and ruff format --check . clean
  • CI: test-agentcore-integration job

…on tasks

Use client.arecall/areflect/aretain directly instead of wrapping the sync
methods in run_in_executor (which spawned a worker thread that itself
created a new event loop per call). Matches the pipecat integration's
pattern.

Track fire-and-forget retention tasks in a set with a done-callback
discard so asyncio cannot GC them mid-flight. Drop the unused
threading.local client cache and the deprecated asyncio.get_event_loop()
calls.

Type _format_memories against RecallResult attributes instead of
getattr fallbacks. Drop the unimplemented 'hybrid' mode from the
RecallPolicy docstring.
The canonical changelog for each integration lives at
hindsight-docs/src/pages/changelog/integrations/<name>.md and is
written by ./scripts/release-integration.sh at release-cut time.
Per-package CHANGELOG.md files duplicate that content and encourage
pre-staging Unreleased entries, which CLAUDE.md disallows.
@nicoloboschi nicoloboschi merged commit b153541 into main Apr 29, 2026
48 checks passed
@nicoloboschi nicoloboschi deleted the fix/agentcore-async-native branch April 29, 2026 08:32
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.

1 participant