SDK Documentation

Anchor provides official SDKs for Python and TypeScript/JavaScript to make integration easier. All SDKs provide full API coverage with type safety, error handling, and framework integrations.

Full-featured Python SDK with support for LangChain, CrewAI, and Mem0 integrations.

pip install anchorai
View Python SDK Docs →

TypeScript/JavaScript SDK with full type definitions and modern async/await support.

npm install anchorai
View TypeScript SDK Docs →

SDK Structure

Both SDKs are organized around 5 core namespaces:

  • agents - Agent registry and lifecycle management
  • config - Versioned agent configuration
  • data - Governed key-value data storage
  • checkpoints - State snapshots and rollback
  • audit - Hash-chained audit trail

Quick Start

Get started with Anchor in just a few lines of code:

Python

from anchor import Anchor

anchor = Anchor(api_key="your-api-key")
agent = anchor.agents.create("support-bot")
anchor.config.update(agent.id, {"policies": {"block_pii": True}})
result = anchor.data.write(agent.id, "key", "value")
print(result.allowed)  # True

TypeScript

import { Anchor } from 'anchorai';

const anchor = new Anchor({ apiKey: 'your-api-key' });
const agent = await anchor.agents.create('support-bot');
await anchor.config.update(agent.id, { policies: { block_pii: true } });
const result = await anchor.data.write(agent.id, 'key', 'value');
console.log(result.allowed);  // true

Framework Integrations

Anchor integrates with popular AI frameworks to add governance to their memory systems:

  • LangChain - Policy-checked memory for LangChain chains and agents
  • CrewAI - Policy-checked shared memory for CrewAI crews
  • Mem0 - Policy-checked memory operations with Mem0

How it works: Anchor works above memory frameworks. Memory frameworks handle "what does the agent remember?" Anchor handles "what is the agent allowed to remember, and can you prove it?" This adds policy enforcement, audit trails, and checkpoints without replacing the memory framework.

See the individual SDK documentation for integration examples.