Recommended pattern
- Create one shared
AgentOrcinstance per process - Call
init()at startup - Have each agent write with a stable
agentid - Recall with filters when you need isolation
- 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();