Skip to content
Docs

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.

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:

ToolVersionRequiredNotes
Go1.23+YesBeluga uses iter.Seq2 and other Go 1.23 features
Git2.x+YesFor cloning and version control
MakeAnyRecommendedSimplifies common tasks via Makefile targets
golangci-lintLatestRecommendedRuns all configured linters in one pass
Node.js22+Docs onlyOnly needed if working on the documentation website
Terminal window
# macOS / Linux
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin
# Or via Go
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
  1. Fork the repository on GitHub by clicking the “Fork” button at github.com/lookatitude/beluga-ai.

  2. Clone your fork locally:

    Terminal window
    git clone https://github.com/<your-username>/beluga-ai.git
    cd beluga-ai
  3. Add the upstream remote to keep your fork in sync:

    Terminal window
    git remote add upstream https://github.com/lookatitude/beluga-ai.git
    git fetch upstream
  4. Create a branch for your work:

    Terminal window
    git checkout -b feat/my-feature

Build the entire project to verify your setup. A successful build confirms that your Go version is compatible and all dependencies resolve correctly:

Terminal window
# Using Make (recommended)
make build
# Or directly with Go
go build ./...
Terminal window
# Run all unit tests
make test
# Run integration tests (requires external services)
make integration-test

See the Testing Guide for more details on writing and running tests.

Terminal window
# Run all configured linters
make lint

The 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.

  1. Install the Go extension (golang.go).

  2. Open the repository root as your workspace folder.

  3. The extension will prompt you to install required tools — accept all.

  4. Recommended settings.json additions:

    {
    "go.lintTool": "golangci-lint",
    "go.lintFlags": ["--fast"],
    "go.testFlags": ["-v", "-count=1"],
    "editor.formatOnSave": true,
    "[go]": {
    "editor.defaultFormatter": "golang.go"
    }
    }
  1. Open the repository root as a project.
  2. Go to Settings → Go → Go Modules and ensure module integration is enabled.
  3. Go to Settings → Tools → File Watchers and add goimports as a file watcher for automatic import formatting.
  4. Configure Settings → Editor → Code Style → Go to match project conventions.

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 website

For a detailed breakdown, see the Architecture documentation.

TargetDescription
make buildBuild all packages
make testRun unit tests
make test-verboseRun unit tests with verbose output
make integration-testRun integration tests
make lintRun golangci-lint
make fmtFormat code with gofmt and goimports
make coverageGenerate test coverage report
make benchRun benchmarks
make fuzzRun fuzz tests
make checkRun fmt + lint + test (full pre-PR check)
make docsBuild the documentation website
make cleanRemove build artifacts