How TencentDB Agent Memory Core Services Communicate: HTTP v3 API Architecture
TencentDB Agent Memory core services communicate exclusively through stateless HTTP v3 REST APIs, with Memory Proxy acting as a gateway that forwards agent requests to Memory Core and Memory Knowledge using native fetch calls.
TencentDB Agent Memory enables collaborative AI agents to share persistent memory through a distributed architecture built on pure HTTP communication. Understanding how these core services exchange data is essential for debugging integration issues or extending the platform. This article examines the v3 API patterns, service interactions, and key implementation files that govern communication between the Memory Core, Memory Proxy, and optional Memory Knowledge services.
Service Architecture Overview
The platform consists of three tightly-coupled services that expose HTTP-based, version-3 (v3) REST APIs. Each service maintains specific responsibilities while relying on identical communication contracts.
Memory Core
Memory Core stores raw assets including Chat Memory, Skills, Wiki pages, and CodeGraph, while running the pipeline that transforms raw data into L0-L3 memory layers. It exposes a pure HTTP server through src/gateway/server.ts and serves as the ultimate destination for most data operations. Other services issue fetch or Node.js undici calls to Core endpoints such as POST /v3/meta/agent/create, GET /v3/meta/task/list, and POST /v3/recall.
Memory Proxy
Memory Proxy functions as the gateway for external agents including Claude Code, CodeBuddy, and DeepSeek Harness. It registers available tools and forwards tool-specific HTTP requests to appropriate backend services. The proxy layer in src/tdai/client.ts receives agent requests, resolves tool definitions, and executes the underlying fetch to Core or Knowledge endpoints. It exposes GET /v3/tools/list and POST /v3/tools/call for agent discovery and execution.
Memory Knowledge
Memory Knowledge provides optional read-only access to structured knowledge graphs including Wiki content and CodeGraph relationships. Running its own HTTP server via src/store/wiki-service.ts, this service responds to queries like GET /v3/knowledge/wiki/:id and is invoked by the Proxy through the same fetch mechanism used for Core communication.
Communication Flow and API Patterns
Service communication follows a strict four-step request lifecycle that maintains statelessness and consistent envelope formatting.
- Agent discovers capabilities – The external agent queries
GET /v3/tools/liston the Memory Proxy to retrieve available tool definitions. - Proxy resolves and forwards – When calling
POST /v3/tools/call, the Proxy inspects the tool payload, resolves the target service (Core or Knowledge), and executes an internalfetchto the appropriate v3 endpoint using thefetcherinjectable. - Core processes and responds – The target service (Core or Knowledge) processes the request, typically interacting with vector stores or databases, then returns a JSON envelope structured as
{code, data, msg}. - Proxy returns unified response – The Proxy forwards the JSON envelope unchanged to the originating agent, maintaining protocol consistency.
Memory Panel UI communicates directly with Memory Core using the same v3 API endpoints (e.g., /v3/meta/team/list), bypassing the Proxy because it operates within the same trusted network.
Key Implementation Details
Stateless HTTP with Header Authentication
Each API call is independent and idempotent. Authentication credentials travel exclusively in HTTP headers, typically as JWT tokens or API keys, verified by Memory Core on every request. This design eliminates session state and enables horizontal scaling of service instances.
Dynamic Tool Registration
Memory Proxy constructs its tool catalogue from two sources: a static JSON configuration in src/tdai/capabilities.ts and dynamic metadata fetched from Core endpoints under /v3/meta/*. This dual-source approach allows runtime discovery of new capabilities without redeploying the Proxy service.
Fetch Deduplication
Core components implement request coalescence to prevent redundant network traffic. The instance-config-provider.ts module deduplicates concurrent fetches for identical resources, ensuring that only one network request executes while multiple pending promises share the resulting response.
Practical Code Examples
Listing Available Tools from Memory Proxy
Agents initiate communication by discovering capabilities through the Proxy's tool list endpoint:
// Claude-Code agent requesting available tools
const proxyBase = "http://localhost:8125";
const resp = await fetch(`${proxyBase}/v3/tools/list`);
const { data: tools } = await resp.json();
console.log("Available tools:", tools);
Source: MemoryProxy/src/tdai/capabilities.ts – implements the static tool registry and list endpoint.
Executing Tool Calls Through the Proxy
Tool execution demonstrates the Proxy-to-Core communication pattern:
// Request memory recall via Proxy gateway
const body = {
tool: "memory.recall",
args: { query: "latest deployment steps", topK: 5 }
};
const resp = await fetch(`${proxyBase}/v3/tools/call`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(body)
});
const { data } = await resp.json();
console.log("Recall result:", data);
Source: MemoryProxy/src/tdai/client.ts – contains the fetch logic forwarding requests to Core endpoints.
Processing Recall Requests in Memory Core
Memory Core handles the actual data retrieval after receiving proxied requests:
// Inside MemoryCore: handling recall pipeline
export async function handleRecall(req: Request) {
const { query, topK } = await req.json();
// Pipeline manager fetches candidates, filters, returns L1 atoms
const results = await recallEngine.recall(query, topK);
return jsonResponse({ code: 0, data: results });
}
Source: MemoryCore/src/core/tdai-core.ts – implements the recall engine and response envelope formatting.
Reading Wiki Pages from Memory Knowledge
Knowledge service endpoints follow identical HTTP patterns for read-only access:
// MemoryKnowledge endpoint for wiki retrieval
export async function readWikiPage(req: Request) {
const { pageId } = await req.json();
const page = await wikiStore.getPage(pageId);
return jsonResponse({ code: 0, data: page });
}
Source: MemoryKnowledge/src/store/wiki-service.ts – provides HTTP handlers for knowledge graph queries.
Critical Source Files for Service Communication
Understanding these specific source files is essential for tracing request flows or modifying communication behavior:
src/gateway/server.ts(Memory Core) – Launches the Core HTTP server and registers all v3 route handlers.src/core/tdai-core.ts(Memory Core) – Contains core logic for recall operations, skill extraction, and pipeline management.src/tdai/client.ts(Memory Proxy) – Implements the thin wrapper that forwards tool calls to Core usingfetch(url, opts).src/tdai/capabilities.ts(Memory Proxy) – Defines static tool definitions and the/v3/tools/listimplementation.src/store/wiki-service.ts(Memory Knowledge) – Provides HTTP handlers for Wiki page reads accessed by agents via Proxy.MemoryCore/v3-api-memorycore-doc.md– Official API specification for Core service endpoints.MemoryProxy/v3-api-memoryproxy-doc.md– API specification for Proxy gateway endpoints.
All files are available in the feat/server_team branch of the TencentCloud/TencentDB-Agent-Memory repository.
Summary
- TencentDB Agent Memory uses three services (Core, Proxy, Knowledge) communicating via HTTP v3 REST APIs
- Memory Proxy acts as the exclusive gateway for external agents, forwarding requests to Core or Knowledge using native
fetch - Memory Core exposes data operations like
POST /v3/recallthroughsrc/gateway/server.tsand processes raw memory assets - All services share a common JSON envelope structure
{code, data, msg}and stateless authentication via HTTP headers - Tool registration combines static definitions from
capabilities.tswith dynamic metadata from Core endpoints - Request deduplication in Core prevents redundant network calls for identical concurrent requests
Frequently Asked Questions
What protocol do TencentDB Agent Memory core services use to communicate?
The services communicate exclusively over HTTP v3 REST APIs using standard fetch implementations or Node.js undici for high-performance server-side requests. All endpoints follow RESTful conventions with JSON request and response bodies, enabling language-agnostic integration and straightforward load balancing.
How does Memory Proxy determine where to route tool calls?
Memory Proxy maintains a tool registry populated from src/tdai/capabilities.ts and dynamic Core metadata. When receiving a POST /v3/tools/call request, it resolves the tool definition to determine whether to fetch from Memory Core (for memory operations) or Memory Knowledge (for wiki/codegraph queries), then forwards the request to the appropriate internal endpoint.
Is authentication required between internal services?
Yes. While the Memory Panel UI may bypass the Proxy within the same network, all service-to-service and agent-to-service communication requires authentication credentials carried in HTTP headers. Memory Core verifies JWT tokens or API keys on every request, maintaining security boundaries even for internal traffic.
Can external agents communicate directly with Memory Core?
External agents should communicate exclusively through Memory Proxy to ensure proper tool discovery and request routing. Direct Core access is reserved for internal components like the Memory Panel UI that operate within the same trusted network and use identical v3 API contracts.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →