# Get started with kbagent

This walkthrough takes you from nothing to browsing a real project with [kbagent](https://help.keboola.com/cli/) in a few minutes. Follow it top to bottom for a single project; the [Connect more](https://help.keboola.com/cli/getting-started/#connect-more-projects) section covers multi-project and organization setup.

## Step 1 — Install

Pick your operating system:

### macOS

**Recommended** — the prebuilt wheel via the install script:

```bash
curl -LsSf https://raw.githubusercontent.com/keboola/cli/main/install.sh | sh
```

Then **open a new terminal**.

Alternative — [uv](https://docs.astral.sh/uv/), if you want to pin to a version or uninstall cleanly:

```bash
uv tool install "keboola-cli[server]"
```

### Linux

**Recommended** — the prebuilt wheel via the install script:

```bash
curl -LsSf https://raw.githubusercontent.com/keboola/cli/main/install.sh | sh
```

Then **open a new terminal**.

Alternative — [uv](https://docs.astral.sh/uv/), if you want to pin to a version or uninstall cleanly:

```bash
uv tool install "keboola-cli[server]"
```

### Windows

The `curl … | sh` one-liner **cannot run on Windows**. Windows has shipped `curl.exe` since Windows 10 1803, but it has no `sh`, so the command fails with `'sh' is not recognized` in both `cmd` and PowerShell. Installing Git for Windows does not fix that. Its installer only puts `C:\Program Files\Git\cmd` on `PATH`, while `sh.exe` lives in `usr\bin`.

**Recommended**: PowerShell, no POSIX shell needed. This fetches the same wheel the install script would have:

```powershell
winget install --id astral-sh.uv -e
$ver = (Invoke-RestMethod "https://api.github.com/repos/keboola/cli/releases/latest").tag_name.TrimStart('v')
uv tool install --force "keboola-cli[server] @ https://github.com/keboola/cli/releases/download/v$ver/keboola_cli-$ver-py3-none-any.whl"
uv tool update-shell
```

Skip the first line if you already have [uv](https://docs.astral.sh/uv/). That line installs uv itself. The whole block works in the in-box Windows PowerShell 5.1, so you don't need PowerShell 7.

The second line calls the GitHub API without a token. If you are rate-limited or behind a proxy that blocks it, `$ver` comes back empty and the third line asks uv for a URL that does not exist, which surfaces as a 404. Check with `echo $ver`. If it is empty, read the version off the [releases page](https://github.com/keboola/cli/releases/latest) and set it by hand, e.g. `$ver = "0.91.0"`.

Then **open a new shell**. `uv tool update-shell` edits the persisted `PATH`, and the session you ran it in will not see the change.

Two alternatives:

- **Already have Git for Windows?** Run the documented script through its bash:

  ```powershell
  & "C:\Program Files\Git\bin\bash.exe" -lc "curl -LsSf https://raw.githubusercontent.com/keboola/cli/main/install.sh | sh"
  ```

- **No Python on the machine?** Every release ships a self-contained build. Download `keboola-cli2_<version>_windows_amd64.zip` from the [releases page](https://github.com/keboola/cli/releases/latest), unpack it, and put the folder on `PATH`. It carries its own interpreter and needs neither Python nor uv.

> **Caution: Not via a package manager**
>
> There is no WinGet package for kbagent itself, and the Chocolatey package lags far behind the current release. Use one of the three paths above.

---

Whichever method you use, kbagent keeps itself current with its own startup update check (`kbagent update` runs one manually).

Confirm it's on your `PATH` (all platforms). Any version line like the one below means it worked.

```console
$ kbagent --version
kbagent v1.4.1
```

**`command not found` on macOS or Linux?** kbagent lives in `~/.local/bin` (the install script and `uv tool install` both put it there), but neither can change the `PATH` of the shell that ran them. Open a new terminal, or add the folder to the current shell, which is also what a script or an AI agent needs:

```bash
export PATH="$HOME/.local/bin:$PATH"
```

In fish, run `fish_add_path ~/.local/bin` instead. If a new terminal still answers `command not found`, `~/.local/bin` isn't on your `PATH` for good, which happens when uv came from Homebrew, pip or another package manager: run `uv tool update-shell`, then open another terminal.

> **Tip**
>
> On any platform you can also run kbagent through [uvx](https://docs.astral.sh/uv/) without installing (`uvx --from 'git+https://github.com/keboola/cli' kbagent …`) — handy for a one-off or in CI.

## Step 2 — Connect your project

Register a project with the CLI so you (or your agent) can reach it. There are two ways in: sign in through the browser, or hand kbagent a Storage API token.

### Sign in through the browser

At your own keyboard, this is the shortest route. It needs no token.

First sign in to the stack:

```bash
kbagent auth login --stack https://connection.keboola.com
```

That opens a browser, and you finish the sign-in there. On a machine with no browser it prints a code you type into a page on another device instead.

Then pick which projects to register locally:

```bash
kbagent auth register-projects
```

It shows a picker of every project the account can reach and registers the ones you choose. Add `--all` to register all of them without the picker.

`auth login` needs a person to approve the sign-in in a browser, so it can't run unattended. On a machine without a browser, add `--device-code`: it prints a link and a code to open on another device. The picker of `auth register-projects` needs a real terminal; in a script, pass `--all` or `--project-id <id>` instead.

### Or register one project with a token

```bash
kbagent project add --alias prod --url https://connection.keboola.com --token YOUR_TOKEN
```

`project add` is the static-token route. It reads the token from `--token`, or from `KBC_TOKEN` if you'd rather keep it off the command line. With neither, it prompts with hidden input, so the value never lands in your shell history. That prompt needs a TTY an agent's tool-run shell does not have.

Swap the URL for your own stack. `prod` is an **alias** you pick. You use it with `--project` later, or set it as the default with `kbagent project use prod`. Add as many projects as you want.

You sign in once per machine. Every tool reads the same local config, so a project you connected here is already there in Claude Code, Cursor, VS Code and the rest. `kbagent project list` shows what is registered, and its `Auth` column says `session` or `static` per project.

### When you need a token

CI, containers, cron, and anything else running unattended need a Storage API token, because `auth login` cannot run there. Kai and the Python SDK still need a static token rather than a browser session. Since kbagent 0.94.0, a browser session covers apps and streams too.

**These docs cannot create a token for you.** Open your project in the Keboola UI and go to **Settings → Developer settings → Agentic CLI**. That page builds the exact `kbagent project add` command for your project and your stack, and it can include a read-only token in it. Copy it from there.

If you don't see **Agentic CLI** in your project's settings, create the token yourself under **Settings → API Tokens** and pass it as `--token`. [API tokens](https://help.keboola.com/management/project/tokens/) covers that screen.

A Storage API token is enough for browsing. Some commands need an admin (master) token, e.g. creating branches or workspaces needs admin privileges. Token types and scoping options are covered in [API tokens](https://help.keboola.com/management/project/tokens/).

> **Caution**
>
> kbagent only talks to your Keboola stack, but the config directory stores project credentials. Treat it as sensitive, and never paste tokens into shared terminals or commit them.

## Step 3 — Verify the connection

`kbagent doctor` checks your configuration and connectivity. Once a project is connected it confirms the link and flags anything else worth doing (like installing the agent plugin):

![kbagent doctor output: config found, project 'docs-demo' connected to the stack (L0 - Shopify, id 264), CLI version PASS, and warnings for the MCP server and Claude Code plugin](https://help.keboola.com/cli/terminal-connect.png)

You can also test connectivity on its own with `kbagent project status`.

## Step 4 — Browse the project

Explore what's there. Recent jobs:

![kbagent job list --limit 5: a table of recent jobs in docs-demo with job ID, success status, component, created time, and duration](https://help.keboola.com/cli/terminal-browse.png)

```bash
kbagent job list --limit 5    # recent jobs (shown above)
kbagent project list          # connected projects
kbagent config list           # configurations in the active project (--all-projects for all)
```

## Step 5 — Search

Find configs, tables, buckets, and flows by name or content:

```bash
kbagent search "shopify"
```

> **Note**
>
> `kbagent search` uses Keboola's Global Search by default. If a project doesn't have that feature enabled, kbagent says so — add `--search-type config-based` to scan configurations directly instead.

## Step 6 — Go further

- **Add `--json`** to any command for machine-readable output — this is what an AI agent consumes.
- **Set a conversation ID** when an agent drives kbagent, so platform observability can correlate the session (adds an `X-Conversation-ID` header):

  ```bash
  export KBAGENT_CONVERSATION_ID="<unique-id>"
  ```

## Connect more projects

**Several projects** — register each one with `project add`, or bulk-onboard with a Manage API token:

```bash
KBC_MANAGE_API_TOKEN=xxx kbagent --allow-env-manage-token \
  org setup --project-id 901 --project-id 9621 --url https://connection.keboola.com --yes
```

**A whole organization** (org admin) — kbagent registers every project and mints per-project tokens:

```bash
KBC_MANAGE_API_TOKEN=xxx kbagent --allow-env-manage-token \
  org setup --org-id 123 --url https://connection.keboola.com --yes
```

Read commands such as `config list`, `job list` and `search` then take `--all-projects` to fan out across every connected project — see [multi-project](https://help.keboola.com/cli/concepts/#multi-project-and-stacks).

---

Something failing along the way? The [Troubleshooting](https://help.keboola.com/cli/troubleshooting/) page covers the most common errors and their fixes.

**Next:** [How kbagent works →](https://help.keboola.com/cli/concepts/)
