Storage

Storage interface with MemoryStore (in-memory) and PrismaStore (database) implementations.

Interactive Demo

Save and retrieve run records and usage data

Code Example

storage-demo.ts
import { MemoryStore, PrismaStore } from "@shivamsharma11/agent-sdk";

// In-memory storage (for development/testing)
const memoryStore = new MemoryStore();

await memoryStore.saveRun({
  pipelineName: "my-pipeline",
  status: "success",
  input: { message: "hello" },
  output: { result: "world" },
  startedAt: new Date(),
});

const runs = await memoryStore.getRuns({ limit: 10 });

// Prisma storage (for production)
// const prismaStore = new PrismaStore(prismaClient);