ChatBotKit Go SDK allows developers to build conversational AI interfaces and chatbots using Go. Learn how to install and use the SDK, along with its authentication, streaming, and agent execution features.

ChatBotKit Go SDK is the official Go software development kit for building conversational AI interfaces and chatbots. It provides a comprehensive set of tools, libraries, and APIs to help developers create AI-powered applications using the Go programming language.

Installation

To install ChatBotKit Go SDK, simply run the following command:

Requirements

  • Go 1.21 or later
  • A ChatBotKit API key from the Dashboard

Quick Start

SDK Structure

The Go SDK is organized into focused packages:

PackageDescription
sdkMain SDK client with access to all ChatBotKit API resources
agentHigh-level agent execution functionality with tool support
typesAuto-generated API request and response types
sdk/integrationIntegration clients (Widget, Slack, Discord, WhatsApp, etc.)

SDK Client

The main sdk package provides access to all ChatBotKit API resources:

Resource Operations

Bots

Conversations

Datasets

Agent Package

The agent package provides high-level functionality for running AI agents.

Complete

Run a single conversation completion:

Execute

Run a multi-turn agent execution:

Complete with Tools

Run a conversation with custom tool handlers:

Default Tools

The SDK provides default tools for common file and shell operations:

Streaming

The SDK supports streaming responses for real-time processing:

Available Streaming Methods

MethodDescription
Conversation.CompleteStreamStream a conversation completion
Conversation.SendStreamStream a send message operation
Conversation.ReceiveStreamStream a receive message operation
agent.CompleteStreamStream agent completion
agent.CompleteWithToolsStream agent completion with tool execution
agent.ExecuteWithToolsStream autonomous agent execution with tools

Configuration Options

OptionDescription
SecretAPI authentication token (required)
BaseURLCustom API base URL
RunAsUserIDExecute requests as a specific user (Partner API)
TimezoneTimezone for timestamp handling

Error Handling

API errors are returned with a message and code:

Types Package

The types package contains all API request and response types:

Conclusion

This concludes the documentation for ChatBotKit Go SDK. For more information on how to use the SDK, please refer to the official repository at https://github.com/chatbotkit/go-sdk.