SDK Overview

The Brain SDK provides TypeScript-first abstractions over the full protocol stack from account creation to agent deployment, policy management, and x402 payment handling.

Installation

npm install @brain-protocol/sdk

Client Initialization

import { BrainClient } from '@brain-protocol/sdk';

const client = new BrainClient({
  rpcUrl: 'https://mainnet.base.org',         // Base for execution
  bundlerUrl: 'https://api.alchemy.com/...',  // ERC-4337 bundler
  signerKey: process.env.SIGNER_PRIVATE_KEY,  // Never committed to source
  network: 'base',                            // 'base' | 'mainnet'
});

Top-Level Namespaces

Namespace
Description

client.accounts

Create and manage Brain smart accounts

client.agents

Deploy, configure, pause, and revoke agents

client.policies

Build, update, and verify policies

client.payments

Handle x402 flows and query payment history

client.trust

Query agent reputation and validation records

Network Configuration

Brain deploys on two networks with distinct roles:

Network
Role

Base

Primary execution environment — low cost, fast finality

Ethereum

Settlement and identity anchor — ERC-8004 registry, high-value settlement

Environment Variables

circle-exclamation

Last updated