Skip to main content

First API Call

This guide walks through the core operations — store, search, and rollback — with full request/response shapes.

Store a memory

from novyx import Novyx

nx = Novyx(api_key="nram_your_key")

memory = nx.remember(
"User prefers dark mode and larger font sizes",
tags=["preferences", "ui"],
importance=0.8,
)
print(memory)

Response:

{
"memory_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"observation": "User prefers dark mode and larger font sizes",
"importance": 0.8,
"tags": ["preferences", "ui"],
"created_at": "2026-03-09T14:30:00Z"
}

Key parameters

ParameterTypeRequiredDescription
observationstringYesThe fact, preference, or context to store
tagsstring[]NoLabels for filtering and organization
importancefloatNo0.0–1.0 weight for search ranking (default: 0.5)
space_idstringNoContext Space to store in (Pro+)

Search returns semantically ranked results — ask a question in natural language.

results = nx.recall("What are the user's UI preferences?")

for r in results:
print(f"{r['observation']} (score: {r['score']:.2f})")

Response:

{
"results": [
{
"memory_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"observation": "User prefers dark mode and larger font sizes",
"score": 0.92,
"importance": 0.8,
"tags": ["preferences", "ui"],
"created_at": "2026-03-09T14:30:00Z"
}
]
}

Search parameters

ParameterTypeDefaultDescription
qstringNatural language search query
limitint10Max results to return
thresholdfloat0.0Minimum similarity score
tagsstring[]Filter by tags (AND logic)
recency_weightfloat0.00.0–1.0, boost recent memories

Rollback

Undo agent mistakes by reverting memory to any point in time.

# Preview what will change (non-destructive)
preview = nx.rollback_preview(target="1 hour ago")
print(f"Will remove {preview['memories_to_remove']} memories")

# Execute the rollback
result = nx.rollback(target="1 hour ago")
print(f"Removed {result['deleted_count']} memories")

Response:

{
"success": true,
"deleted_count": 3,
"remaining_memories": [
{
"memory_id": "...",
"observation": "User prefers dark mode and larger font sizes",
"created_at": "2026-03-09T13:30:00Z"
}
]
}
Rollback targets

The target parameter accepts:

  • Relative time: "2 hours ago", "30 minutes ago", "1 day ago"
  • ISO 8601 timestamp: "2026-03-09T14:00:00Z"
  • Human-readable date: "yesterday", "last week"

Sessions

Scope memories to a conversation or user session:

session = nx.session("chat-user-123")
session.remember("User asked about dark mode")
results = session.recall("dark mode")

Sessions are scoped subsets of your memory. Memories stored in a session are still searchable globally, but session-scoped queries only return memories from that session.

Audit trail

Every operation is SHA-256 hashed and timestamped:

logs = nx.audit(limit=5)
for log in logs:
print(f"{log['action']} at {log['timestamp']} — hash: {log['hash'][:16]}...")

Next steps