Go SDK
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:
| Package | Description |
|---|---|
sdk | Main SDK client with access to all ChatBotKit API resources |
agent | High-level agent execution functionality with tool support |
types | Auto-generated API request and response types |
sdk/integration | Integration 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
| Method | Description |
|---|---|
Conversation.CompleteStream | Stream a conversation completion |
Conversation.SendStream | Stream a send message operation |
Conversation.ReceiveStream | Stream a receive message operation |
agent.CompleteStream | Stream agent completion |
agent.CompleteWithTools | Stream agent completion with tool execution |
agent.ExecuteWithTools | Stream autonomous agent execution with tools |
Configuration Options
| Option | Description |
|---|---|
Secret | API authentication token (required) |
BaseURL | Custom API base URL |
RunAsUserID | Execute requests as a specific user (Partner API) |
Timezone | Timezone 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.