hermes-plugin: agent_id lookup ignores agent_identity, so calls are attributed to the default agent

Author: ersh123Created Sep 27, 2026Updated Sep 29, 2026

Summary

MemoryCore/hermes-plugin/memory/memory_tencentdb/__init__.py reads the agent identifier with kwargs.get("agent_id", _DEFAULT_AGENT_ID). When a caller passes agent_identity instead, the key is present but absent from the lookup, so every such call silently falls back to the default agent id and memory is attributed to the wrong agent — no error is raised.

Current code

python
self._agent_id = kwargs.get("agent_id", _DEFAULT_AGENT_ID)

Suggested change

python
self._agent_id = kwargs.get("agent_id") or kwargs.get("agent_identity") or _DEFAULT_AGENT_ID

Using or rather than a second get with a default also covers the case where agent_id is present but empty, which currently passes the empty string through instead of falling back.

Impact

Both spellings appear in the wild, so which one is sent depends on the caller. Anything routed through the Hermes plugin that identifies its agent as agent_identity gets the default id, and the resulting records are stored under the wrong agent — so memory_search with a sceneFilter or agent-scoped recall returns nothing, or returns another agent's data.

The same silent-wrong-owner shape makes this worth fixing even when no user notices: the data is written successfully either way.

Notes

  • No tests appear to cover the agent_id / agent_identity resolution in this provider, which is likely why both spellings drifted apart unnoticed.
  • A unit test asserting that an explicit agent_id wins, that agent_identity is used as the fallback, and that an empty agent_id still falls back would pin the behaviour down.

Source: TencentCloud/TencentDB-Agent-Memory