Eidentic is the open-source TypeScript SDK for AI agents with self-improving memory and production fundamentals built in. Durable execution, enforced cost ceilings, multi-tenant isolation, GDPR erasure, and sandboxed tools — not bolted on. Apache-2.0, no enterprise gating. Runs on Node, Bun, Deno, and the edge.
Status: 0.x — APIs stabilizing toward v1; see STABILITY. We'd rather over-disclose gaps than oversell — see the benchmarks for honest, reproducible numbers.
import { Agent, AIModel, SqliteStore } from "eidentic"; import { anthropic } from "@ai-sdk/anthropic"; const agent = new Agent({ id: "support", model: new AIModel(anthropic("claude-sonnet-4-5")), store: new SqliteStore("./eidentic.sqlite"), }); for await (const ev of agent.query("What did we decide last week?", { sessionId: "u-42" })) { console.log(ev); }
Why Eidentic?
Most agent frameworks lead one lane — memory, or coding/sandbox, or DX, or durable orchestration, or skills. Rarely do all of these ship together, and production-readiness is usually behind an enterprise tier. Eidentic's thesis: everything in one composable, fully-open package.
1. Memory that improves itself. Not just vector recall — a four-tier engine with self-editing memory blocks, a temporal knowledge graph (facts with validity over time; contradictions invalidate rather than accumulate), sleep-time consolidation, and passive fact extraction. (design spec)
2. Production fundamentals, built in — not bolted on. Durable checkpoint/resume with exactly-once tool dispatch, enforced cost ceilings ($/token/turn) with per-turn cost visibility, built-in rate-limiting + quotas, OpenTelemetry GenAI spans, a structured audit-event stream (permission denials, quota/rate-limit rejections, auth failures, and right-to-erasure — the events a compliance log needs), deny-by-default permissions, sandboxed code/command execution, secrets the model never sees, and one-call right-to-erasure (GDPR) that fans out across every store. For offline workloads there's a batch runner and scheduled/background runs. And because shipping an agent without tests is shipping blind, there's a built-in eval harness with a CI pass-rate gate plus one-call promotion of a production trace into a regression test — every incident becomes a test, not a repeat. Several of these are unique or near-unique among open frameworks.
3. Composable, fully open, runs everywhere. Ports-and-adapters architecture: swap the store (SQLite / libSQL / Postgres), vector backend (LanceDB / pgvector / Qdrant / Pinecone), or embedder without touching agent code. Ingest PDF, HTML, and Markdown out of the box; interop via MCP (with OAuth) and A2A. Apache-2.0, no code-gating. Verified on Node, Bun, and Deno in CI.
Two ways to use Eidentic
Eidentic is a library first. You don't have to run a separate service — you import it
straight into your own backend and call agent.query(). Running it as a standalone HTTP
service is an optional second mode for when you want agents-as-a-service.
1. Embedded — drop it into your app (the common path)
One install, then construct an agent and stream it from any request handler. The agent runs server-side (it holds your model key); your frontend just calls your endpoint.
npm install eidentic ai @ai-sdk/anthropic
Next.js (App Router) — app/api/chat/route.ts:
Next.js / serverless: use
@eidentic/libsql(pure-JS, bundler-friendly), notSqliteStore. The nativebetter-sqlite3addon behindSqliteStoredoesn't bundle under Next/Turbopack (Dynamic require not supported).npm install @eidentic/libsqland keep the route on the Node runtime. (For Node servers/scripts,SqliteStoreis great — see the snippet at the top.)
import { Agent, AIModel } from "eidentic"; import { LibsqlStore } from "@eidentic/libsql"; import { anthropic } from "@ai-sdk/anthropic"; export const runtime = "nodejs"; // native/edge-safe store; not the edge runtime const agent = new Agent({ id: "support", model: new AIModel(anthropic("claude-sonnet-4-5")), store: new LibsqlStore("file:eidentic.db"), }); export async function POST(req: Request) { const { message, sessionId } = await req.json(); const stream = new ReadableStream({ async start(c) { for await (const ev of agent.query(message, { sessionId, signal: req.signal })) c.enqueue(new TextEncoder().encode(JSON.stringify(ev) + "\n")); c.close(); }, }); return new Response(stream, { headers: { "content-type": "application/x-ndjson" } }); }
Express:
app.post("/chat", async (req, res) => { res.type("application/x-ndjson"); const controller = new AbortController(); res.on("close", () => { if (!res.writableEnded) controller.abort(); }); for await (const ev of agent.query(req.body.message, { sessionId: req.body.sessionId, signal: controller.signal })) res.write(JSON.stringify(ev) + "\n"); res.end(); });
Cloudflare Workers / edge — same Agent, swap the store for a libSQL/Postgres adapter:
export default { async fetch(req: Request) { const { message, sessionId } = await req.json(); const stream = new ReadableStream({ async start(c) { for await (const ev of agent.query(message, { sessionId, signal: req.signal })) c.enqueue(new TextEncoder().encode(JSON.stringify(ev) + "\n")); c.close(); }, }); return new Response(stream, { headers: { "content-type": "application/x-ndjson" } }); }, };
A complete, runnable version (plain node:http, no extra packages) is in
examples/hello-embedded.ts — pnpm --filter eidentic-examples hello:embedded.
2. Server — agents-as-a-service (optional)
When you'd rather not hand-write the endpoint, or want a dedicated multi-tenant agent backend
with auth, sessions, and streaming out of the box, @eidentic/server gives you a ready Hono app:
import { createServer, serveNode, ApiKeyAuth } from "@eidentic/server"; const app = createServer({ agents: { support: agent }, auth: ApiKeyAuth({ key_live_123: { userId: "u1" } }), }); await serveNode(app, { port: 3000 }); // POST /v1/agents/support/query → SSE
Or scaffold a project and boot it in dev:
npm create eidentic@latest my-agent cd my-agent && eidentic dev # loads eidentic.config.ts and serves it
What's in the box
| Area | Highlights |
|---|---|
| Agent | Stateful ReAct loop · event-sourced sessions · composable strategies (reflection / plan-and-execute) · token streaming |
| Memory | Lexical + semantic recall (RRF fusion) · self-editing blocks · temporal knowledge graph · sleep-time consolidation · passive extraction · TTL/dedup |
| Skills | SKILL.md prompt skills · test-gated executable skills (ed25519-signed) · optional self-evolution |
| Multi-agent | spawn_agent delegation with context isolation + shared budget · MCP host & server · A2A protocol |
| Execution | Durable checkpoint/resume (exactly-once) · human-in-the-loop suspension · cooperative cancellation · context compaction |
| Security & ops | Deny-by-default permissions · sandboxed exec (E2B) · secret isolation · cost governor · rate-limit + quotas · OTel · audit-event stream · GDPR erasure |
| Stores | SQLite · libSQL/Turso · Postgres · Convex · vector: LanceDB / pgvector / Qdrant / Pinecone · local + hosted embedders |
| DX | npx eidentic init scaffold · Studio dev dashboard (npx eidentic studio) · eval harness · memory benchmark suite |
Every feature ships a runnable examples/hello-*.ts (most use a mock model, so no API key
needed). See the feature tour for the full list and how to run each one.
Benchmarks
On two public long-term-memory benchmarks, Eidentic's retrieval-based memory beats the full-context baseline — at a fraction of the tokens. Same script, same models, same seed, full splits, full-context baseline included. Honest caveats and the per-category gaps where memory loses are published alongside.
| Benchmark | Full-context | Eidentic memory | Tokens/query |
|---|---|---|---|
| LongMemEval (500 q, ~115k-token haystacks) | 41.0% | 55.2% (+14.2pp, wins all 6 types) | 2.5k vs 99k (~39× less) |
| LoCoMo (1,540 q) | 61.6% | 53.8% (wins temporal +12pp, adversarial +16pp) | 0.9k vs 19k (~21× less) |
The larger the history, the more memory wins: stuffing ~115k tokens into the context window buries the evidence among distractors, while targeted retrieval surfaces it. Methodology, configuration, and reproduction commands: docs/BENCHMARKS.md.
Example apps
Clonable, runnable starter apps — a memory-backed chat agent in each framework. Add an API key
and npm run dev:
- example-nextjs — Next.js App Router +
withEidentichandler +useChat - example-react — Vite + React hooks (
useEidenticStream) against an Eidentic server - example-express — drop the
Agentinto a plain Express route and stream over SSE
Quickstart (from this repo)
pnpm install
pnpm -r build
pnpm --filter eidentic-examples hello # mock model — no API key neededRun against a real model or stream tokens live:
export ANTHROPIC_API_KEY=sk-ant-...
pnpm --filter eidentic-examples hello:real
pnpm --filter eidentic-examples hello:streamDebugging
Set DEBUG=eidentic:* for verbose, namespaced loop logs (model calls, tool dispatch, memory
recall, compaction, cost) with secret values redacted. Scope it (DEBUG=eidentic:tool,eidentic:cost)
to focus. It's the fastest way to see what an agent actually did when something looks off.
DEBUG=eidentic:* pnpm --filter eidentic-examples helloPackage layout
The eidentic umbrella package bundles core, types, model, sqlite, and memory — one
install for the common case. All 32 packages are in this monorepo; optional adapters are
separate installs so you only pay for what you use. This keeps cold-start footprint small
and avoids pulling in native addons you don't need.
| Install separately | Purpose |
|---|---|
@eidentic/server |
Hono HTTP server with auth + SSE streaming |
@eidentic/react |
React hooks (useAgent, useEidenticStream, useAsyncRun, …) |
@eidentic/nextjs |
Next.js App Router adapter (withEidentic, eidenticNextConfig) |
@eidentic/studio |
Dev dashboard — sessions, memory, skills, workflows |
@eidentic/workflow |
Multi-step workflow orchestration |
@eidentic/libsql |
libSQL/Turso store (pure-JS, works under Next.js/Bun/edge) |
@eidentic/postgres |
Postgres store (pgvector-ready) |
@eidentic/convex |
Convex store (StorePort + GraphPort + VectorPort + DurablePort) — reactive, TypeScript-native backend with durable execution |
@eidentic/mcp |
MCP host + server |
| … | pgvector, lancedb, qdrant, pinecone, e2b, langfuse, eval, bench |
npm install eidentic gives you the core stack. Optional packages — server, React hooks,
vector stores, sandbox — are separate installs by design. See the table above.
Production checklist
A few defaults are safe for local development but need attention before going public:
- Studio defaults to NoAuth.
serveStudioandcreateStudioApiexpose full read/write access to agent memory and session traces. Never bind Studio to a publicly reachable address without configuringApiKeyAuth(or a customAuthPort). It is strictly a dev tool. @eidentic/serveralso defaults to NoAuth. AddApiKeyAuth(or your ownAuthPort) before deploying. Combine with your load-balancer's rate-limiting or use the built-in quota/rate-limit options — the server has no default cap on request volume.SkillBankand executable skills. If you allow agent-authored or user-submitted skills, setrequireSigned: trueso only ed25519-signed bundles are accepted. The default quarantine gate helps, but signed skills are the recommended production posture.- Langfuse / observability. If you use
@eidentic/langfuse, passredactAttributesto strip PII or secrets from span attributes before they leave your network. The default records all tool inputs and outputs verbatim.
Docs
- Deployment guide — Node, Docker, edge, Next.js, scaling & ops
- Benchmarks — methodology and reproducible numbers
- Runtime support matrix — Node / Bun / Deno / edge
- Feature tour — run every feature locally
- Design spec — the full architecture
- Stability policy — versioning contract, stability tiers, conformance-suite promise
- Full docs — guides, API reference, and examples (source)
Use the docs with your AI tools
Point your AI coding agent at Eidentic and it answers from the real, current docs:
- MCP (Cursor, Claude Code, Windsurf): add the auto-generated server —
https://gitmcp.io/eidentic/eidentic - Context7: write
use context7in your prompt; the docs are indexed there. - llms.txt: docs.eidentic.dev/llms.txt (index) · llms-full.txt (full text)
- Every docs page has Copy page / Open in ChatGPT / Claude / Perplexity actions.
License
Apache-2.0.





















