thinkn
  • Product
    Manifesto
    The reason we exist
    Founder Studioprivate beta
    Make better product decisions faster
    Belief SDKinvite only
    Add belief states to your AI system
    Request Access →Join the private beta waitlist
  • Docs
  • Pricing
  • FAQ
  • Docs
  • Pricing
  • FAQ
Sign In
Welcome
  • Hack Guide
  • Introduction
  • Install
  • Quickstart
  • FAQ
  • The Problem
  • Memory vs Beliefs
  • Drift
  • Examples
  • Overview
  • Core API
  • Loop Patterns
  • Scoping
  • Patterns
  • Adapters
sdk/adapters.mdx

Adapters

How adapters connect beliefs to your agent framework.

What Adapters Do

Adapters wire the before/after lifecycle into your agent framework automatically. They:

  • Register lifecycle hooks with your framework's event system
  • Inject belief context into system prompts before each turn
  • Route agent output and tool results to after after each turn
  • Handle capture modes (what to extract beliefs from)

The core SDK already extracts beliefs automatically from output and toolCalls. Adapters handle the framework lifecycle so you do not need to call before/after yourself.

When to Use an Adapter

Use an adapter when one exists for your framework. It handles lifecycle wiring with minimal configuration.

Use the core SDK directly when:

  • Your framework is not supported
  • You are building a custom agent loop
  • You want to submit beliefs from non-agent sources (user input, external data)
  • You need fine-grained control over when before/after are called

Available Adapters

AdapterImportFrameworkStatus
Claude Agent SDKbeliefs/claude-agent-sdkAnthropic Claude Agent SDKAvailable
Vercel AIbeliefs/vercel-aiVercel AI SDKAvailable
React@beliefs/reactReactComing soon
DevTools@beliefs/devtoolsBrowserComing soon

Building a Custom Adapter

Adapters are thin wrappers around the core SDK. The minimal interface:

1function myAdapter(beliefs: Beliefs, options?: AdapterOptions) {
2  return {
3    async before(input: string) {
4      const context = await beliefs.before(input)
5      return context
6    },
7
8    async after(output: string) {
9      return beliefs.after(output)
10    },
11  }
12}

The core SDK handles belief extraction from output. Your adapter's job is lifecycle wiring — connecting your framework's events to before/after.

Claude Agent SDK

Hook-based integration.

Learn more

Vercel AI

Middleware-based integration.

Learn more
PreviousPatterns
NextClaude Agent SDK

On this page

  • What Adapters Do
  • When to Use an Adapter
  • Available Adapters
  • Building a Custom Adapter