Skip to main content
The NimbleBrain SDK provides a clean, type-safe interface for building applications that interact with NimbleBrain Studio. Use it to programmatically manage agents, run playbooks, and create conversational interfaces.

Features

High-Level API

Clean, intuitive interface for agents, playbooks, and conversations

Streaming Support

Real-time SSE streaming for agent responses with typewriter effect

TypeScript First

Full type definitions for all API responses and methods

Auto-Generated Types

OpenAPI-generated types ensure API compatibility

Installation

npm install @nimblebrain/sdk
Or with your preferred package manager:
npm install @nimblebrain/sdk

Quick Example

import { NimbleBrain } from '@nimblebrain/sdk';

// Initialize the SDK with your API key
const nb = new NimbleBrain({ apiKey: 'nb_live_...' });

// List agents in your workspace
const agents = await nb.agents.list();
console.log('Available agents:', agents);

// Create a conversation and chat with an agent
const conversation = await nb.conversations.create(agents[0].id);

// Stream the response in real-time
for await (const event of nb.messages.stream(agents[0].id, conversation.id, 'Hello!')) {
  if (event.type === 'content') {
    process.stdout.write(event.data.text as string);
  }
}

SDK Structure

The SDK is organized into namespaces that mirror the NimbleBrain Studio concepts:
NamespacePurpose
nb.agentsList and interact with agents
nb.conversationsCreate and manage conversations
nb.messagesSend messages and stream responses
nb.playbooksList and execute playbooks
nb.executionsTrack playbook execution status

When to Use the SDK

Create your own chat UI that connects to NimbleBrain agents. The streaming API provides real-time responses for a smooth user experience.
Run playbooks programmatically from your backend services. Integrate NimbleBrain automations into your existing workflows.
Trigger playbooks as part of your deployment process. For example, run a playbook that notifies your team after each deployment.
Build internal tools that leverage NimbleBrain’s AI capabilities without using the Studio UI.

Requirements

  • Node.js 18.0 or later (for native fetch support)
  • API Key from NimbleBrain Studio

Getting Your API Key

  1. Log in to NimbleBrain Studio
  2. Navigate to Settings > API Keys
  3. Click Create API Key
  4. Copy the key (it starts with nb_live_ or nb_test_)
Keep your API key secure. Never commit it to version control or expose it in client-side code.

Next Steps