ContextDB Cloud TypeScript SDK 0.1.0-alpha.4: Server-Only AI Agent Memory
Pre-release
Pre-release
Use persistent AI agent memory without exposing project keys in browser code
@contextdb/cloud 0.1.0-alpha.4 is the server-only TypeScript SDK for ContextDB Cloud. It gives Node.js voice, support, and workflow agents typed access to memory writes, recall, consistency tokens, action decisions, confirmations, execution receipts, and verifiable deletion.
This release fails closed in browser runtimes and tells bundlers the package is not browser-compatible. ContextDB project keys remain backend credentials.
Install
npm install @contextdb/cloudExample: remember a caller preference from a Node.js service
import { CloudClient } from "@contextdb/cloud";
const db = new CloudClient({
baseUrl: "https://api.contextdb.ai",
apiKey: process.env.CONTEXTDB_API_KEY!,
});
const saved = await db.remember(
"caller-1",
"Tuesday morning works best",
{
source: "user_stated",
idempotencyKey: "call-42-preference",
},
);
const recalled = await db.recall(
"caller-1",
"When should I schedule the appointment?",
{
minMemoryVersion: saved.memory_version,
minPrimaryWalLsn: saved.primary_wal_lsn,
},
);Use cases
- Retell, LiveKit, and Pipecat voice agents: remember caller preferences across sessions.
- Customer support agents: ground responses in prior conversations and confirmed constraints.
- Workflow agents: require act/ask/abstain decisions before consequential tools run.
- Read-after-write turns: use consistency tokens when the next recall must see a recent memory change.
- Privacy workflows: delete scoped memories and verify removal.
Security changes
CloudClientthrows when constructed in a browser runtime.package.jsondeclaresbrowser: falsefor bundlers.- Published JavaScript and declaration source maps were removed.
- The package contains no API keys, connection strings, environment values, private Cloud server code, or absolute build paths.
- Full client source remains public for auditability.
Package proof
- 17 tests passed, including browser rejection.
- The npm tarball contains 10 files and zero source maps.
- The package is public and was published through GitHub OIDC provenance.
Links
- Install @contextdb/cloud on npm
- ContextDB Cloud documentation
- Public source and OpenAPI contract
- Python SDK on PyPI
- Open-source ContextDB engine
Can I use this SDK in a Next.js app?
Yes, but only in server routes, server actions, workers, or other backend-only modules. Never import it into a client component or expose a cdb_ key to browser JavaScript.
Is it production-ready?
No. The SDK and hosted service are alpha, and no public availability SLA is claimed.
Start with the ContextDB Cloud documentation.