What Programming Languages Is TencentDB Agent Memory Written In? A Complete Stack Breakdown
TencentDB Agent Memory is a polyglot system built primarily in TypeScript and Python, with shell scripts handling deployment automation and JavaScript (ESM) powering lightweight entry-point modules.
TencentDB Agent Memory is an open-source memory management system for AI agents maintained by TencentCloud. Understanding what programming languages TencentDB Agent Memory is written in reveals a strategic polyglot architecture designed to balance high-performance backend services with developer-friendly SDKs. The repository combines modern TypeScript for core services, Python for client libraries, and shell scripts for operational automation.
TypeScript: The Core Backend Foundation
The majority of TencentDB Agent Memory's server-side components are implemented in modern TypeScript, utilizing tsconfig.json configurations and Vite for bundling across multiple services.
Memory Core Engine
In MemoryCore/src/core/tdai-core.ts, the main engine logic handles memory allocation and retrieval operations. This TypeScript implementation provides the foundational classes that manage persistent storage connections and request handling, compiled with strict type checking enabled.
Memory Knowledge and Proxy Services
The Memory Knowledge service (MemoryKnowledge/src/server.ts) and Memory Proxy storage layer (MemoryProxy/src/storage/sqlite-storage.ts) both leverage TypeScript for type-safe database interactions. The proxy specifically implements SQLite storage adapters with full TypeScript type definitions, ensuring compile-time safety for SQL operations against the memory store.
Web Panel Configuration
The administrative interface configured in MemoryPanel/web/vite.config.ts uses TypeScript with Vite for modern frontend tooling, demonstrating the language's versatility across the entire stack from backend engines to user interfaces.
import { MemoryCore } from '@tencentdb-agent-memory/memory-core';
import { createServer } from 'http';
const core = new MemoryCore({
port: 8000,
storagePath: './data',
});
createServer(core.handleRequest).listen(8000, () => {
console.log('Memory Core listening on http://localhost:8000');
});
(see MemoryCore/src/core/tdai-core.ts for the actual implementation)
Python: Official SDK Implementation
Python serves as the primary language for the official client SDK, enabling easy integration into existing Python-based AI workflows without requiring TypeScript compilation pipelines.
Versioned Client Architecture
The SDK resides in sdk/memory-core/python/ with structured versioned clients including v3/client.py and v2/client.py. These modules expose high-level abstractions for memory operations while handling authentication, request serialization, and response parsing internally.
from tencentdb_agent_memory.v3.client import MemoryClient
client = MemoryClient(api_key="YOUR_API_KEY", base_url="http://localhost:8000")
resp = client.create_memory(
asset_type="chat_memory",
content={"messages": [{"role": "user", "content": "Hello"}]},
)
print("Created memory ID:", resp["id"])
(see sdk/memory-core/python/tencentdb_agent_memory/v3/client.py for the full client class)
Shell Scripts: Deployment and Orchestration
Bash scripts orchestrate the multi-service deployment strategy, allowing the entire stack to initialize with single commands across development and production environments.
Global Deployment Automation
The deploy/global-images/start-all.sh script coordinates containerized services including the core engine, knowledge hub, and proxy layers. Additional build scripts like deploy/panel-knowledge-combined/build.sh handle environment-specific compilation tasks. These scripts manage environment variable loading, dependency checks, and service startup sequences essential for production deployments.
#!/usr/bin/env bash
set -e
# Load environment variables
cp .env.example .env
$EDITOR .env # Fill in LLM credentials
# Start all services (core, hub, proxy)
./start-all.sh
(see deploy/global-images/start-all.sh for the orchestration logic)
JavaScript (ESM): Lightweight Entry Points
JavaScript appears specifically as ECMAScript Modules (ESM) for lightweight execution contexts where TypeScript compilation overhead is unnecessary or detrimental to startup performance.
Binary Entry Points
Files like MemoryKnowledge/bin/server.mjs and MemoryKnowledge/bin/mcp.mjs serve as direct entry points for the Knowledge server and Proxy client respectively. These .mjs files bypass the TypeScript compilation step for faster cold starts in containerized environments while maintaining compatibility with the TypeScript codebase through shared package interfaces.
Summary
- TypeScript dominates the backend implementation, powering the Memory Core engine, Knowledge service, Proxy layer, and web panel with modern tooling via Vite and strict
tsconfig.jsonsettings. - Python provides the official SDK with versioned clients (
v2andv3) located insdk/memory-core/python/for seamless integration into AI agent workflows. - Shell scripts handle deployment automation through
deploy/global-images/start-all.shand auxiliary build scripts, enabling single-command stack initialization across environments. - JavaScript (ESM) functions as lightweight entry points in
MemoryKnowledge/bin/server.mjsandMemoryKnowledge/bin/mcp.mjsfor optimized cold start performance in containerized deployments.
Frequently Asked Questions
Is TencentDB Agent Memory written entirely in TypeScript?
No, while TypeScript powers the core backend services including the Memory Core engine and Memory Proxy, the project also maintains Python SDKs for client integrations, shell scripts for deployment orchestration, and JavaScript ESM modules for specific entry points. This polyglot approach optimizes for both runtime performance and developer accessibility across different ecosystem preferences.
What Python SDK versions are available for TencentDB Agent Memory?
The repository provides two major Python SDK versions: v2 and v3, located in sdk/memory-core/python/tencentdb_agent_memory/. Each version offers distinct client classes with v3/client.py representing the latest API interface and v2/client.py maintaining backward compatibility for existing integrations, allowing developers to choose their preferred stability level.
How does the deployment automation work in TencentDB Agent Memory?
Deployment relies on Bash scripts in the deploy/ directory, particularly deploy/global-images/start-all.sh, which orchestrates multi-container initialization of the core, hub, and proxy services. These scripts handle environment configuration, service dependency ordering, and health checks, allowing the entire memory stack to deploy with a single command execution rather than manual step-by-step configuration.
Why does the project use JavaScript ESM modules alongside TypeScript?
The JavaScript ESM files (server.mjs and mcp.mjs) serve as pre-compiled entry points that eliminate TypeScript compilation overhead during container startup. This design choice reduces cold start latency for the Memory Knowledge server and Proxy client while maintaining type safety through the underlying TypeScript source code that generates these modules.
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 →