Development Setup — Beluga AI
This guide walks you through setting up a local development environment for contributing to Beluga AI. The setup is straightforward — Beluga is a standard Go module with no custom build tools beyond the standard Go toolchain and an optional Makefile for common tasks.
Prerequisites
Section titled “Prerequisites”Before you begin, make sure you have the following installed. Go 1.23+ is required because Beluga uses iter.Seq2 (range-over-func iterators) for all streaming APIs — earlier versions will fail to compile:
| Tool | Version | Required | Notes |
|---|---|---|---|
| Go | 1.23+ | Yes | Beluga uses iter.Seq2 and other Go 1.23 features |
| Git | 2.x+ | Yes | For cloning and version control |
| Make | Any | Recommended | Simplifies common tasks via Makefile targets |
| golangci-lint | Latest | Recommended | Runs all configured linters in one pass |
| Node.js | 22+ | Docs only | Only needed if working on the documentation website |
Installing golangci-lint
Section titled “Installing golangci-lint”# macOS / Linuxcurl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin
# Or via Gogo install github.com/golangci/golangci-lint/cmd/golangci-lint@latestFork and Clone
Section titled “Fork and Clone”-
Fork the repository on GitHub by clicking the “Fork” button at github.com/lookatitude/beluga-ai.
-
Clone your fork locally:
Terminal window git clone https://github.com/<your-username>/beluga-ai.gitcd beluga-ai -
Add the upstream remote to keep your fork in sync:
Terminal window git remote add upstream https://github.com/lookatitude/beluga-ai.gitgit fetch upstream -
Create a branch for your work:
Terminal window git checkout -b feat/my-feature
Building
Section titled “Building”Build the entire project to verify your setup. A successful build confirms that your Go version is compatible and all dependencies resolve correctly:
# Using Make (recommended)make build
# Or directly with Gogo build ./...Running Tests
Section titled “Running Tests”# Run all unit testsmake test
# Run integration tests (requires external services)make integration-testSee the Testing Guide for more details on writing and running tests.
Running the Linter
Section titled “Running the Linter”# Run all configured lintersmake lintThe linter checks are the same ones that run in CI, so fix any issues before opening a PR. Running the linter locally avoids wasted CI cycles and gives you faster feedback.
IDE Setup
Section titled “IDE Setup”VS Code
Section titled “VS Code”-
Install the Go extension (
golang.go). -
Open the repository root as your workspace folder.
-
The extension will prompt you to install required tools — accept all.
-
Recommended
settings.jsonadditions:{"go.lintTool": "golangci-lint","go.lintFlags": ["--fast"],"go.testFlags": ["-v", "-count=1"],"editor.formatOnSave": true,"[go]": {"editor.defaultFormatter": "golang.go"}}
GoLand
Section titled “GoLand”- Open the repository root as a project.
- Go to Settings → Go → Go Modules and ensure module integration is enabled.
- Go to Settings → Tools → File Watchers and add
goimportsas a file watcher for automatic import formatting. - Configure Settings → Editor → Code Style → Go to match project conventions.
Project Structure
Section titled “Project Structure”Beluga AI follows a flat package layout with no pkg/ prefix. This keeps import paths short (github.com/lookatitude/beluga-ai/llm rather than github.com/lookatitude/beluga-ai/pkg/llm) and aligns with Go conventions for library modules. Here’s a high-level overview:
beluga-ai/├── core/ # Foundation: Stream, Runnable, Lifecycle, Errors├── schema/ # Shared types: Message, ContentPart, Tool, Event├── config/ # Configuration loading and validation├── o11y/ # Observability: OpenTelemetry, slog adapters├── llm/ # LLM abstraction and providers├── tool/ # Tool system: FuncTool, MCP client├── memory/ # Multi-tier memory (Core/Recall/Archival)├── rag/ # RAG pipeline: embedding, vectorstore, retriever├── agent/ # Agent runtime: BaseAgent, Planner, Executor├── voice/ # Voice pipeline: STT, TTS, S2S, transport├── orchestration/ # Chain, Graph, Router, Parallel├── protocol/ # MCP server/client, A2A├── guard/ # Input/output/tool safety guards├── resilience/ # Circuit breaker, retry, rate limiting├── internal/ # Shared utilities (not public API)└── docs/ # Documentation and websiteFor a detailed breakdown, see the Architecture documentation.
Makefile Reference
Section titled “Makefile Reference”| Target | Description |
|---|---|
make build | Build all packages |
make test | Run unit tests |
make test-verbose | Run unit tests with verbose output |
make integration-test | Run integration tests |
make lint | Run golangci-lint |
make fmt | Format code with gofmt and goimports |
make coverage | Generate test coverage report |
make bench | Run benchmarks |
make fuzz | Run fuzz tests |
make check | Run fmt + lint + test (full pre-PR check) |
make docs | Build the documentation website |
make clean | Remove build artifacts |