Governed Vision Tools

VisionToolset gives an agent ten vision tools that run on the governed tool path. A call that stays on the device runs like any read. A call that would send an image off the machine is checked against the egress rules: with none it leaves as it is; a rule that asks holds it for a person with the exact image it would send, and a listed redaction class covers it first. Every backend call opens its budget hold before any image leaves, and every call, release and edit writes a signed vision.* audit record. This page implements spec 3.7 §7.8, §7.9 and §9.3 (spec).

[dependencies]
adk-vision = { version = "3.0.0", features = ["guardrail"] }

Note: spec 3.7 Q1, revised 2026-11-25: every restriction is an opt-in. With no rules an image leaves unredacted and unasked; ask, deny, redact and on_device each restrict once chosen. Q3 is settled: when the rules list faces, faces are redacted by the YuNet face detector, and a person it finds no face for as the whole person.

The Tools

ToolDoesEffectArguments
vision_detectFinds objects by class or conceptReadOnlyimage, classes or concepts, region, backend
vision_segmentSegments from concepts or box promptsReadOnlyimage, concepts, boxes, region, backend
vision_readReads a document: blocks, words, tablesReadOnlyimage, markdown, region, backend
vision_describeAnswers a question, as text or a value matching a schemaReadOnlyimage, question, schema, region, backend
vision_cropA new image of one regionIdempotentimage, region, margin
vision_redactA new image with regions filled solid blackIdempotentimage, regions
vision_annotateA new image with numbered boxes drawnIdempotentimage, boxes
vision_measureMaximum length and area in millimetres from masks, under a fiducial's calibration (measurement)ReadOnlyimage, boxes or concepts, fiducial or calibration, region, backend
vision_videoAsks about frames in time order, captions them in chunks, or tracks objects by concept across them (below)ReadOnlyframes, timesMs or intervalMs, one of question, chunkSeconds or concepts, region, backend
vision_watchLists the registered frame sources; starts or stops a watch condition that wakes a sleeping agent (streams, feature stream, with VisionToolsetBuilder::frame_sources)Idempotentaction, source, name, labels, minScore, minFrames, zone, zoneAnchor, cooldownSeconds
  • Images. An image argument is an artifact name in the session or a sha256: digest an earlier tool returned. The toolset keeps each image it reads in the runtime's MediaStore, named by digest, so the digest in a call's arguments names one exact image.
  • Regions. region is [x0, y0, x1, y1] in the image's pixels. With a region, the backend is sent that crop only, and every answer comes back in the image's pixels.
  • Tools offered. Only the tasks the runtime has a backend for become tools.
  • Data classes. The operator sets the class an image is released as — VisionToolsetBuilder::data_classes("document", "document_crop") for whole images and crops — never the model, because the egress rules are written per class.

vision_video

vision_video hands the runtime's video route (VisionRuntime::analyze_video) frames the session already holds — a watch's kept frames, a camera's snapshots, images an earlier tool made — as one sampled video. It is offered when the runtime has a video analyzer, such as FramesAnalyzer over Claude or Qwen3-VL, or SamVideoTracker.

ArgumentMeaning
frames1 to 64 images, oldest first, each a sha256: digest or an artifact name
timesMsEach frame's time in milliseconds, never decreasing; without it the frames are intervalMs apart (default 1000) from 0
questionAsk: the answer, with the events it names as time ranges
chunkSecondsCaption: one caption per chunk of that length
conceptsTrack: the objects each phrase names, followed across the frames
regionOnly this part of every frame is sent

A call names exactly one of question, chunkSeconds and concepts. Event times come from the frames' times, never from the model's arithmetic, and each tracked region names its frame by index, time and digest, with its track:

{
  "frames": ["sha256:1f…", "sha256:9c…", "sha256:4a…"],
  "text": "A forklift crosses the aisle.",
  "events": [{ "startMs": 500, "endMs": 1000, "text": "The forklift crosses from the left.", "labels": ["forklift"] }],
  "tracked": [{ "frame": 1, "atMs": 500, "image": "sha256:9c…", "regions": [{ "box": [120, 100, 200, 220], "label": "forklift", "score": 0.9, "track": 7 }] }],
  "usage": { "frames": 3, "inputTokens": 1890, "outputTokens": 42, "requests": 1, "costMicroUsd": 820 },
  "calls": [{ "backend": "claude", "remote": true, "egress": ["sha256:…", "sha256:…", "sha256:…"] }]
}

For a remote analyzer every frame passes the egress gate as an image does — cropped, redacted under the rules' redact list and recorded — and a rule that asks holds the call once, with every frame it would send as evidence; approval releases exactly those digests. The call keeps no answer record, as the annotated viewer shows one image at a time.

Wiring

Three pieces go on the agent and the run:

PieceWhereWhy
toolsetLlmAgentBuilder::toolsetThe tools
toolset.evidence_callback()LlmAgentBuilder::before_tool_callbackA held remote call carries the image it would send
toolset.egress_policy()Runner::builder().tool_policy or RunConfig::tool_policyThe egress rules decide each remote call: deny, ask or allow
use std::sync::Arc;

use adk_agent::LlmAgentBuilder;
use adk_artifact::InMemoryArtifactService;
use adk_core::egress::EgressPolicy;
use adk_runner::Runner;
use adk_vision::{
    Describer, Detector, DocumentReader, EgressGate, InMemoryEgressRecorder, MediaStore,
    PersonRedactor, PersonalTextRedactor, ReleasedImage, VisionConfig, VisionRuntime,
    VisionToolset,
};

/// `rules` is `.adk/vision.toml`, read with `VisionConfig::from_toml_str`.
fn desk(
    rules: VisionConfig,
    model: Arc<dyn adk_core::Llm>,
    people: Arc<dyn Detector>,
    ocr: Arc<dyn DocumentReader>,
    claude: Arc<dyn Describer<ReleasedImage>>,
    sessions: Arc<dyn adk_session::SessionService>,
) -> adk_core::Result<Runner> {
    let artifacts = Arc::new(InMemoryArtifactService::new());
    let store = MediaStore::new(artifacts.clone());
    let gate = EgressGate::new(
        EgressPolicy::allow_private_networks(),
        rules.egress,
        Arc::new(InMemoryEgressRecorder::new()),
    )
    .with_redactor(Arc::new(PersonRedactor::new(people)))
    .with_redactor(Arc::new(PersonalTextRedactor::new(ocr.clone()).with_labelled_fields(["Name"])))
    .with_media_store(store.clone());
    let runtime = VisionRuntime::builder()
        .reader(ocr)
        .remote_describer(claude)
        .egress_gate(gate)
        .media_store(store)
        .build()?;
    let toolset = VisionToolset::builder(Arc::new(runtime))
        .data_classes("document", "document_crop")
        .build()?;
    let agent = LlmAgentBuilder::new("desk")
        .model(model)
        .toolset(Arc::new(toolset.clone()))
        .before_tool_callback(toolset.evidence_callback())
        .build()?;
    Runner::builder()
        .app_name("desk")
        .agent(Arc::new(agent))
        .session_service(sessions)
        .artifact_service(artifacts)
        .tool_policy(toolset.egress_policy())
        .build()
}

A run that holds remote calls without the egress policy, or without the evidence callback, fails closed: the call is refused with the missing piece named, and nothing leaves. EgressApproval::Explicit is the alternative for an application that shows the image and records the decision itself, through VisionToolset::approve_egress.

Approve with the Image

For a call routed to a remote backend, the evidence callback runs the egress gate's first three steps before the call is authorized — destination, minimise, redact — and stores the redacted copy as an artifact (EgressGate::stage). The tool's approval_evidence hands that copy to the governed path as ImageEvidence:

FieldValue
digestsha256: of the exact bytes that would leave
artifactThe stored egress copy, loaded by a surface with the viewer's own authorisation
regionsEach filled box, as a RegionSet labelled faces, personal_text or marked
captionto api.anthropic.com as document_crop · 1 face · the whole person is covered, 6 personal details covered

The digest joins the call's fingerprint, so a decision binds to that image:

  1. Under an ask rule the egress policy returns RequireApproval, and the call is held with the evidence.
  2. A person approves; the call runs and releases exactly the approved digest — the gate re-runs the steps and releases only when the new copy has that digest.
  3. If the image changed before the call ran — a new version of the artifact — the staged copy has a new digest, the fingerprint differs, the call is held again, and the earlier decision stays unspent.

The signed audit trail links the decision and the image: the call's tool_call and approval records carry evidenceDigests, and the vision.egress.released record names the source and egress digests.

Every surface draws the held call with that image — the web home and the phone show it with its regions, the terminal as text with a link, chat attaches it or links to it — and an answer that lets the call run names the digest it saw: see Approve with the Image.

Egress Rules

The rules come from .adk/vision.toml; see The Egress Gate. The egress policy reads them per call:

Rule for the host or provider and data classPolicy decisionGate decision
denyDeny; the evidence callback refuses before anyone is askedvision.egress.refused at decide
askRequireApproval, with the egress image as evidenceReleases the approved digest only
allow (the default)AllowReleases the copy, redacted when the rules list classes
— (on-device backend)AllowNothing leaves

Redaction of every listed class precedes every decision: under redact, an allow rule releases the redacted copy, never the original. An escalation from an on-device backend to a remote one is decided by the same rules when the runtime escalates; under an ask rule its crops are not pre-approved and the call fails with the egress digest, so give the escalation's host and class an allow rule to escalate unattended.

Budgets

Every backend call opens its hold before its image is prepared or released, so a call the budget cannot cover is refused before any request and leaves no egress record (V-I6):

BackendHoldCommitted
On-deviceImages (and pages, for reading) at zero costThe same, at zero cost (V-I7)
Per unit (PriceRef::PerUnit), such as sam-3.1The unit price, with any per-request minimumThe unit price
Per token (PriceRef::Tokens)Its TokenEstimate: image tokens from the sent size, prompt tokens, and the output capZero; the model call commits its own tokens

ImageTokens::Claude counts ⌈w/28⌉ × ⌈h/28⌉ tokens, ImageTokens::GeminiTiles 258 for an image whose sides are at most 384 px, otherwise 258 per 768×768 tile. A run capped with RunBudget::max_units(UsageUnit::Images, 20) makes 20 calls; the 21st is refused before its request, naming the unit and the cap.

Audit Records

Each record has kind vision, the acting agent as actor, and content by digest only:

ActionWrittenFields
vision.callAfter each backend calltool, task, backend, locality, imageDigests, egressDigests, units, costMicroUsd, regions, durationMs, escalation
vision.egress.releasedBefore the request is sent (V-I3)sourceDigest, egressDigest, chain, redactions, destination, dataClass, rule, decisionKind, estimatedCostMicroUsd, artifact
vision.egress.refusedAt the refusing stepsourceDigest, egressDigest, step, reason, destination, dataClass
vision.editAfter an editinputDigest, operationDigest, outputDigest

They go to the run's audit trail (RunConfig::audit, signed when its recorder signs) through VisionCx::with_audit; the gate also writes each release and refusal to its EgressRecorder.

The Harness Vision Pack

adk-harness feature vision installs the toolset, the rules and the privacy guardrail:

[dependencies]
adk-harness = { version = "3.0.0", features = ["vision"] }
use std::sync::Arc;

use adk_harness::HarnessAgent;
use adk_harness::packs::vision::VisionPack;
use adk_vision::{
    Describer, Detector, DocumentReader, MediaStore, PersonRedactor, PersonalTextRedactor,
    ReleasedImage, VisionRuntime,
};

fn harness(
    model: Arc<dyn adk_core::Llm>,
    workspace: adk_devtools::Workspace,
    store: MediaStore,
    people: Arc<dyn Detector>,
    ocr: Arc<dyn DocumentReader>,
    claude: Arc<dyn Describer<ReleasedImage>>,
) -> adk_core::Result<HarnessAgent> {
    let reader = ocr.clone();
    let pack = VisionPack::new(store, move |gate, store| {
        VisionRuntime::builder()
            .reader(reader)
            .remote_describer(claude)
            .shared_egress_gate(gate)
            .media_store(store)
            .build()
    })
    .redactor(Arc::new(PersonRedactor::new(people)))
    .redactor(Arc::new(PersonalTextRedactor::new(ocr).with_labelled_fields(["Name"])))
    .model_hosts(["api.anthropic.com"]);
    HarnessAgent::builder("desk").model(model).workspace(workspace).pack_vision(pack).build()
}
PieceThe pack
ClassesOn the device Read; off it External, trusted read-only under an allow rule (the default), so an ask call is held in Ask and Auto. ReadOnly and Plan deny every call that sends an image off the machine, whatever the rules allow
Rules.adk/vision.toml as written, or VisionPack::config; with neither, every release is allowed and nothing is redacted. VisionPack::distrust_workspace_rules makes a workspace file's allow rules and default ask, and with no file every release asks
RedactorsThe operator's VisionPack::redactors; with feature vision-local, a default for each listed class none covers (below)
ApprovalsThe egress policy joins the operator policy; the harness prompter or inbox sees the egress image on the held call
Privacy guardrailOn every request to a remote harness model, releasing to the hosts the model names; no agent tool removes it (Restricting What Leaves the Machine)
Textvision_read, vision_describe and vision_video deliver recognised text, answers and captions inside an <untrusted-content source="vision"> block, screened as fetched text is

Default Redactors

With adk-harness feature vision-local, the pack installs a default redactor for each class the rules' redact list names that no VisionPack::redactor covers, so a pack needs no redactor wiring:

[dependencies]
adk-harness = { version = "3.0.0", features = ["vision-local"] }
Classvision-localWithout it
facesFaceRedactor::on_device — YuNet faces, RF-DETR Nano for people with no face foundNo redactor: every remote release is refused
personal_textPersonalTextRedactor::pp_ocr — PP-OCRv6 small, with PERSONAL_FIELD_LABELSNo redactor: every remote release is refused

The weights load on the first release through VisionPack::model_fetcher, or a fetcher built from HF_HUB_CACHE, HF_HUB_OFFLINE and HF_TOKEN, each file checked against the built-in manifest. When they cannot load, that release is refused and recorded at the redact step; when only YuNet cannot load, each detected person is covered whole. With on_device = true in [egress] the default fetcher works offline and every release is refused at the destination step (The On-Device Profile). Calls that stay on the device never load them. vision-local builds ONNX Runtime, downloaded at build time as adk-vision's onnx feature does.