diff --git a/workspace-template/a2a_tools.py b/workspace-template/a2a_tools.py index 44d1c8c6..5612b61c 100644 --- a/workspace-template/a2a_tools.py +++ b/workspace-template/a2a_tools.py @@ -226,6 +226,7 @@ async def tool_commit_memory(content: str, scope: str = "LOCAL") -> str: resp = await client.post( f"{PLATFORM_URL}/workspaces/{WORKSPACE_ID}/memories", json={"content": content, "scope": scope}, + headers=_auth_headers_for_heartbeat(), ) data = resp.json() if resp.status_code in (200, 201): @@ -247,6 +248,7 @@ async def tool_recall_memory(query: str = "", scope: str = "") -> str: resp = await client.get( f"{PLATFORM_URL}/workspaces/{WORKSPACE_ID}/memories", params=params, + headers=_auth_headers_for_heartbeat(), ) data = resp.json() if isinstance(data, list): diff --git a/workspace-template/tests/test_mcp_memory.py b/workspace-template/tests/test_mcp_memory.py index 55c30727..117e5417 100644 --- a/workspace-template/tests/test_mcp_memory.py +++ b/workspace-template/tests/test_mcp_memory.py @@ -45,11 +45,11 @@ class FakeClient: async def __aexit__(self, *args): pass - async def post(self, url, json=None): + async def post(self, url, json=None, headers=None, **kwargs): self.calls.append(("POST", url, json)) return FakeResponse(201, {"id": "mem-abc", "scope": json.get("scope", "LOCAL") if json else "LOCAL"}) - async def get(self, url, params=None): + async def get(self, url, params=None, headers=None, **kwargs): self.calls.append(("GET", url, params)) return FakeResponse(200, [ {"id": "mem-1", "content": "Test memory", "scope": "LOCAL"}, @@ -124,7 +124,7 @@ async def test_recall_memory_empty(monkeypatch): mcp = _load_mcp() class EmptyClient(FakeClient): - async def get(self, url, params=None): + async def get(self, url, params=None, headers=None, **kwargs): return FakeResponse(200, []) monkeypatch.setattr("a2a_tools.httpx.AsyncClient", lambda **kw: EmptyClient())