Skip to main content

haru-cli

A secure, scriptable command line interface for interacting with Amazon Bedrock Claude models through governed, observable, multi-agent workflows. haru-cli is a thin, functional orchestration layer over the AWS Strands Agents SDK, talking to Bedrock through the Converse API with streaming, tool use, MCP client support, multi-agent orchestration, session persistence, OpenTelemetry observability, and Bedrock Guardrails.

Requirements

  • Python 3.13+ (tested on 3.13 and 3.14)
  • uv
  • AWS access via IAM Identity Center (SSO)

Install

pipx install haru-cli

Or from a clone:

uv sync

Commands

Command Purpose
haru doctor Diagnose config, sign-in, and Bedrock permissions
haru doctor --all-roles Find which account+role can actually reach Bedrock
haru config init Create a starter configuration (interactive)
haru config show Show the resolved configuration (no secrets)
haru login Browser sign-in to IAM Identity Center (OAuth 2.0 + PKCE)
haru chat Interactive streaming chat REPL
haru chat --session-id <id> Persist and restore the conversation under a session id
haru chat --agent <name> Chat with a specific configured agent
haru run "<prompt>" One-shot prompt; prints the answer and exits
haru agents List configured agents (model, prompt, tools, MCP)
haru session list List stored session ids
haru --version Print the installed version

Configuration is resolved from --config, then $HARU_CONFIG, then ./config/haru.yaml, then ~/.config/haru/haru.yaml. haru --debug <command> turns on verbose logging, including the AWS API operations and error codes behind a failure (never request bodies or credentials).

Inside haru chat, slash commands switch targets mid-session:

REPL command Purpose
/help Show REPL commands
/model List configured models (default and active marked)
/model <name> Switch the default agent to that model (resets the chat)
/agent List configured agents
/agent <name> Switch to that agent (resets the chat)

Quickstart

haru config init      # writes ~/.config/haru (asks for your SSO start URL)
haru login            # browser sign-in; account and role discovered for you
haru run "Summarise the Converse API in two sentences."
haru chat --agent supervisor --session-id demo

haru login is browser-only: after Identity Center sign-in, your accessible AWS accounts and permission-set roles are discovered automatically (like aws configure sso), auto-selected when there is exactly one, prompted otherwise, and remembered for later sessions. Pin auth.sso.account_id / role_name in configuration only if you want to skip the discovery — pins are validated against your actual assignments, and a stale pin falls back to the chooser with a warning rather than failing later.

A pin that sign-in proves is not assigned to you stops being applied by later commands too, so the fallback actually sticks; haru names the offending line and never edits your configuration. Editing or removing the pin gives it a fresh chance on the next login. Full precedence per field: the config pin (account_id, then account_id_env, then role_name) unless the last sign-in disproved that exact value, then the identity chosen at login.

The consent screen you see in the browser ("Allow haru-cli to access your data?") is rendered by AWS IAM Identity Center, and its wording reflects the scopes the client requests. haru requests only sso:account:access, so AWS describes exactly that: the ability to assume roles you have been assigned. Once you approve, haru serves a local result page confirming the outcome.

Authentication uses the same PKCE authorization-code flow as aws sso login, caching tokens in the botocore-compatible schema under ~/.aws/sso/cache (0600) so standard AWS tooling can consume and refresh the same cache. Access tokens are refreshed automatically; when a fresh login is needed, commands say so plainly.

Sampling controls

haru-cli exposes temperature, top_p, top_k, and seed on three configuration surfaces — a capability Kiro CLI does not offer on any of its configuration surfaces (its v2/v3 agent formats and cli.json define no sampling fields):

Surface Where Example
Model catalogue models.yaml, per model entry temperature: 0.2, top_k: 50
Agent profile agents.yaml, per agent sampling: block sampling: {temperature: 0.1}
CLI / REPL --temperature/--top-p/--top-k/--seed flags on run and chat; /sampling in the REPL haru run "..." --top-k 20

Precedence: CLI/REPL override → agent sampling: block → model entry, merged per-field. Unset fields are omitted from requests entirely, keeping the provider's defaults. In the chat REPL, /sampling shows the model default, session override, and effective value for each field; /sampling temperature=0.2 top_k=50 applies overrides and /sampling reset clears them.

Model compatibility (AWS-side behaviour, not a haru limitation):

  • Claude 5-series and Opus 4.7+ (Sonnet 5, Opus 5, Opus 4.8) reject non-default temperature/top_p/top_k with an HTTP 400 — leave them unset on those entries (the shipped config does).
  • Claude Haiku 4.5, Sonnet 4.5, and older Claude models, plus non-Anthropic Bedrock models, accept them.
  • seed is forwarded via Converse additionalModelRequestFields for Bedrock models that support it; no Claude model accepts a seed today, so do not expect determinism from Claude — the field exists for models that honour it.

Configuration

Declarative YAML under config/ — models, agents, orchestration (supervisor/swarm/graph), MCP servers, guardrails, sessions, sampling, logging, and OpenTelemetry. No secrets in YAML: values reference environment variables with ${env:VAR}. See docs/configuration.md.

Troubleshooting

If haru login succeeds but haru chat fails, the role you signed in with almost certainly lacks Bedrock permissions. Signing in and being allowed to call Bedrock are separate things: haru assumes a role in your AWS account and calls Bedrock there, so that role needs bedrock:InvokeModel and bedrock:InvokeModelWithResponseStream.

Kiro and Amazon Q working is not evidence that haru will — they send your SSO token to the managed Amazon Q service and never call Bedrock in your account, so there is no Kiro role to copy.

haru doctor              # what is configured, signed in, and permitted
haru doctor --all-roles  # which of your assigned roles can reach Bedrock
haru doctor --invoke     # definitive check (makes one billable call)

See docs/troubleshooting.md for the IAM policy to hand your AWS administrator.

Development

All quality gates must pass before a change is considered done:

uv run ruff check
uv run ruff format
uv run mypy src
uv run pytest

Coverage is gated at 90% (--cov-fail-under=90). CI runs the full gate set on Python 3.13 and 3.14; releases are built with uv build and published to PyPI via Trusted Publishing on v* tags.

Install the pre-commit hooks once per clone:

uv tool run pre-commit install

Project layout

  • src/haru/ — the package (auth, config, models, agents, tools, steering, sessions, observability, commands)
  • config/ — declarative YAML configuration and steering prompts
  • tests/unit, tests/integration — pytest suites (coverage gate: 90%)
  • .kiro/steering/ — authoritative engineering steering documents

License

Apache-2.0. See LICENSE.

Release files for haru-cli 0.1.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for haru-cli 0.1.7
File Size Uploaded
haru_cli-0.1.7.tar.gz 226.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for haru-cli 0.1.7
File Interpreter ABI Platform
haru_cli-0.1.7-py3-none-any.whl Python 3 none any Details

Total release size: 300.5 kB

Release files / haru_cli-0.1.7.tar.gz

Download URL haru_cli-0.1.7.tar.gz
Size 226.3 kB
Tags Source
SHA-256 checksum
How to use checksums
b7e0bd0604bd18c188c72b89464cb88c12f76e8bbadeed0c75ccf0f34d84fc26
BLAKE2b-256 checksum
How to use checksums
23bb5c20020074ec06e0a85630853f8f7143100bef599d7b3bf97f268cb9b607
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 26, 2026.

Transparency log

Release files / haru_cli-0.1.7-py3-none-any.whl

Download URL haru_cli-0.1.7-py3-none-any.whl
Size 74.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cd2de7f9895a785e32668d2a2f7b989416c94d62791eedd4989a4821212d22cc
BLAKE2b-256 checksum
How to use checksums
a6a8bfeb610ea161ea74836718dcbd0fea90599a6faadd0b75335ed9f26bae08
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 26, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.7 This release

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page