@operad/core
v0.1.0
Published
Event-sourced graph runtime for AI agents. Every mutation is an event. Every event has a cause. Every decision is recorded.
Maintainers
Readme
@operad/core
Event-sourced graph runtime for AI agents. Every mutation is an event. Every event has a cause. Every decision is recorded.
Why
AI agents forget what they did, can't explain why, and don't self-correct. Operad fixes this with an event-sourced graph where every action produces an immutable event with causal chains, every decision records alternatives and confidence, and staleness detection keeps knowledge fresh.
Quick Start
npm install @operad/core @operad/adapter-memoryimport { createRuntime, behavior } from '@operad/core'
import { MemoryAdapter } from '@operad/adapter-memory'
const runtime = createRuntime({
storage: new MemoryAdapter(),
behaviors: [
behavior({
name: 'log-claims',
on: ['object.created'],
handler: async (event, graph) => {
console.log('New object:', event.payload)
},
}),
],
})
const graph = await runtime.createGraph('my-agent')
await graph.addObject({ type: 'claim', data: { amount: 5000 } })Try the demo
npx @operad/server demo primitivesCore Primitives
| Primitive | What it does |
|-----------|-------------|
| Graph | Objects (nodes) + relations (edges) with typed data |
| Event Log | Immutable, append-only with causal chains (causedBy) |
| Behaviors | Reactive subscriptions — fire when events match |
| Decisions | Recorded choices with alternatives and confidence scores |
| Health | Staleness tracking — know when knowledge is stale |
| Patterns | Cypher-subset queries — find structures in the graph |
| Patches | Governance gates — propose changes, require human approval |
Storage Adapters
@operad/adapter-memory— In-memory (dev/test)@operad/adapter-postgres— PostgreSQL (production)
Links
License
MIT
