Guides

Basic Usage

A practical end-to-end usage pattern.

Recommended pattern

  1. Create one shared AgentOrc instance per process
  2. Call init() at startup
  3. Have each agent write with a stable agent id
  4. Recall with filters when you need isolation
  5. Close on shutdown

Example

typescripttypescript
import { AgentOrc } from "agentorc";

async function main() {
  const memory = new AgentOrc();
  await memory.init({ /* ... */ });

  try {
    await memory.remember({
      agent: "researcher",
      content: { text: "Acme raised a Series B at $50M." },
    });

    const hits = await memory.recall({
      query: "Acme funding",
      topK: 3,
    });

    console.log(hits);
  } finally {
    await memory.close();
  }
}

main();