The Z3rno TypeScript SDK provides a fully-typed client for interacting with the Z3rno memory API. All responses are validated with Zod schemas at runtime.
const results = await client.recall({ agentId: 'agent-1', query: 'What does the user prefer?', memoryType: 'semantic', // Optional: filter by type topK: 5, // Max results (default: 10)});for (const r of results) { console.log(`${r.content} (relevance: ${r.relevanceScore.toFixed(2)})`);}
// Soft delete all memories for an agentawait client.forgetAll({ agentId: 'agent-1' });// Hard delete all memories for an agentawait client.forgetAll({ agentId: 'agent-1', hard: true });
All API responses are validated at runtime using Zod schemas. This means you get both compile-time TypeScript types and runtime validation — if the server returns an unexpected shape, the SDK throws a ValidationError immediately rather than failing silently downstream.
import { MemorySchema, RecallResultSchema } from '@z3rno/sdk/schemas';// Schemas are exported if you need to validate data yourselfconst parsed = MemorySchema.parse(rawData);
The SDK uses Zod internally for every response. You do not need to call .parse() yourself unless you are working with raw data outside the client.
// Start a sessionconst session = await client.startSession({ agentId: 'agent-1' });// Store working memory within the sessionawait client.store({ agentId: 'agent-1', content: 'User is asking about pricing.', memoryType: 'working', sessionId: session.id,});// End the session — working memories are consolidated into episodic memoryawait client.endSession({ sessionId: session.id });
When a session ends, Z3rno automatically consolidates working memories into episodic memories. You do not need to manually manage this transition.