This article follows the official documentation. We haven’t tested this tool for a hands-on review.
A coding agent can inspect files in Backblaze B2 Cloud Storage by running b2, Backblaze’s command-line tool, from a shell. B2 stores files in buckets, cloud containers for files such as backups and build artifacts. The CLI can list buckets and files, transfer data, manage keys, and sync local directories with buckets.
The CLI runs in a shell, so an agent with shell access can check which backup files exist before changing a deployment script. The examples distinguish local setup from requests to Backblaze; listing files leaves them unchanged. The official CLI documentation covers installation and command behavior.
Install and authorize the CLI
Backblaze documents several installation methods. With Python 3.7 or later, install the CLI with pip:
python3 -m pip install --upgrade b2
The installation instructions also describe other options, including Homebrew and a self-contained download. Installing the CLI changes your local environment but does not connect it to a B2 account.
To access B2, authorize the CLI with an application key. An application key is a credential that you can restrict to specific actions. The CLI supports b2 account authorize with an application key ID and application key. Keep both values in a credential manager or protected shell configuration; do not place them in an agent prompt or repository.
b2 account authorize <application-key-id> <application-key>
Replace the angle-bracketed placeholders with credentials supplied outside the prompt. During authorization, the CLI makes a network request and saves authentication information locally in a SQLite file. By default, the CLI uses ~/.b2_account_info; set B2_ACCOUNT_INFO to choose a different file.
If the agent will list a bucket by name, the application key needs the listBuckets capability so the CLI can look up the bucket’s ID, its identifier in B2. Restrict the key to the bucket and capabilities the task requires. The CLI documentation describes this requirement and authentication behavior.
List a bucket without changing it
A coding agent can inventory a bucket before editing code that refers to stored assets. First, list accessible buckets:
b2 ls
Then list files in the bucket, replacing the placeholder with its actual name:
b2 ls <bucket-name>
These commands contact B2 and request listing information. They do not download, upload, or delete files. The CLI prints the listing in the terminal. To request JSON output for a programmatic consumer, use the documented format option:
b2 --format json ls <bucket-name>
The JSON output lets an agent or a script parse the listing without scraping human-readable text. Check the installed CLI’s help if its version does not accept that option in this position.
Agent prompt: “Use b2 ls to inspect the files in <bucket-name>. Report the file names relevant to the backup configuration. Do not download, upload, or remove anything.” The bucket name is a placeholder, and the agent should receive access only after an operator has authorized the CLI.
Keep transfers and removals separate
The b2 sync command transfers files between a local directory and a B2 bucket. Backblaze documents --exclude-regex and --keep-days in its sync command reference. The reference also documents --threads. The CLI uploads local files or downloads bucket files based on which location you give as the source and which as the destination.
Treat a sync that includes --delete as a separate, destructive request. That option removes destination files that are absent from the source. The documentation for a Claude storage skill describes dry-run guardrails for deletion, but that does not establish a general dry-run option for the CLI itself. Do not assume a preview is available; check the CLI’s current command help before planning a deletion.
The CLI also includes commands for buckets, files, keys, and replication. Backblaze documents that b2 ls can time out when a directory contains several million hidden files. For large listings, avoid making a broad listing the agent’s only way to verify a result.