Getting Started with OpenBot: Run Your First AI Bot Locally

Let's get straight to the point: OpenBot is a self-hostable AI coworker workspace. It packages a frontend, backend API, bot runtime, and enterprise-grade governance (permissions, audit, approvals) so you can choose your own models, integrate your own agents, and control your own infrastructure.

OpenBot consists of three core parts: OpenBot Frontend (web, desktop, or mobile), OpenBot Backend (responsible for API, built-in bots, and policy enforcement), and CopilotKit Intelligence (providing persistent conversations, memory, and governance services). The OpenBot application itself is open-sourced under the MIT license, while Intelligence is separately licensed—though the free license is sufficient for personal local use.

This article follows the source-code path: we'll start the services on macOS + Docker Desktop and have a built-in bot respond to a plain text message. We won't connect any external tools or actually operate a browser.

Core Dependencies and Environment

Before you begin, make sure your machine meets these requirements:

  • macOS (Apple Silicon or Intel), with Docker Desktop installed. The local Intelligence preview currently only supports this combination.
  • Bun 1.4+: Used for installing dependencies and running helper scripts. See the Bun official docs for installation.
  • Node.js/npm: The npx command comes from here; CopilotKit CLI relies on it.
  • A CopilotKit account: The free developer plan is sufficient, used for logging in and obtaining a local Intelligence license.
  • A model API Key: The main path uses an OpenAI Key; we'll also demonstrate a Defapi-compatible configuration.

Project Structure Overview

The core directories of the cloned repository are as follows:

OpenBot/
├── app/                      # React/Vite frontend (port 3010)
├── api/                      # OpenAPI specs and API client generation
├── scripts/
│   ├── start.sh              # Start the entire service stack
│   └── stop.sh               # Stop and clean up
├── docs/                     # Architecture, configuration, deployment docs
├── examples/
│   └── fintech/
│       ├── agents/           # YAML definitions for custom agents
│       └── catalog/          # Example bot catalog
├── .env.example              # Environment variable template
├── docker-compose.yml        # PostgreSQL, server, agent-computer, etc.
└── backend-images.env        # Backend image version tags

Now, let's get it running step by step.

Step-by-Step Guide

1. Clone the Repository and Install Dependencies

Open a terminal, clone the repository, and enter the directory:

git clone https://github.com/CopilotKit/OpenBot.git
cd OpenBot

Copy the environment variable template, then install Bun dependencies:

cp .env.example .env
bun install

Note that most keys in .env are empty. You need to fill in OPENAI_API_KEY or ANTHROPIC_API_KEY yourself; the KEY_ENCRYPTION_KEY example value is public and fine for local use, but if you plan to deploy for a team, generate your own key with openssl rand -base64 32.

2. Connect Local Intelligence

OpenBot relies on CopilotKit Intelligence for persistent conversations and memory. The source configuration expects it to run locally by default. We run three commands in sequence:

npx --yes copilotkit@latest login
npx --yes copilotkit@latest local setup
npx --yes copilotkit@latest local connect --approve-connection
  • login opens the CopilotKit login page in your browser for authentication.
  • local setup installs Intelligence in a separate local cluster on your machine.
  • local connect writes Intelligence's two URLs and project key into .env automatically.

Here, you need to distinguish two types of costs: the Intelligence license is free for personal local use (valid for 30 days; after expiration, run npx copilotkit@latest local renew to renew); model inference costs depend on which model provider you choose later.

3. Configure the Model Provider

Now comes the crucial part: letting OpenBot know where to call the LLM.

Main Path: OpenAI Key

Fill in your OpenAI API Key in .env:

OPENAI_API_KEY=sk-your-key

This makes OpenBot use the official OpenAI API for the selected model. If you want to use Anthropic, change it to:

ANTHROPIC_API_KEY=sk-ant-your-key
BOT_PROVIDER=anthropic

Alternative Path: Defapi-Compatible Connection

If you want to access models at lower cost, Defapi (https://defapi.org) is an OpenAI-compatible API provider with prices roughly half of the official ones. It supports mainstream protocols like v1/chat/completions, v1/messages, and v1beta/models/.

Configure it in .env like this:

OPENAI_BASE_URL=https://api.defapi.org/v1
OPENAI_API_KEY=defapi-你的密钥
BOT_PROVIDER=openai
BOT_MODEL=thinkingmachines/inkling-2-mini
COPILOTKIT_OPENAI_API=chat

OPENAI_BASE_URL determines where all OpenAI-shaped requests go. BOT_MODEL specifies the exact model name, which must match the provider's published name exactly. COPILOTKIT_OPENAI_API=chat tells the built-in bot to use the /chat/completions endpoint. The gateway must also support the request fields the bot actually uses.

A special note: whether Defapi's model catalog is discovered by OpenBot's model selector cannot be inferred from whether the chat endpoint is available. Our verification must be done in three layers:

  1. Endpoint authentication: Requesting /v1/chat/completions without a key should return 401, which only proves the endpoint is reachable.
  2. Model list: GET /v1/models is used to check the catalog the model selector relies on. Probing that endpoint without a key returns 404; use a real account to check whether the provider offers a usable catalog.
  3. Actual response: Only when you initiate a real conversation and get a reply can you confirm the model is usable.

If the model selector does not list Defapi's models, first check account permissions and catalog capabilities, then return to the official docs for a clearly supported OpenAI configuration to complete verification. Do not assume compatibility. Additionally, Defapi's specific model pricing is according to its model page (e.g., thinkingmachines/inkling-2-mini).

There's another point that's easy to confuse: OPENAI_API_KEY in .env is the model provider's API key; while CPK_INTELLIGENCE_API_KEY is the CopilotKit project key, automatically written by local connect. The two have different purposes—don't mix them up.

4. Fill in Remaining Required Fields

Make sure the following variables in .env have values:

INTELLIGENCE_API_URL=          # Written by local connect
INTELLIGENCE_GATEWAY_WS_URL=   # Written by local connect
CPK_INTELLIGENCE_API_KEY=      # Written by local connect
DATABASE_URL=postgres://openbot:openbot@localhost:5432/openbot # Local template example
KEY_ENCRYPTION_KEY=            # Example value is fine, or generate your own
OPENBOT_SINGLE_USER=true       # Personal mode, skip login

.env.example already sets OPENBOT_SINGLE_USER=true, which lets us try it as a local administrator without configuring OAuth login. Before removing this line, make sure to configure one of Google, Microsoft, or Okta, or the service will refuse to start.

5. Start Services and Send Your First Message

Once everything is ready, start the entire service stack:

bash scripts/start.sh

start.sh pulls backend images, starts Docker services (including PostgreSQL and the API server on port 3001), runs the frontend on port 3010, and checks the health of each service. The first run requires downloading images, so keep your network connection stable.

After startup, open http://localhost:3010 in your browser. You'll see the OpenBot workspace interface.

Now create your first bot:

  1. Click Bots in the left navigation.
  2. Select New Bot, give it a name and role description, e.g., "Data analyst, good at interpreting tabular data."
  3. After saving, go to the bot's conversation page.
  4. Submit a plain text test message in the input box, e.g., "Explain in one sentence what the AG-UI protocol is."

After pressing send, you'll see the bot start to reply. Seeing a complete text response is the success indicator. This step involves no additional external connections or actual tool operations.

If your workspace already has built-in bots, you can also test with them directly.

Troubleshooting Common Issues

Docker services fail to start

First confirm Docker Desktop is running, then check the logs: docker compose logs server. If ports are occupied, check whether 3001, 3010, 5432 are being listened to by other processes: lsof -i :3001.

Connection fails after Intelligence login

local connect must be run from the root of the OpenBot repository because it directly modifies .env. If the connection information was written incorrectly, you can rerun npx copilotkit@latest local connect --approve-connection. Confirm that INTELLIGENCE_API_URL and INTELLIGENCE_GATEWAY_WS_URL in .env point to the same local installation's API and WebSocket gateway.

Page loads but API is inaccessible

Check whether scripts/start.sh exited completely. If it's stuck at the "check services" stage, a health check failed. First look at docker compose logs server. If logs show database connection issues, verify the connection string, database container, and port for the current deployment against the template used here.

Requests return 401 or 403

Confirm that OPENBOT_SINGLE_USER=true in .env has not been removed. If it's a 401, it's likely an API key issue; if Defapi returns 401, it only indicates the authentication endpoint is reachable, not that the model is usable—check item by item using the three-layer verification mentioned earlier.

Model errors with unknown model or not found

The model name must be the exact name published in the provider's catalog. With Defapi, check the response of GET https://api.defapi.org/v1/models (with your key) to confirm the model ID. If the catalog is unavailable, switch back to the official OpenAI address to complete verification—do not force an incompatible configuration.

Received a reply but connectors are unavailable

Plain-text verification only needs the model and workspace. When you need to access external services later, follow that connector's documentation to authorize accounts and configure bot permissions.

Stopping Services and Further Reading

When you're done testing, shut down all services, including each bot's dedicated computer container, with the following command:

bash scripts/stop.sh

Data is not deleted; the database, bot files, and browser configurations are saved in volumes, and will be reused the next time you run bash scripts/start.sh.

Want to go further? Here are some directions worth exploring:

  • Desktop installation: Without touching the terminal, directly download OpenBot Desktop and choose the Apple Silicon Mac, Intel Mac, or Windows x64 installer based on your processor.
  • Team deployment: Refer to the Kubernetes deployment guide, use Helm charts to run on AWS EKS or Azure AKS, and configure company login and auditing.
  • AG-UI protocol: Learn how AG-UI allows agents from different frameworks (LangGraph, Mastra, CrewAI, etc.) to integrate into the same workspace.
  • Custom bots: Read docs/coworkers.md to understand bot roles, conversations, and visibility scopes.