feat(hermes-v2): inject team/agent identity headers for asset registration - #905
Open
TreyDong wants to merge 1 commit into
Open
feat(hermes-v2): inject team/agent identity headers for asset registration#905TreyDong wants to merge 1 commit into
TreyDong wants to merge 1 commit into
Conversation
…ation The v2 Hermes provider (memory_tencentdb_v2) constructs the SDK client without team/agent identity, so every conversation write goes through the Gateway without x-tdai-team-id / x-tdai-agent-id headers. As a result the Gateway's automatic chat_memory asset registration (v2-router ensureChatMemoryAsset, gated on those headers) never fires, and the Team Memory Control panel shows no per-agent memory assets for Hermes users. Inject the headers via a custom HttpStub carrying an httpx.Client with default headers, sourced from two new env vars: TDAI_MEMORY_TEAM_ID (default: "default") TDAI_MEMORY_AGENT_ID (default: "default") Falls back to the plain client if the custom-stub path is unavailable, preserving the old behavior. Verified end-to-end: after this change a single sync_turn() auto-registers chat_memory-<team>-<agent> in the metadata store and the asset shows up in the panel bootstrap API.
TreyDong
marked this pull request as ready for review
August 10, 2026 05:53
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The v2 Hermes provider (
memory_tencentdb_v2) builds theMemoryClientwithout any team/agent identity. Every conversation write therefore reaches the Gateway withoutx-tdai-team-id/x-tdai-agent-idheaders.The Gateway's automatic chat_memory asset registration (
v2-router.ts→ensureChatMemoryAsset) is gated on those headers being present:So with the stock v2 plugin, no per-agent memory asset is ever registered and the Team Memory Control panel shows no Chat Memory assets for Hermes users — even though conversations are recorded fine.
Fix
Inject
x-tdai-team-id/x-tdai-agent-idon every SDK request by constructing a customHttpStubbacked by anhttpx.Clientwith default headers. Two new optional env vars (both default to"default", matching the standalone convention):TDAI_MEMORY_TEAM_IDTDAI_MEMORY_AGENT_IDIf the custom-stub path is unavailable (SDK layout changes), the provider falls back to the plain client — behavior preserved.
Verification (standalone Gateway, remote endpoint)
sync_turn()writes L0/L1 fine,meta_assetsstays empty for the Hermes agent.sync_turn()immediately registerschat_memory-<team>-<agent>inmeta_assets, and the panel bootstrap API (/api/v1/agent-overview/bootstrap) returns it underchatMemories.