> ## Documentation Index
> Fetch the complete documentation index at: https://docs.boostgpt.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Core SDK Overview

> Build and manage AI agents with the BoostGPT Core SDK

## What is the Core SDK?

The Core SDK provides programmatic access to create, manage, and interact with BoostGPT agents. It handles bot management, chat interactions, and training data.

## Installation

```bash theme={null}
npm install boostgpt
```

## Quick Start

```javascript theme={null}
import { BoostGPT } from 'boostgpt';

const client = new BoostGPT({
  project_id: process.env.BOOSTGPT_PROJECT_ID,
  key: process.env.BOOSTGPT_API_KEY
});
```

## Key Features

<CardGroup cols={2}>
  <Card title="Bot Management" icon="robot" href="/sdk/core/bot-management">
    Create, update, and delete bots
  </Card>

  <Card title="Chat API" icon="messages" href="/sdk/core/chat-api">
    Send messages and get AI responses
  </Card>

  <Card title="Training Data" icon="book" href="/sdk/core/training-data">
    Add knowledge to your bots
  </Card>

  <Card title="API Reference" icon="code" href="/sdk/core/api-reference">
    Complete method documentation
  </Card>
</CardGroup>

## Response Format

All SDK methods return a consistent format:

```javascript theme={null}
{
  err: null | string,      // Error message if failed
  response: object | null  // Response data if successful
}
```

Always check `err` before using `response`:

```javascript theme={null}
const result = await client.createBot({
  name: 'My Bot',
  model: 'gpt-5-mini',
  instruction: 'You are helpful.'
});

if (result.err) {
  console.error('Error:', result.err);
} else {
  console.log('Success:', result.response);
}
```

## Available Methods

### Bot Management

* `createBot()` - Create a new bot
* `fetchBot()` - Get bot details
* `fetchBots()` - List all bots (paginated)
* `updateBot()` - Update bot settings
* `resetBot()` - Delete all training data
* `deleteBot()` - Delete a bot

### Chat

* `chat()` - Send message and get response (supports streaming)
* `fetchChat()` - Get chat history
* `fetchChats()` - List all chats (paginated)
* `deleteChat()` - Delete chat history
* `search()` - Search bot's knowledge base
* `executeTool()` - Execute tool calls
* `voteMessage()` - Upvote/downvote messages
* `fetchVoteStatus()` - Get message vote status
* `deleteMessage()` - Delete a specific message

### Training

* `startTraining()` - Add training content (queued)
* `fetchTraining()` - Get training source
* `fetchTrainings()` - List training data (paginated)
* `updateTraining()` - Update training source
* `deleteTraining()` - Remove training data

### Subscribers

* `fetchSubscribers()` - Get all subscribers (paginated)

### Analytics & Statistics

* `fetchVoteStats()` - Get voting statistics
* `fetchSummaryStats()` - Get summary statistics
* `fetchDashboardStats()` - Get dashboard statistics
* `fetchToolUsageStats()` - Get tool usage statistics
* `fetchWorkflowStats()` - Get workflow statistics
* `fetchPerformanceMetrics()` - Get performance metrics
* `fetchBehaviorStats()` - Get user behavior statistics
* `fetchErrorAnalysis()` - Get error analysis
* `fetchReasoningSummary()` - Get reasoning summary

## Example Usage

```javascript theme={null}
// Create a bot
const bot = await client.createBot({
  name: 'Support Bot',
  model: 'gpt-5-mini',
  instruction: 'You are a customer support assistant.'
});

// Add training
await client.startTraining({
  bot_id: bot.response.id,
  type: 'text',
  source: 'We offer 24/7 support at support@example.com'
});

// Chat
const response = await client.chat({
  bot_id: bot.response.id,
  message: 'How can I contact support?'
});

console.log('Bot:', response.response);
```

## Next Steps

<CardGroup cols={2}>
  <Card title="Installation" icon="download" href="/sdk/core/installation">
    Install and configure SDK
  </Card>

  <Card title="Bot Management" icon="robot" href="/sdk/core/bot-management">
    Create and manage bots
  </Card>
</CardGroup>
