Harness configuration

A harness is configured in three places: the builder in your code, the project file .adk/harness.toml, and Cargo features. The CLI adds flags and a user config on top; see The harness in your terminal.

The builder

HarnessAgent::builder(name) returns a HarnessAgentBuilder. model and workspace are required; everything else has a default.

Core

MethodDefaultEffect
model(llm)requiredThe model
workspace(Workspace)requiredThe directory file tools are confined to; bash is offered when the workspace allows it (Workspace::allow_bash(true))
description(text)noneThe agent description
base_prompt(text)HARNESS_SYSTEM_PROMPTReplaces the base prompt
instruction(text)noneOperator text after the base prompt, not template-expanded
project_instructions(InstructionsConfig)AGENTS.md from the git root down, ~/.adk/AGENTS.md, trust requiredWhich instruction files load
workspace_trust(store)in memoryWhere workspace trust decisions are kept
max_iterations(n)100Most model turns per run
tool_timeout(duration)300 sTimeout of one tool call
history_max_events(n)allMost recent events loaded per run
compaction(config) / without_compaction()interval 10, overlap 4Event compaction for the harness's runner
intra_compaction(config) / without_intra_compaction()on, at 80% of the model's windowAuto-compaction before each model call; see Context Compaction
tool(tool) / toolset(toolset)noneExtra tools, governed as External
customize_llm(f)noneThe escape hatch to the underlying LlmAgentBuilder; its rustdoc states what it can bypass

Modes and approvals

MethodDefaultEffect
mode(HarnessMode)AskThe mode of sessions with no mode record
mode_store(store)in memoryWhere session modes are kept: file, SQLite, PostgreSQL or Redis stores
standing_rules(store)in memoryWhere standing rules are kept: file, SQLite, PostgreSQL or Redis stores
operator_policy(policy)noneAn operator ToolPolicy; the stricter decision wins
prompter(prompter)noneAsks a person on interactive surfaces
confirmation_handler(handler)the prompting handlerReplaces the confirmation handler
approval_store(store)in memoryWhere held calls and decisions are kept
approval_service(service)noneThe approval inbox held calls are submitted to
auto_review(reviewer)offIn auto, a ToolReviewer such as ModelApprover decides the calls the mode holds before a person; see Auto review
confirmation_timeout(duration)300 sHow long a person may take; a call nobody decides in time waits in the approval store
trust_mcp_read_only_hints(bool)falseTrusts an MCP server's readOnlyHint for external tools
require_authenticated_identity()offStanding rules and auto apply only to authenticated users (served harnesses)
config(HarnessConfig)noneApplies .adk/harness.toml; see below

See Modes and approvals.

Shell

MethodDefaultEffect
shell(ShellIsolation)HostWhere bash runs: the host, or OsSandbox(..) with feature sandbox
fail_if_unavailable()offRefuses to build, and each call, when the requested sandbox is unavailable
auto_allow_sandboxed()offRuns sandboxed commands without approval in ask, where the sandbox keeps protected paths read-only
allow_unsandboxed_retry(bool)trueOffers a non-waivable unsandboxed retry of a failed sandboxed command
allow_host_shell_in_auto()offRuns host commands without approval in auto
shell_ledger(ledger)in memoryWhere the shell ledger is kept
action_ledger(ledger)in memoryWhere non-idempotent calls are recorded before they run
without_shell()offLeaves bash out

See Shell and sandbox and Durability.

Work tools

MethodDefaultEffect
without_todos()offLeaves write_todos and update_todo out
skills(SkillsConfig)progressive, from .skills/, .claude/skills/, .adk/skills/, ~/.adk/skills/Skills (feature skills)
member(MemberSpec)explore and generalAdds a team member (feature team)
without_default_members()offLeaves out explore and general
member_registry(registry), team_policy(policy), member_model(llm)noneDiscovery, the team's budget and termination, and the members' model
plan_graph(bool)true with feature graphCompiles approved plans with steps into a checkpointed graph
plan_checkpointer(checkpointer)in memory: plans do not survive a restartWhere plan graphs and the Graph goal engine are checkpointed
snapshots(SnapshotConfig), snapshot_store(store), snapshot_objects(objects)off; in memory; in memorySnapshots before each turn and plan step, and Harness::rewind (spec 3.1 §7.27); see Snapshots and rewind
plan_checkpoint_store(url).await?—plan_checkpointer over the store a URL names: sqlite://, postgres://, redis://, mongodb://, neo4j://, firestore:// (spec 3.1 §13 Q5)
goal_store(store), goal_engine(GoalEngine)in memory; Loop, or Graph with a plan checkpointerWhere goals are kept and how they iterate
memory(MemoryConfig)offWorking notes (feature memory)
long_term_memory(config), fact_store(store), fact_index(index), memory_embedder(embedder)off; in memory; a local lexical index; noneLong-term facts with provenance (feature memory); each stored vector carries the embedder's id (Embedder ids)
effort(EffortPolicy)plan high, members low, else mediumThe reasoning effort per mode and role (spec 3.1 §7.23): each request carries its mode's level (a member's members, the distiller's distiller, MCP sampling's sampling) as GenerateContentConfig::effort; HarnessAgent::effort reads it
cache_capable(model) / without_context_caching()none; onA Gemini model the runner caches explicitly with ContextCacheConfig::default() (spec 3.1 §7.23)

See Team, Plans and goals and Memory.

Web

MethodDefaultEffect
web(WebConfig)offweb_fetch under the allowlist and caps, and web search under search_domains, a separate filter (feature web; spec 3.1 §7.32)
search_provider(provider)noneThe governed web_search over provider (SearxngSearch, DeepSeekSearch or your own); replaces the model provider's built-in search
provider_web_tools(ProviderWebTools)ProviderWebTools::provider_default() with web, else noneThe provider-executed built-ins: by default the search of the provider the model's client serves (Llm::native_web_search); ProviderWebTools::off() declares none

HarnessInfo::web_search reports which path search takes. See Web access and MCP.

Budget, identity and observability

MethodDefaultEffect
budget(RunBudget)noneResource limits for every run
spend_ledger(ledger)noneThe ledger model calls reserve budget against
audit_log(log)an ephemeral signed log with feature authWhere audit records go; the runner's own log takes precedence
loop_guard(LoopGuard)offTightens a looping session to read_only and ends the turn (feature observe)
rbac(RbacMap)noneA permission per tool class (feature auth)
credentials(broker), shell_credential(resource)nonePer-call shell credentials (feature auth)

See Identity and Observability.

The project file

.adk/harness.toml in the workspace is read by HarnessConfig::discover(dir) and applied with HarnessAgentBuilder::config (spec 3.1 §8.3). The file sits in the workspace the agent works in, so it may only tighten (spec 3.1 §9.2 I3):

KeyApplied
modeWhen it is stricter than the mode set on the builder so far; an unknown mode reads as read_only
sandbox = trueRuns bash in the OS sandbox
fail_if_unavailable = trueRefuses to build without the sandbox
[deploy]Not by the harness: deployment tooling reads it
[ultracode]Not by the harness: adk-rust ultracode reads it, tighten-only — see below
[compaction]Not by the harness: the CLI reads it — see below; in code, use intra_compaction
yes, allow_unsandboxed, auto_review, trust, packs, membersNever: they would loosen what the agent may do. Set them in code

Ignored keys and a looser mode are logged as warnings and listed in HarnessConfig::notes. A missing file is the default configuration.

use std::sync::Arc;

use adk_rust::harness::{HarnessAgent, HarnessConfig, HarnessMode, InstructionsConfig};
use adk_rust::model::{ScriptedLlm, ScriptedResponse};

fn main() -> anyhow::Result<()> {
    let dir = std::env::temp_dir().join(format!("harness-config-{}", std::process::id()));
    std::fs::create_dir_all(dir.join(".adk"))?;
    std::fs::write(dir.join(".adk/harness.toml"), "mode = \"plan\"\nyes = true\n")?;

    let config = HarnessConfig::discover(&dir)?;
    assert_eq!(config.notes.len(), 1); // `yes` is ignored
    let harness = HarnessAgent::builder("harness")
        .model(Arc::new(ScriptedLlm::new("scripted", vec![ScriptedResponse::text("done")])))
        .workspace(adk_devtools::Workspace::new(&dir))
        .project_instructions(InstructionsConfig { user_file: None, ..InstructionsConfig::default() })
        .config(config)
        .build()?;
    assert_eq!(harness.info().default_mode, HarnessMode::Plan);
    Ok(())
}

The CLI reads the same file with the same rule, plus <config dir>/adk-rust/harness.toml for settings only you may make; see Configuration files.

[compaction]

A run compacts the agent's history before a model call once the request nears the model's context window. The CLI reads a [compaction] table that changes when: the user config first, then .adk/harness.toml, which may set it too, since it changes what the model is sent rather than what the agent may do.

KeyDefaultEffect
autotruefalse turns auto-compaction off
threshold_tokensnoneA fixed threshold in estimated tokens, in place of the window fraction
window_fraction0.8The share of the model's context window a request may reach
keep_recent10The most recent history entries kept as they are, within half the threshold
[compaction]
window_fraction = 0.6
keep_recent = 6

[ultracode]

adk-rust ultracode (Ultracode) reads its limits from an [ultracode] table: the defaults, then the user config, then .adk/harness.toml, then the flags, which win (spec 3.1 §7.10).

KeyDefaultCeilingIn .adk/harness.toml
architectureauto—graph only
routermodel—heuristic only
max_rounds25Lower only; floor 1
max_reviewers46Lower only; floor 3
max_board_rounds23Lower only; floor 1
implement_model_calls100500Lower only
reviewer_model_calls2050Lower only
board_model_calls48150Lower only
max_model_calls4002,000Lower only
sensitive_paths[]—Append only; adds the security seat, never the board
[ultracode]
architecture = "graph"          # a workspace may pin the parallel graph, never the board
router = "heuristic"            # a workspace may turn the router's model call off
max_rounds = 1
max_model_calls = 200
sensitive_paths = ["migrations/*", "src/billing/*"]

A workspace value that would loosen a limit, or choose blackboard or auto over your setting, is ignored with a note, and a value below a floor is raised to it. A change that matches the workspace's sensitive_paths gets the security seat; only your user config's sensitive_paths route it to a board, since a workspace may not choose the architecture. Build and dependency directories (target, node_modules, dist, build, …) are not in the change snapshot unless a glob names them from the workspace root (dist/**); a glob such as **/dist/** gets a note saying so. In the user config a value beyond a ceiling or floor is clamped, with a note. A flag beyond a ceiling is an error that names the ceiling.

UltracodeLimits::resolve (adk_cli::harness::ultracode) applies the same rules for a program of your own.

Features

On the umbrella crate:

FeatureEffect
harnessadk_rust::harness (everything adk-harness exports) and HarnessAgent, HarnessAgentBuilder, HarnessMode in the prelude; turns on agents, tools, skills, sandbox, runner, sessions and graph. In full
harness with cliadk_rust::harness also re-exports HarnessLauncher, ConsolePrompter and ConsoleIo from adk-cli
harness-paymentsThe payments pack: HarnessAgentBuilder::pack_payments; see Payments
harness-browser, harness-computer-useThe browser and computer-use packs: HarnessAgentBuilder::pack_browser, pack_computer_use; see Browser and computer use
harness-voice, harness-managedThe voice pack, which the builder refuses with not yet implemented until it lands, and the managed form
harness-encrypted, harness-memory-localThe encrypted store and the local ONNX embedder (spec 3.1 §7.12, §7.15.2)
mistralrs, cli-mistralrsadk_rust::mistralrs, the adk-mistralrs re-export, and adk-rust --provider mistralrs; a heavy build, in no tier
[dependencies]
adk-rust = { version = "3.0.0", features = ["harness", "cli"] }

On adk-harness:

FeatureDefaultAdds
runneronHarness, which owns a Runner
skillsonProgressive skill disclosure
teamonTeam members
graphonThe plan graph and the Graph goal engine
sandboxonThe OS sandbox for bash
observeonSpans, spend and the loop guard
authonRBAC, credentials and the signed audit log
memoryonWorking notes and long-term facts
memory-embeddingsoffOpenAI and Gemini embedders for the fact index
memory-embeddings-localoffRagEmbedder::local(): an in-process ONNX embedder (BAAI/bge-small-en-v1.5); ort downloads the onnxruntime binary at build time
encryptedoffThe store envelope: StoreKeyring, StoreKeySource, sealed sessions, approvals and SQLite stores, key rotation (spec 3.1 §7.12)
sqliteoffSQLite mode, rule, shell-ledger and goal stores, and sqlite:// plan checkpoints
postgres, redisoffMode and standing-rule stores replicas share, postgres:// and redis:// plan checkpoints, and adk-session's stores on the same backend (spec 3.1 §13 Q2)
mongodb, neo4j, firestoreoffmongodb://, neo4j:// and firestore:// plan checkpoints
ambientoffGoals started by cron, file-watch and webhook triggers
team-acp, team-a2aoffACP-compatible coding agents and remote A2A agents as members
acp-serveroffThe harness served to editors over ACP: "Always allow" and "Always deny" become standing rules (ACP server)
dockeroffThe container shell, ShellIsolation::Container (see Shell and sandbox)
skills-registry, memory-graphoffRegistry skills, graph memory

The harness template

cargo adk new my-harness --template harness scaffolds a project around the harness (spec 3.1 §8.3), on Gemini by default or with --provider openai or --provider anthropic:

FilePurpose
src/main.rsBuilds the harness over SQLite in .adk/state.db — sessions, the approval service and its store, the action ledger, standing rules, and the kernel's stores through HarnessLauncher::with_kernel_stores — with ConsolePrompter and .config(HarnessConfig::discover(".")?), and runs it with HarnessLauncher
.adk/harness.tomlThe project file, with a [deploy] table
AGENTS.mdProject instructions, loaded once you trust the workspace
.skills/example/SKILL.mdAn example skill, valid for adk-rust skills validate
tests/harness_smoke.rsA scripted test that plan mode refuses a write; no API key
README.md, .gitignoreUsage, and .adk/state.db* kept out of git
cargo adk new my-harness --template harness
cd my-harness
cp .env.example .env     # add GOOGLE_API_KEY
cargo test               # the scripted smoke test
cargo run                # the REPL, ask mode, approvals in the terminal
cargo run -- serve       # the harness on 127.0.0.1:8080
cargo run -- up          # the agent kernel, its state in .adk/state.db
cargo run -- goal "make the tests pass" --until "cargo test"

serve and up take --port (default 8080) and --host, not adk-rust up's --bind. The project depends on adk-rust with autonomy and cli. For an agent that runs unattended from the start — auto mode, the OS sandbox, a budget, a spend cap, a signed audit log and a cron trigger — scaffold --template autonomous instead (Build an autonomous agent).

The template takes the telemetry, mcp and other addons, and refuses server (the launcher serves) and docker (the launcher refuses a non-loopback address without an authenticating extractor, which the container would need).