Skip to content

Performance tuning

abt-core is engineered for a fast "hot path": the CLI is lazy-loaded, the manifest is cached, and a precompiled manifest can bypass compile entirely.

Lazy CLI (cold start)

Subcommands register through a LazyClickGroup — running abt --help (or any unrelated subcommand's --help) loads only that subcommand's module. Importing the top-level abt package does not pull any runtime dependency (LangChain, LangGraph, DeepAgents): these are resolved lazily via PEP 562 __getattr__ when you touch abt.AgentBuildTool or abt.run_agent.

Measured on a laptop: abt --help ≈ 150 ms and abt deps --help ≈ 170 ms (no compile stack loaded). Commands that import the compile stack — abt docs, abt compile, abt run, and the rest of the compile-capable set — take ≈ 1.5–2 s to start, even for --help.

Partial parse cache (partial_parse.msgpack)

Every compile writes <workspace>/target/partial_parse.msgpack keyed by a fingerprint of:

  • the abt-core version
  • the path and SHA-256 content of every file under the compile-relevant project dirs resolved from your abt.yaml paths: block: agents/, prompts/, sources/, exposures/, retrievers/, transformers/, triggers/, mcps/, tests/, contracts/, few_shots/, tools/, providers/, handlers/, macros/, skills/ (all configured dirs, defaulting to .abt/skills)
  • the top-level config files (by content, so any edit to abt.yaml forces a recompile) abt.yaml/abt.yml, profiles.yaml/profiles.yml, abt_packages.yml/abt_packages.yaml, the loom registry abt_loom.yaml (searched for from the project root upward), and every workflow file under workflows/
  • the active profile identity when one is set (type, model_id, region, temperature, max_tokens) — switching --target busts the cache so a prod compile cannot serve a dev manifest
  • the CLI template --vars, --live, --lazy, compile selector, optional prompt stem, and the enrich_for_docs flag

The cache is a single slot per workspace. Overlapping runs with different inputs (abt watch dispatches with different vars:) take turns overwriting it, so each such run may recompile; the stored data carries a digest, and a pair written by two different runs is treated as a miss rather than served.

On the next compile, if the fingerprint matches the reporter prints:

  Manifest cache hit (partial_parse, fp=<prefix>…).

…and the manifest is loaded directly from msgpack. A miss prints:

  Manifest cache miss — compiling.

Flags:

  • --no-partial-parse — skip the cache (always recompute). Use in CI smoke tests or when comparing compile timings.

The cache lives under target/ and is removed by abt clean.

The digest guards against torn writes, not forgery, because whoever writes the pair computes it. abt therefore ignores the cache and recompiles from source when partial_parse.* is not a regular file owned by the current user, can be written by group or others, sits in a target/ that is not owned by the current user or that group or others can write, or is tracked by git (for example a committed target/; one tracked file of the pair is enough). The reporter only shows a cache miss; the info log records cache not trusted: <reason>. A cache written by an earlier abt with mode 0644 is rewritten 0600 by the next compile. Windows has no owners or modes, so only the git check applies there. The git check is best effort: it is skipped when git is not installed or the cache is outside a repository, and it ignores the host's GIT_DIR and GIT_INDEX_FILE. When git fails for another reason, such as refusing a repository owned by another user (safe.directory), abt cannot verify the cache and recompiles every time; an operator whose checkout is owned by another user fixes that with git config --global --add safe.directory <project root>. The answer is remembered while the cache files stay the same (inode, mtime, size).

Live compile

Every compile validates the project files in scope and fails on an invalid agent, workflow, tool, skill or abt.yaml; a full compile also validates test files, which a selective compile (-s) can leave unchecked. None of that needs the network. abt compile, abt run, abt dispatch, abt test, abt doctor, abt discover and abt docs generate also accept --live, which starts MCP servers and makes failed fetches fatal:

Default --live
MCP servers Not started. An unset env_var() in mcps/*.json only warns. Started to list their tools. An unset env_var(), an unreachable server, or a spec naming a tool the server lacks fails the compile.
External context (confluence, github, s3) Fetched. A failed fetch warns and the context is empty. A failed fetch fails the compile.
Remote skills A failed fetch warns and the agent keeps its other skills. A failed fetch fails the compile.
manifest.json test_suites is empty. Includes test_suites.

For CI and deploy-time validation use abt compile --live --no-partial-parse: a cache hit loads the stored manifest and skips MCP discovery and external-context fetches. The default suits the inner loop, where an unreachable MCP server or a failed fetch should not block you.

Progress flags (--quiet, --no-progress)

All compile/bootstrap-capable commands emit short progress lines on stderr via the shared CliReporter:

  Manifest cache hit (partial_parse, fp=…).
  Manifest ready (32 agents).
  • --quiet silences those lines; only final command output remains.
  • --no-progress keeps stdout output but disables the reporter step lines.
  • --debug / --no-debug replaces the reporter entirely with Python-logging output at DEBUG (default follows flags.debug / ABT_DEBUG when omitted).

Manifest-only run (--manifest PATH)

abt run and abt dispatch accept --manifest <path> to skip discovery and compile and load a precompiled manifest directly. The manifest is the source of truth for agents, workflows and the compiled config:

# One-time: write manifest
abt compile --project-root .

# Later runs: no agent discovery, no YAML parsing, no context scan
abt run --manifest target/manifest.json -s assistant -p "hello"
abt dispatch --manifest target/manifest.json -s my_workflow

This skips discovery, parsing, and the context scan, so the saving grows with project size; on a two-agent project process start-up dominates and the difference is within noise (about 1.7 s either way).

Unlike dbt, the run still needs the project checkout. Tools are Python modules imported from the project's tools/ directory (and installed packages) when the run starts, and skills, context and profiles.yaml are read from the project as well. Run --manifest from the project root, or pass --project-root; outside a project it exits 2 with E_NO_PROJECT.

See Advanced: manifest and compile for the schema and fields.

Concurrency budget (--threads N)

abt --threads N <subcommand> sets a single global cap on parallelism shared by the independent subsystems that would otherwise each pick their own fan-out:

Subsystem Fine-grained knob Budget role
MCP tool discovery config.mcp_source_max_concurrency (abt.yaml) Hard upper bound
Workflow executor frontier batches ABT_SEQUENTIAL_MAX_CONCURRENCY Hard upper bound + fallback
abt test case parallelism ABT_TEST_MAX_CONCURRENCY Hard upper bound + fallback
abt bench runs (all benchmarks, one side at a time) ABT_BENCH_MAX_CONCURRENCY Hard upper bound + fallback
abt doctor --deep LLM fan-out config.doctor.deep_max_concurrency Hard upper bound

Defaults: 4 threads, matching dbt's threads default. Place the flag before the subcommand:

abt --threads 8 run -s my_agent -p "your input"
ABT_THREADS=8 abt run -s my_agent   # equivalent via env

Precedence (highest wins, then clamped to the global budget):

  1. Subsystem env / config — when explicitly set, then capped by ABT_THREADS.
  2. ABT_THREADS / --threads — fallback when subsystem knob is missing or exceeds budget.
  3. Default of 4.

Secrets redaction

All user-visible text surfaces converge on one redaction pass:

  • Key-based masking replaces values under keys matching password, secret, credential, apikey, api_key, authorization, or *_token suffix. Token counts (input_tokens, output_tokens) are preserved.
  • Text scanning catches provider-prefixed API keys (ghp_…, xoxb-…, xapp-…, sk-ant-…, sk-…, AKIA…, Databricks dapi…, Google AIza…, hf_…, npm_…, Atlassian ATATT3x… and ATBB…), Slack webhook URLs, JWTs, Authorization: Bearer/Basic … headers, including a header pair or a value on the next line (Basic only counts after Authorization), AWS session tokens (X-Amz-Security-Token) and SigV4 signatures, and PEM private-key blocks.
  • Assignments are masked by name: NAME=value or NAME: value (also quoted, as in JSON) where NAME ends in token, authtoken, secret, password, api_key, app_key, access_key, secret_key, account_key or similar, in snake_case or camelCase (accessToken, JIRA_API_TOKEN=…, DD_API_KEY=…, x-api-key: …, AWS_SECRET_ACCESS_KEY=…, AccountKey=…). The value is masked only when it is at least 8 characters and either carries a digit or is at least 20 characters long, so max_tokens=4096, token_usage: … and Missing token: SLACK_BOT_TOKEN stay readable.
  • URL credentials (any provider) are masked by name, not by prefix: query parameters such as key, api_key, access_token, client_secret, sig and *signature, and the password in scheme://user:password@host. httpx logs every request URL at INFO, so a tool that puts a key in the query string would otherwise write it to the console and abt.log. The parameter name is kept (?key=***); other parameters (cache_key, q, page) are left alone.

Redaction masks credential-shaped strings. A quoted value ("password": "two words here") is masked up to its closing quote; an unquoted one stops at the first space. It does not remove prompts, model output or personal data, and MCP responses offloaded to mcp_outputs/ are written as received: see What abt writes to disk.

Surfaces covered: Rich CLI output, error text returned over HTTP (abt docs serve event streams and the agent invoke API's run error field), console and file logs (including exception tracebacks and JSON log fields), JSON artifacts, structured DEBUG events, and replay traces.