Session Memory

In-memory session store with TTL support and persistent list operations.

Interactive Demo

Get, set, and delete session data

Code Example

memory-demo.ts
import { InMemorySessionStore } from "@shivamsharma11/agent-sdk";

const memory = new InMemorySessionStore();

// Store a session with TTL (ms)
await memory.setSession("session-1", { user: "Alice", count: 1 }, 60000);

// Retrieve a session
const session = await memory.getSession("session-1");

// Append to persistent list
await memory.appendPersistent("events", { type: "login", at: new Date() });
const events = await memory.readPersistent("events");

// Delete a session
await memory.deleteSession("session-1");