How TencentDB Agent Memory Automatically Extracts Skills from Conversation Sessions: A Technical Deep Dive
TencentDB Agent Memory extracts reusable skills from conversation sessions using a pipeline that captures dialogue in skill-core-sink.ts, processes it through the SkillExtractor component with LLM-based analysis, and persists versioned skill definitions to the SkillStore for immediate API exposure.
The TencentDB-Agent-Memory repository (TDAM) transforms raw agent conversations into structured, reusable capabilities through an automated extraction pipeline. This system continuously learns from real user interactions, converting implicit dialogue patterns into explicit, version-controlled skills that agents can invoke programmatically. Understanding how skills are automatically extracted from conversation sessions requires examining the end-to-end flow from capture to runtime exposure.
How Conversation Data Flows into the Extraction Pipeline
The extraction process begins with the ConversationSink, which streams raw interaction data into a temporary session buffer. Located at MemoryCore/src/core/skill/conversation-add/skill-core-sink.ts, this component records every turn of user-agent dialogue, capturing utterances, timestamps, detected intents, and entity data.
When a session concludes or when a predefined "skill-trigger" token appears in the conversation flow, the system initiates the extraction phase. This trigger mechanism ensures that completed interaction patterns—rather than incomplete thoughts—are sent for analysis, maintaining the quality and coherence of automatically generated skill definitions.
The SkillExtractor: Converting Dialogue to Structured Definitions
At the heart of the pipeline lies the SkillExtractor (MemoryCore/src/core/skill/skill-extractor.ts). When invoked, this component retrieves the buffered conversation data and constructs an LLM prompt designed to identify repeatable patterns, intents, and parameterizable slots within the dialogue history.
The extractor feeds this data to a specialized prompt template defined in MemoryCore/src/core/skill/prompts/skill-review-prompt.ts. This prompt instructs the language model to analyze the conversation for actionable patterns—essentially asking the model to reverse-engineer the "skill" that would generate such a dialogue if executed again.
LLM-Powered Skill Specification Generation
Once the LLM processes the conversation context, the system parses the response using skill-format.ts to generate a SkillSpec object. This structured specification contains four critical components:
- Name – A concise, machine-readable identifier for the skill.
- Description – A human-readable summary explaining what the skill accomplishes.
- Parameters – Detected slots with associated types, enabling dynamic input handling.
- Example utterances – Validated input patterns that demonstrate proper usage.
The parsing layer ensures that LLM outputs conform to the expected schema before proceeding to persistence, preventing malformed definitions from entering the system.
Versioning and Persistent Storage
Extracted specifications undergo versioning through skill-versioning.ts, which handles version bumps and change tracking to maintain a historical record of skill evolution. The versioned spec is then handed to the SkillStore layer, comprising skill-store.ts and its concrete implementation tcvdb-skill-store.ts.
This storage layer persists the skill definition in the database and simultaneously registers it with the Skill Kernel (panel/kernel/ports/skill-kernel-port.ts). This dual-registration approach ensures that skills are both durably stored and immediately available for runtime execution without requiring system restarts or manual configuration reloads.
Runtime Integration and API Exposure
Once persisted, automatically extracted skills become accessible through multiple interfaces. The public REST API defined in MemoryPanel/web/src/lib/api/skill-api.ts exposes standard CRUD operations, allowing clients to list, retrieve, and invoke skills just like built-in capabilities.
For agent runtime integration, the SkillToolsInjector (MemoryProxy/src/injection/injectors/skill-tools-injector.ts) dynamically adds helper methods—such as createSkill and listSkills—to the agent context. Additionally, MemoryProxy/src/skill/skill-bridge.ts serves as the bridge between the runtime execution environment and the stored skill definitions, enabling seamless invocation without additional coding.
Example: Creating a Skill from Session Data
Developers can manually trigger skill creation from conversation buffers using the TypeScript SDK:
import { SkillClient } from '@tencentdb/agent-memory-sdk';
async function createSkillFromSession(sessionLines: string[]) {
const client = new SkillClient({ endpoint: 'https://api.tencentdb.com' });
const skill = await client.createSkillFromConversation({
sessionId: 'sess-12345',
utterances: sessionLines,
});
console.log('New skill created:', skill.id, skill.name);
}
Example: Invoking Extracted Skills
Once extracted, skills can be invoked programmatically using the Python SDK:
from tencentdb_agent_memory.v3.skill_client import SkillClient
client = SkillClient(endpoint='https://api.tencentdb.com')
def call_skill(skill_name, **kwargs):
resp = client.invoke_skill(name=skill_name, parameters=kwargs)
print(resp.result)
# Example invocation of an automatically extracted meeting booking skill
call_skill('BookMeeting', date='2026-09-01', time='15:00', participants=['alice', 'bob'])
Example: Listing Skills via Web Panel
Frontend applications can access the skill registry through React hooks:
import { useSkillDetailCache } from '@/services/use-skill-detail-cache';
const { skills, refresh } = useSkillDetailCache();
useEffect(() => {
refresh(); // fetches the latest skill list from `/api/skills`
}, []);
Summary
- Conversation Capture: The
skill-core-sink.tscomponent buffers raw dialogue data, intents, and entities during user-agent interactions. - Automated Triggering: Session completion or skill-trigger tokens activate the
SkillExtractorto begin processing. - LLM Analysis: The
skill-review-prompt.tstemplate guides the model in identifying repeatable patterns and parameterizable slots from conversation history. - Structured Output:
skill-format.tsparses LLM responses into formal SkillSpec objects containing names, descriptions, parameters, and examples. - Versioned Persistence:
skill-versioning.tsand the SkillStore (skill-store.ts,tcvdb-skill-store.ts) maintain historical records while registering skills with the Skill Kernel. - Immediate Availability: Extracted skills expose automatically through
skill-api.tsand runtime injectors (skill-tools-injector.ts,skill-bridge.ts) without requiring manual deployment.
Frequently Asked Questions
What triggers the skill extraction process in TencentDB Agent Memory?
The extraction process triggers in two scenarios: when a conversation session explicitly ends, or when the system detects a predefined "skill-trigger" token within the dialogue flow. According to the source code in MemoryCore/src/core/skill/skill-extractor.ts, these triggers signal the SkillExtractor to pull buffered data from the conversation sink and initiate LLM analysis, ensuring only complete interaction patterns are processed.
How does the LLM determine what constitutes a skill in the conversation?
The LLM evaluates conversation history against the prompt template defined in MemoryCore/src/core/skill/prompts/skill-review-prompt.ts, which instructs the model to identify repeatable patterns, clear intents, and parameterizable slots. The prompt specifically asks the model to reverse-engineer the implicit "skill definition" that would generate the observed dialogue, extracting actionable components like required parameters and example utterances for validation.
Where are extracted skills stored and how are they versioned?
Extracted skills persist through the SkillStore abstraction layer, with concrete implementations in skill-store.ts and tcvdb-skill-store.ts. Before storage, skill-versioning.ts assigns version numbers and tracks changes to maintain historical records. This versioned data is stored in the database and simultaneously registered with the Skill Kernel at panel/kernel/ports/skill-kernel-port.ts, ensuring both durability and immediate runtime availability.
How can developers access automatically extracted skills programmatically?
Developers interact with extracted skills through the public API defined in MemoryPanel/web/src/lib/api/skill-api.ts, which supports standard CRUD operations. Additionally, the SkillToolsInjector (MemoryProxy/src/injection/injectors/skill-tools-injector.ts) automatically injects helper methods like createSkill and listSkills into the agent runtime, while MemoryProxy/src/skill/skill-bridge.ts provides the bridge for direct skill invocation within application code.
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 →