# Go packages (pkg/agent and pkg/tools)

> Embed clai agents and tools directly in your own Go applications via pkg/agent and pkg/tools.

Canonical URL: https://www.clai.chat/docs/v0.1/reference/go-sdk/ · Version: 0.1 · Updated: 2026-10-21

Full site index: https://www.clai.chat/llms.txt

In addition to the `clai` CLI binary, the repository exports `github.com/baalimago/clai/pkg/agent` and `github.com/baalimago/clai/pkg/tools` so Go programs can embed `clai`'s multi-vendor agent loop and tool registry as a library.

## Installing the Go module

```sh
go get github.com/baalimago/clai@latest
```

## `pkg/agent`

`pkg/agent` provides a high-level agent abstraction that wraps `clai`'s vendor queriers, conversation history, system prompts, and tool execution loop. You can initialize an agent from existing `clai` configuration files or construct one programmatically with custom options.

## `pkg/tools`

`pkg/tools` exposes the tool interface and builtin terminal tools (`bash`, `rg`, `file_tree`, `find`, `write_file`, `web_search`, `website_text`, `recall`) so you can register your own typed Go functions alongside `clai`'s builtin and MCP tools.

See the package READMEs in the [clai repository](https://github.com/baalimago/clai) for complete runnable Go examples.
