How the LLM-Wiki Feature Works in TencentDB Agent Memory: Architecture and Implementation
The LLM-Wiki feature in TencentDB Agent Memory transforms raw documentation into searchable, LLM-summarized knowledge assets through a three-tier architecture comprising the Memory Hub for storage, the Knowledge Service (KS) for LLM-powered ingestion, and an LLM Proxy for generation routing.
The TencentDB Agent Memory repository implements a sophisticated knowledge management system that converts unstructured documentation into structured, AI-queryable resources. At the heart of this system lies the LLM-Wiki feature, which automates the summarization of documents and exposes them to agents through a dynamic discovery mechanism. This article examines the technical implementation, from document ingestion to runtime agent access.
Core Architecture Components
The LLM-Wiki implementation rests on three integrated components that handle storage, processing, and generation.
Memory Hub as the Central Store
The Memory Hub serves as the authoritative repository for all knowledge assets within the system. It maintains structured Wiki pages alongside other assets like Chat Memory, Skills, and CodeGraph. According to the source architecture, the Hub enforces access control lists (ACLs) and governs visibility permissions for all stored Wiki content.
Knowledge Service (KS) for Document Processing
The Knowledge Service (KS) functions as the "wiki back-end" that executes the heavy lifting of document transformation. When raw documents enter the system, KS orchestrates the ingest → LLM summarization → page creation pipeline. As documented in deploy/panel-knowledge-combined/README.md, KS initiates wiki-ingest jobs that split source files into chunks, invoke the LLM for summarization, and construct both the structured page data and a semantic link graph connecting related pages.
LLM Proxy and Custom Model Integration
The LLM Proxy (or Custom LLM configuration) provides the actual generation capability for the summarization process. The system supports two operational modes controlled by the LLM_MODE environment variable: proxy (default) routes calls through the Memory gateway with built-in tracing, while custom allows integration with external LLM endpoints.
Document Ingestion and LLM Summarization Pipeline
When users upload documentation sets—such as product specifications or operational runbooks—the Panel-knowledge-combined service triggers a KS wiki-ingest job. This pipeline executes three critical operations:
- Chunking – Splits source files into processable segments
- LLM Summarization – Calls the configured LLM (via proxy or custom endpoint) to generate concise summaries for each chunk
- Asset Creation – Builds structured pages containing
knowledge_id,title,summary, andcontent, alongside a link graph connecting pages by semantic similarity
The resulting Wiki pages persist as knowledge assets with type wiki in the Memory Hub. The source code notes that "KS 的 Wiki ingest / 总结等能力会调用大模型,默认走 Memory 提供的 LLM 转发能力" (KS Wiki ingest/summarization capabilities call the large model, defaulting to the LLM forwarding provided by Memory), referencing the architecture defined in deploy/panel-knowledge-combined/README.md.
Agent Discovery and Knowledge Injection
Agents do not preload entire Wiki databases. Instead, they perform a two-step self-discovery process mediated by the KnowledgeToolsInjector in MemoryProxy/src/injection/injectors/knowledge-tools-injector.ts.
Step 1: Asset Listing
Agents call /v3/tools/list to retrieve IDs of Wiki assets matching their current context. The system filters results by ACL permissions, visibility settings, and the llm_wiki capability flag.
Step 2: Tool Invocation
Through /v3/tools/call, agents invoke specific operations:
read_page– Retrieves full content of a specific Wiki pagesearch– Performs keyword-based discovery across the knowledge base
The KnowledgeToolsInjector enriches the system prompt by injecting the summary (about attribute) of selected Wiki assets, enabling the LLM to make informed decisions about fetching complete content:
// Excerpt from MemoryProxy/src/injection/injectors/knowledge-tools-injector.ts
if (r.type === "wiki") {
// use the summary as the "about" cue
const summaryAttr = attr("about", r.summary);
}
Only the summary enters the prompt automatically; agents must explicitly request full pages via the read_page tool.
Configuring LLM Access Modes
The deployment configuration in deploy/panel-knowledge-combined/start-combined.sh exposes environment variables controlling LLM integration:
| Variable | Purpose |
|---|---|
LLM_MODE |
proxy (default) routes through Memory gateway; custom enables external endpoints |
LLM_PROVIDER |
Specifies the upstream provider when using custom mode |
LLM_API_KEY |
Authentication for external LLM services |
LLM_BASE_URL |
Endpoint URL for custom LLM configurations |
KNOWLEDGE_LLM_PROXY_BASE_URL |
Memory gateway URL when operating in proxy mode |
When LLM_MODE=proxy, KS automatically forwards generation requests to the Memory gateway, which adds observability tracing (Langfuse, etc.) and respects binding configurations.
SDK Implementation Examples
TypeScript SDK: Creating Wiki Assets
import { MemoryClient } from '@tencentdb-agent-memory/memory-core';
const client = new MemoryClient({ baseUrl: 'http://ks:8421/v3' });
await client.metadata.createKnowledge({
knowledge_id: 'wiki-1',
type: 'wiki',
service_url: 'http://ks:8421/v3',
name: 'Product Design Wiki',
team_id: 'team-1',
});
Python SDK: Searching and Reading Content
from tencentdb_agent_memory.v3 import metadata_client as meta
# search for pages containing "authentication"
results = meta.search_knowledge(team_id='team-1', query='authentication')
# read the first hit
page = meta.read_page(team_id='team-1', knowledge_id=results[0].knowledge_id)
print(page.content)
Both SDKs ultimately communicate through the /v3/tools/* endpoints, which the Proxy forwards to KS and subsequently to the LLM for content generation.
Summary
- The LLM-Wiki feature converts unstructured documentation into structured knowledge assets through automated LLM summarization.
- Knowledge Service (KS) manages the ingestion pipeline, while the Memory Hub stores the resulting Wiki pages with access controls.
- Agents discover content via a two-step process (list then call), receiving only summaries initially to optimize token usage.
- The KnowledgeToolsInjector in
MemoryProxy/src/injection/injectors/knowledge-tools-injector.tshandles prompt enrichment by injecting Wiki summaries. - Deployment flexibility allows either routing through the Memory LLM Proxy or integrating custom LLM endpoints via environment configuration.
Frequently Asked Questions
What distinguishes the Knowledge Service from the Memory Hub?
The Knowledge Service (KS) is the processing engine that performs document chunking, LLM invocation, and structured page generation. The Memory Hub is the persistent storage layer that houses the generated Wiki assets alongside other memory types (Chat Memory, Skills, CodeGraph) and enforces access controls. While KS creates the content, the Hub owns the assets.
How does the LLM-Wiki feature handle large document sets?
The ingestion pipeline automatically splits source files into chunks before LLM processing. This chunking strategy prevents context window overflow while maintaining semantic coherence. Each chunk receives individual summarization, and the system constructs a link graph connecting related pages based on semantic similarity, enabling scalable knowledge base construction regardless of document size.
Can developers use proprietary LLMs instead of the default Memory Proxy?
Yes. Setting LLM_MODE=custom in the deployment configuration disables the default proxy routing and directs KS to use specified external endpoints. Developers must provide LLM_PROVIDER, LLM_API_KEY, and LLM_BASE_URL values to authenticate and route requests to their preferred LLM service, bypassing the Memory gateway's tracing and binding features.
What determines whether an agent retrieves full Wiki content versus just the summary?
The KnowledgeToolsInjector automatically includes only the summary attribute in the system prompt as the about parameter. The agent's LLM evaluates this summary to determine relevance. If the agent requires deeper information, it must explicitly invoke the read_page tool via /v3/tools/call to fetch the complete content field, creating an on-demand knowledge retrieval pattern that optimizes context window usage.
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 →