Getting Started¶
Installation¶
microharness requires Python 3.11+ and has zero external runtime dependencies.
microharness registers the microharness CLI entrypoint (main:main) during installation.
Configuring Credentials (microharness auth)¶
Store provider API keys once in ~/.microharness/auth.json (written with 0600 file permissions) instead of duplicating secrets across config files:
# Store or update a provider key interactively (masked prompt)
uv run microharness auth login openrouter
# Pick from an interactive numbered list of known providers
uv run microharness auth login
# Inspect configured providers and effective credential sources (secrets masked)
uv run microharness auth list
# Remove a stored credential
uv run microharness auth logout openrouter
Pass --global-dir <dir> (or -d <project-dir>) to any microharness auth subcommand to target a custom directory.
Credentials resolve in this order:
- Explicit
--api-keyCLI flag or model-spec key - Provider environment variables (
env_keysinproviders.json, e.g.OPENROUTER_API_KEY,GEMINI_API_KEY,OPENAI_API_KEY,ANTHROPIC_API_KEY,AI_GATEWAY_API_KEY,DEEPSEEK_API_KEY,GROQ_API_KEY) ~/.microharness/auth.jsonproviders.jsonapi_key(literal orenv:VAR)- Fallback
MODEL_API_KEYenvironment variable - Top-level
config.json"api_key"
Built-in Provider Profiles¶
Built-in provider presets live in core/providers.json:
| Provider | Default Model | Env Key(s) |
|---|---|---|
google-ai-studio |
gemini-2.5-flash |
GEMINI_API_KEY, GOOGLE_API_KEY |
openrouter |
anthropic/claude-5.5-sonnet |
OPENROUTER_API_KEY |
vercel |
anthropic/claude-sonnet-5.5 |
AI_GATEWAY_API_KEY, VERCEL_AI_GATEWAY_API_KEY, VERCEL_OIDC_TOKEN |
openai |
gpt-4o |
OPENAI_API_KEY |
anthropic |
claude-5.5-sonnet |
ANTHROPIC_API_KEY |
bedrock |
us.openai.gpt-5.6-sol |
BEDROCK_API_KEY (or AWS SSO / SigV4) |
deepseek |
deepseek-chat |
DEEPSEEK_API_KEY |
groq |
llama-3.3-70b-versatile |
GROQ_API_KEY |
ollama, lmstudio, vllm, llamacpp, local |
Local endpoint defaults | None required |
Amazon Bedrock (Zero-Config AWS SSO)¶
bedrock targets Bedrock's OpenAI-compatible endpoint with pure-stdlib AWS SigV4 signing (core/auth_sigv4.py). On a machine with active AWS SSO (aws sso login), it works without extra packages or shelling out to the AWS CLI:
- Region resolution:
config.json"region"→AWS_REGION→AWS_DEFAULT_REGION→~/.aws/configprofile region (profile fromconfig.json"aws_profile"orAWS_PROFILE, defaultdefault). - API key override: Setting
BEDROCK_API_KEYuses bearer auth instead of SigV4 SSO. - Supported models: Only models whose Bedrock model card supports Chat Completions work on this endpoint.
Running Your First Session¶
Interactive TUI (Default)¶
By default, microharness operates directly on your current working directory (like Claude Code or Aider), respecting git and leaving zero artifacts in your project root:
# Launch full-screen TUI in the current directory
uv run microharness
# Target another project directory
uv run microharness -d /path/to/my-project "Fix the bug in auth.py"
# Resume the latest session (or a specific run ID)
uv run microharness --resume
uv run microharness --resume run-2026-10-03-xxxx
Batch Mode & Sandboxing¶
# One-shot batch execution (exits immediately after task completion)
uv run microharness "Run pytest and fix any failures" --batch
# Disposable sandbox copy inside ~/.microharness/runs/
uv run microharness --sandbox "Experiment with writing a new scraper"
# Full Docker container isolation (OrbStack or Docker Desktop)
uv run microharness --docker --docker-image python:3.11 "Run pytest and fix bugs"
Built-in Demos¶
If no model credentials are configured, built-in demos run cleanly using MockModel inside a sandbox:
CLI Reference¶
| Flag | Purpose |
|---|---|
instruction |
Optional initial prompt / task for the agent |
-d, --dir DIR |
Target project workspace (default: .) |
--sandbox |
Run in an isolated disposable copy under runs directory |
--global-dir DIR |
Global configuration directory (default: ~/.microharness) |
--runs-dir DIR |
Run logs, traces, and artifacts directory (default: ~/.microharness/runs) |
--preset, --agent NAME_OR_PATH |
Load a named agent preset or preset folder path |
--list-presets, --list-agents |
List discovered presets and exit |
--batch |
Run one task and exit without entering interactive chat |
--acp |
Run the Agent Client Protocol (ACP) JSON-RPC 2.0 server over stdio (also microharness acp) |
--resume [RUN_ID] |
Resume the most recent session or a specific run ID |
--max-steps N |
Cap the maximum steps per task |
--timeout SEC |
Task wall-clock timeout in seconds |
--bash-timeout SEC |
Per-command timeout for bash (default: 300.0s) |
--provider, --endpoint, --model, --api-key |
Override provider profile, URL, model ID, or API key |
--cache-ttl {5m,1h,off} |
Prompt cache TTL mode |
--reasoning LEVEL |
Reasoning effort (low, medium, high, xhigh, max, token budget, or off) |
--permission-mode {auto,ask,read-only} |
Host execution permission mode |
--docker, --docker-image, --docker-network |
Docker container sandboxing and network mode (none blocks network) |
--docker-memory, --docker-cpus, --docker-pids-limit |
Container resource limits |
--no-network-tools |
Disable outbound network tool plugins and HTTP/SSE MCP servers |
--no-tool-docs |
Omit redundant prose tool snippets when native schemas are sent |
--inspection-tools |
Also expose read-only grep, glob, and git_read to the main agent |
--trust-project-tools |
Allow project-scoped .microharness/tools/*.py, plugins/, mcp_servers, and command hooks |
--stream, --no-stream |
Enable or disable live SSE token streaming (default from config) |
--code-mode |
Enable standalone Python code_mode for batching local and plugin tools |
--no-mcp, --mcp-mode {progressive,direct,code_mode} |
Disable MCP or choose MCP/Code Mode exposure |
--background-shell, --no-background-shell |
Enable or disable background shell process tools (bg_start, bg_status, bg_write, bg_kill) |
--benchmark {mini-swe,calculator,all,deepswe-mini} |
Run a benchmark suite (--task filters by comma-separated ID or !exclude) |
--demo {calculator,greeting} |
Run a built-in educational demo |