Skip to main content

CLI tool to interact with BAT agents

Project description

bat-cli

A CLI tool for creating, building, and evaluating BAT agent projects.

Prerequisites

  • Python 3.12+ and uv installed
  • Docker installed (required for bat build and bat push)
  • For evaluation commands: an existing BAT agent root containing agent.json, config.yaml, and pyproject.toml

Installation

Option A — install system-wide with uv tool (recommended)

Installs bat into an isolated environment and puts the executable on your PATH, so it is available from any directory.

# from PyPI
uv tool install bat-cli


Make sure the uv tools bin directory is on your `PATH` (uv prints the path on first
install; this is usually `~/.local/bin`):

```bash
uv tool update-shell      # adds the uv tools dir to your shell profile

Then verify:

bat --help

To upgrade or remove later:

uv tool upgrade bat-cli
uv tool uninstall bat-cli

Option B — install into a virtual environment with uv pip

Use this when you want bat scoped to a specific project/venv rather than installed globally.

uv venv                      # create .venv (skip if you already have one)
source .venv/bin/activate    # .venv\Scripts\activate on Windows

# from PyPI
uv pip install bat-cli

# or from a local checkout (run from the cli/ directory)
uv pip install .             # add -e for an editable/development install

bat is available whenever that virtual environment is active:

bat --help

Option C — run without installing (development)

From the cli/ directory:

uv sync --group dev
uv run bat --help

All examples below show bat ...; replace with uv run bat ... when using this option.


Command Tree

bat
├── init
│   └── agent
│       ├── <name>
│       ├── --clients, -c
│       ├── --output-dir, -o
│       ├── --force, -f
│       ├── --port
│       ├── --model
│       └── --model-provider
├── add
│   └── client
│       ├── <clients>
│       └── --force, -f
├── set
│   └── env
│       ├── --port
│       ├── --model
│       ├── --model-provider
│       ├── --docker-registry
│       └── --repo
├── eval
│   ├── init
│   │   └── --force, -f
│   ├── run
│   ├── show
│   └── plot
│       ├── --folder, -f
│       └── --filter, -F
├── build
│   ├── --context, -C
│   ├── --docker-registry
│   ├── --repo
│   ├── --version
│   └── --no-cache
├── push
│   ├── --context, -C
│   ├── --docker-registry
│   ├── --repo
│   └── --version
└── version

Built-in help is available at every level:

bat --help
bat init agent --help
bat eval --help
bat build --help

Workflows

1. Create a new agent

bat init agent my_agent

# specific output directory
bat init agent my_agent --output-dir .

# pre-generate LLM clients
bat init agent my_agent --clients reformulator,planner,executor

# set the port/model/provider written to config.yaml
bat init agent my_agent --port 9900 --model gpt-4o-mini --model-provider openai

2. Add clients to an existing agent

Run from the agent root (must contain src/llm_clients/):

bat add client planner,executor

# overwrite existing files
bat add client planner,executor --force

3. Update agent settings

Run from the agent root (must contain config.yaml). The runtime values (--port, --model, --model-provider) are written into config.yaml (endpoint.port, model.name, model.provider); the Docker defaults (--docker-registry, --repo) are written into .env:

# endpoint.port / model.name / model.provider in config.yaml
bat set env --port 8080 --model gpt-4o-mini --model-provider openai

# Docker defaults for build/push, written to .env
bat set env --docker-registry hub.bubbleran.com --repo orama/labs/my-agent

4. Build and push a Docker image

# --version is used both as the image tag and as the VERSION build arg (default: latest)
bat build --context ./my_agent --docker-registry hub.bubbleran.com --repo orama/labs/my-agent --version latest

# no-cache build with a specific version
bat build --context ./my_agent --repo orama/labs/my-agent --version 1.0.0 --no-cache

bat push --context ./my_agent --docker-registry hub.bubbleran.com --repo orama/labs/my-agent --version latest

The image reference is always {registry}/{repo}:{version}.

If BAT_DOCKER_REGISTRY and BAT_DOCKER_REPO are already set in .env or the shell, --docker-registry and --repo can be omitted.

Precedence (both --docker-registry / --repo):

  1. CLI flag
  2. Shell environment variable (BAT_DOCKER_REGISTRY / BAT_DOCKER_REPO)
  3. .env file in the current directory
  4. Hardcoded default (default_registry / default-repository/<project-name>)

5. Run evaluation

Run all eval commands from an existing agent root (must contain agent.json, config.yaml, and pyproject.toml):

# scaffold evaluation files
bat eval init

# inspect the resolved configuration
bat eval show

# run evaluation
bat eval run

eval init creates:

  • eval/eval.yaml
  • eval/input/tasks.json
  • eval/output/

Minimal eval/eval.yaml:

evaluation:
  dataset: eval/input/tasks.json # default path if omitted
  output_dir: eval/output # default path if omitted
  agent_startup_timeout_s: 45
  agent_shutdown_timeout_s: 10
  k: 1
  qualitative: false # set true to enable LLM judge scoring

models:
  - provider: openai
    model: your-model-name
  - provider: ollama
    model: your-local-model
    base_url: http://localhost:11434

# required only when qualitative: true
judge:
  provider: ollama
  model: local-judge-model
  base_url: http://localhost:11434
  # api_key_env: BAT_JUDGE_API_KEY      # env var name holding the judge's API key

Notes:

  • bat eval run starts the agent via uv run . from the agent root and waits until the agent's config.yaml endpoint (endpoint.url:port) accepts a TCP connection, so the agent project must have its dependencies installed (its own .venv). The eval reads that endpoint from the agent's config.yaml; it is no longer configured in eval.yaml.
  • models entries may also be written as "<provider>:<model>" strings.
  • For models that require an API key, set it in the agent's .env under <PROVIDER>_API_KEY (e.g. OPENAI_API_KEY).

6. Plot evaluation metrics

bat eval plot reads the metrics.json files produced by eval run and renders charts. Point --folder at an evaluation output directory; each sub-folder containing a metrics.json is treated as one run.

# plot every run found under the output folder
bat eval plot --folder eval/output

# restrict the per-task charts to task ids containing a substring
bat eval plot --folder eval/output --filter smoke

Charts are saved back into the given folder. --filter only narrows the per-task charts; summary charts always cover all runs.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bat_cli-2026.6.25a1.tar.gz (58.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bat_cli-2026.6.25a1-py3-none-any.whl (58.8 kB view details)

Uploaded Python 3

File details

Details for the file bat_cli-2026.6.25a1.tar.gz.

File metadata

  • Download URL: bat_cli-2026.6.25a1.tar.gz
  • Upload date:
  • Size: 58.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for bat_cli-2026.6.25a1.tar.gz
Algorithm Hash digest
SHA256 c99e074160b58984b9917336d59401f8928ff8f2dafb710fb1209518f6ec7e27
MD5 092b7a7371c7e4ed8e0f5bff74f8fc9e
BLAKE2b-256 7855b547d6569a4fe547f0dd84948e28141ebcea4014eeddd4d44cb53102ca93

See more details on using hashes here.

File details

Details for the file bat_cli-2026.6.25a1-py3-none-any.whl.

File metadata

  • Download URL: bat_cli-2026.6.25a1-py3-none-any.whl
  • Upload date:
  • Size: 58.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for bat_cli-2026.6.25a1-py3-none-any.whl
Algorithm Hash digest
SHA256 e2d394715392397caab762c5c0e0358ecf8cf3f5af7e9a144c9d0b5e6ce476c4
MD5 95478100735734ae752c66e88d507aa0
BLAKE2b-256 ff23c3778ff006b94f3bf365de7c6d710f9415329558e9167955d415be65562f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page