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 chat with Nira, run playbooks, and create conversational interfaces.

Features

High-Level API

Clean, intuitive interface for Nira, playbooks, and conversations

Streaming Support

Real-time SSE streaming for Nira 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_...' });

// Create a conversation with Nira
const conversation = await nb.nira.conversations.create('My chat session');

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

// Or run a playbook
const result = await nb.playbooks.invoke('playbook-id');
console.log('Playbook result:', result);

SDK Structure

The SDK is organized into namespaces that mirror the NimbleBrain Studio concepts:
NamespacePurpose
nb.niraChat with Nira (conversations, messages, streaming)
nb.playbooksList and execute playbooks
nb.executionsTrack playbook execution status
nb.connectionsManage workspace connections

When to Use the SDK

Create your own chat UI that connects to Nira. 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