Documentation Index
Fetch the complete documentation index at: https://docs.emergence.ai/llms.txt
Use this file to discover all available pages before exploring further.
Memory Integration
This guide shows how to integrate the platform Memory Service into your agents and workflows. Memory lets agents remember information across sessions, accumulate domain knowledge, and personalize responses.Prerequisites
- A valid JWT token from the platform (user or service account)
- The JWT must contain an
org_idclaim for organization scoping
Basic Integration Pattern
The most common integration pattern is:- Before responding, search memories for relevant context
- After responding, extract and store new memories from the conversation
Storing Memories
The following snippets show individual API calls. In an async agent, wrap them in
async with httpx.AsyncClient() as client: and use await client.post(...) / await client.get(...) as shown in the integration pattern above.Basic Memory Creation
Memory Types
Choose the type based on the nature of the information:| Type | When to use | Example |
|---|---|---|
fact | Factual knowledge | ”The orders table has 50M rows” |
experience | Learned behaviors | ”Query optimization worked better with CTEs” |
observation | Observed patterns | ”Revenue spikes every Q4” |
instruction | Directives / guidelines | ”Always include date filters for large tables” |
preference | User/system preferences | ”Prefers concise output without verbose explanations” |
summary | Condensed summaries | ”Session covered revenue analysis across 3 regions” |
glossary | Business terms | ”ARR = Annual Recurring Revenue” |
join | Table relationships | ”Table orders has FK to customers” |
ontology | Domain classifications | ”Column status uses enum: active, inactive, churned” |
policy | Governance rules | ”PII columns must not appear in SQL results” |
textual_pattern | Text patterns in data | ”Email column matches a standard email regex pattern” |
kpi | KPI definitions | ”Churn Rate = lost customers / total customers x 100” |
exemplar | Representative examples | ”Typical order: id=1234, amount=49.99, status=completed” |
numeric_pattern | Numeric distributions | ”Revenue column: mean=1250, median=980, stddev=450” |
Named Memories
Usename for memories you want to retrieve directly (without semantic search):
Searching Memories
The Memory Service uses a two-phase search pattern:Phase 1: Discover Context Packs
Find which context packs contain relevant memories:Phase 2: Retrieve Memories from a Pack
Once you know the relevant pack, retrieve specific memories:Context Packs
For more structured memory management, use Context Packs to group related memories:Updating and Deleting
Update a Memory
Delete a Memory
Best Practices
Keep memories self-contained
Keep memories self-contained
Each memory should make sense without knowing the conversation that produced it. Instead of “Yes, that’s right” store “User confirmed that the ‘revenue’ column uses gross revenue, not net.”
Use specific memory types
Use specific memory types
Typed memories retrieve more accurately. If you know a memory is a preference, mark it
preference, use specific types for better retrieval.Search before storing
Search before storing
Before creating a new memory, search for existing ones that might cover the same information. Update existing memories rather than creating duplicates.
Use Context Packs for domain knowledge
Use Context Packs for domain knowledge
For domain-specific knowledge bases (data dictionaries, business rules, entity relationships), group memories into typed Context Packs. This improves retrieval precision and enables pack-level operations.
Scope memories to organizations
Scope memories to organizations
Memories are scoped by the
org_id claim in the JWT token. Ensure each agent uses a token scoped to the correct organization to prevent information leakage.Related
Memory Service
Concepts overview and API reference.
Context Packs
Detailed Context Pack architecture and management.

