Getting Started

Quick Start

Store and recall your first semantic memories in minutes.

1. Initialize

index.tstypescript
import { AgentOrc } from "agentorc";

const ctx = new AgentOrc();

await ctx.init({
  organization: "my-org",
  database: {
    provider: "sqlite",
    connectionString: "./memory.db",
  },
  embedding: {
    baseUrl: "https://api.openai.com/v1",
    apiKey: process.env.OPENAI_API_KEY!,
    model: "text-embedding-3-small",
  },
  llm: {
    baseUrl: "https://api.openai.com/v1",
    apiKey: process.env.OPENAI_API_KEY!,
    model: "gpt-4.1-mini",
  },
});

2. Remember

typescripttypescript
await ctx.remember({
  agent: "research",
  content: { text: "Stripe supports recurring invoices." },
  metadata: { source: "docs" },
});

3. Recall

typescripttypescript
const results = await ctx.recall({
  query: "How do recurring invoices work?",
  topK: 5,
  threshold: 0.5,
  filter: { agent: "research" },
});

console.log(results[0]?.content.text);
console.log(results[0]?.similarity);

4. Multi-agent usage

Multiple agents can share one AgentOrc instance and the same SQLite file. Use the agent field to attribute writes and optionally filter reads.

typescripttypescript
await ctx.remember({
  agent: "writer",
  content: { text: "Keep the tone concise and factual." },
});

const shared = await ctx.recall({
  query: "tone guidelines",
  topK: 3,
});

What to read next