Memories
Store, retrieve, update, and delete memories. Memories are the core building blocks of Hebbrix - they store knowledge that your AI can recall later.
Overview
A memory is a piece of information that you want your AI to remember. This could be:
- User preferences ("User prefers dark mode")
- Facts from conversations ("User's birthday is January 15th")
- Knowledge from documents ("The API rate limit is 100 requests per minute")
- Any structured or unstructured data you want to store
Endpoints
Code Examples
Create a Memory
from hebbrix import Hebbrix
client = Hebbrix()
# Simple memory
memory = client.memories.create(
content="User's favorite color is blue"
)
# Memory with metadata
memory = client.memories.create(
content="User completed Python certification on 2024-01-15",
tags=["education", "python"],
metadata={
"certification_provider": "Coursera",
"completion_date": "2024-01-15"
}
)Process Conversations (Enterprise)
from hebbrix import Hebbrix
client = Hebbrix()
# Process a conversation — automatically extracts facts,
# detects conflicts, and creates/updates/deletes memories
result = client.memories.process(
messages=[
{"role": "user", "content": "Hi! My name is Alex and I work at Acme Corp."},
{"role": "assistant", "content": "Nice to meet you, Alex!"}
]
)
print(f"Facts extracted: {result.facts_extracted}")
print(f"Created: {result.memories_created}")
print(f"Updated: {result.memories_updated}")
# Later, user corrects their name — the old memory is updated
result = client.memories.process(
messages=[
{"role": "user", "content": "Actually, my name is Jordan, not Alex."},
{"role": "assistant", "content": "No problem, Jordan!"}
]
)
# result.events[0].event == "UPDATE"
# result.events[0].previous_content == "Alex is the user's name"Batch Create
# Create multiple memories at once
memories = [
{"content": "User prefers email over phone calls"},
{"content": "User works in software development"},
{"content": "User is based in EST timezone"},
]
result = client.memories.batch_create(memories=memories)
print(f"Created {result.created} memories")List and Filter
# List all memories
memories = client.memories.list(limit=50)
# Filter by collection
memories = client.memories.list(
collection_id="col_customer_support",
limit=20
)
# Paginate through all
cursor = None
while True:
result = client.memories.list(cursor=cursor, limit=100)
for memory in result.items:
process(memory)
if not result.next_cursor:
break
cursor = result.next_cursorcURL Examples
/v1/memoriescurl -X POST "https://api.hebbrix.com/v1/memories" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"content": "User prefers dark mode",
"tags": [
"preferences"
]
}'/v1/memories?limit=10curl -X GET "https://api.hebbrix.com/v1/memories?limit=10" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"/v1/memories/mem_abc123curl -X DELETE "https://api.hebbrix.com/v1/memories/mem_abc123" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"/v1/memories/processcurl -X POST "https://api.hebbrix.com/v1/memories/process" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"messages": [
{
"role": "user",
"content": "My name is Jordan and I work at Acme Corp."
},
{
"role": "assistant",
"content": "Nice to meet you, Jordan!"
}
]
}'/v1/memories/bulk-deletecurl -X POST "https://api.hebbrix.com/v1/memories/bulk-delete" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"memory_ids": [
"mem_abc123",
"mem_def456"
]
}'/v1/memories/allcurl -X DELETE "https://api.hebbrix.com/v1/memories/all" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"Memory Lifecycle
When you create a memory, Hebbrix automatically:
Embeds the Content
Converts text to vector embeddings for semantic search.
Calculates Importance
Analyzes content to determine relevance and priority.
Extracts Entities
Identifies people, places, concepts and adds to knowledge graph.
Indexes for Search
Adds to BM25 index for keyword matching alongside vectors.
Detects Conflicts
When using /process, checks for conflicting memories and automatically updates or removes outdated information.
Full pipeline propagation: When a memory is updated or deleted, all storage layers are re-indexed — embeddings, vectors, BM25, knowledge graph, propositions, and tiers are all kept in sync automatically.
