← ch 84

topío — system design

A query-based agent that searches landscape-specimen imagery, resolves real-world measurements from a single photo down to the inch, and builds its own dataset — no human in the measuring loop. Approved specimens go straight on air as ch21 library records.

pipeline

  1. 01 · query

    Operator asks in plain words: 'blue spruce, 4–6 ft, field-grown'.

  2. 02 · scout

    Candidate images gathered with license + source recorded.

  3. 03 · grade

    Blur, collage, occlusion, and multi-specimen frames dropped early.

  4. 04 · depth

    Monocular depth field estimated for the surviving frames.

  5. 05 · scale ×2

    Path A: EXIF focal length + sensor size. Path B: reference objects (pavers, brick courses, doors, hands, standard nursery pots).

  6. 06 · cross-check

    The two scales must agree within tolerance. Disagreement lowers confidence instead of picking a winner.

  7. 07 · dimension

    Height, spread, caliper resolved in inches with an uncertainty band.

  8. 08 · gate

    Below threshold → quarantine, not library. The dataset never absorbs a guess.

  9. 09 · file

    Record embedded in small chunks, deduped, marked pending review.

  10. 10 · approve → publish

    Admin approves; courier files it in the station library and it goes on air.

sub-agents & tool contracts

scout

Finds candidate specimen imagery for a query.

search(query, filters) → [{ url, source, license, caption, exif? }] · must return license + provenance or the item is dropped.

grader

Rejects unusable frames before any expensive work runs.

grade(image) → { usable: bool, reasons[], blur, occlusion, single_specimen: bool } · hard-fails on collages and watermarks.

depth

Produces a relative depth field from one photo.

depth(image) → { depth_map_ref, relative: true, model_id, latency_ms }

scaler

Converts relative depth into real-world scale two independent ways.

scale(image, depth_map_ref) → { path: 'exif'|'reference', inches_per_unit, confidence, evidence }

dimensioner

Measures the specimen: height, spread, caliper, leaf/needle length.

measure(image, scale) → { height_in, spread_in, caliper_in?, parts[], confidence, uncertainty_in }

librarian

Writes the record, dedupes, embeds, and files it in the library.

file(record) → { specimen_id, chunk_ids[], dedupe: 'new'|'merged', status: 'pending_review' }

courier

After admin approval, files the specimen in the station library and marks it on air.

publish(specimen_id) → { remote_id, attempts, idempotency_key } · refuses to run without an approval token.

retrieval

Retrieval engineering

The library is the product. It is chunked for meaning, not for convenience.

chunking
One chunk per meaning unit: species identity, measurement set, habitat note, source/license, visual description. Small (roughly 2–4 sentences), never a whole record in one blob.
embedding
Text chunks embedded for semantic search; image embeddings stored alongside so 'looks like this' queries work next to 'named like this'.
hybrid recall
Vector recall unioned with keyword/filter recall on species, size range, and region — then deduped by specimen id.
rank
Re-rank the union by query relevance, measurement confidence, and recency of source. Confidence is a ranking signal, not a footnote.
grounding
Every answer cites specimen ids and source URLs. No citation, no claim.

reliability

Reliability engineering

Every tool call is assumed to fail sometimes. The workflow is built to survive it.

timeouts
Per-tool budget; depth and scale get the longest, scouting the shortest. A step that blows its budget is cancelled, not waited on.
retries
Bounded retries with exponential backoff and jitter. Only timeouts, rate limits, and 5xx are retried — bad input never is.
fallback pass
If a scale path fails, the run continues on the surviving path with reduced confidence. If both fail, the frame is quarantined.
idempotency
Filing and publishing carry idempotency keys so a retry can't create a duplicate specimen or a double upload.
circuit breaker
A source or tool failing repeatedly is dropped from the run and reported, instead of poisoning the batch.

safety

Security & safety

Scraped captions and page text are untrusted input, not instructions.

injection defense
Fetched captions, alt text, and page copy are wrapped as data. Instruction-shaped content is stripped and logged, never executed.
input validation
Schema validation on every tool boundary: URL allowlists, content-type and byte-size checks, real image sniffing, EXIF sanity ranges.
output filters
Measurements must be physically plausible for the species before they leave the agent. Impossible numbers are rejected at the boundary.
permissions
Least privilege per sub-agent. Only courier can write to the station library, and only with an admin approval token. Nothing else has publish rights.
licensing
Images without usable license provenance never enter the library.

observability

Evaluation & observability

If it isn't traced and scored, it isn't shipped.

tracing
One trace id per query, spans per sub-agent and per tool call, with inputs hashed, outputs summarized, and retries visible.
tool records
Per-tool success rate, p50/p95 latency, retry rate, and failure taxonomy.
cost per task
Tokens, image ops, and storage rolled up to cost per accepted specimen — the number that actually matters.
measurement eval
A held-out set of hand-measured specimens scores mean absolute error in inches and calibrates the confidence gate.
regression gate
A model or prompt change ships only if MAE and accepted-specimen yield hold on the eval set.

product

Product & UX

A query bar, a wall of specimens, and one approval button.

query first
The whole surface is one input. Ask for a specimen and size range; the run starts and streams progress by step.
measurement card
Each result shows the image, dimensions in inches, the uncertainty band, which scale path was used, and its evidence.
confidence is visible
Low-confidence items sit in quarantine, visibly separate from the library. Nothing silently becomes truth.
approval queue
Admin reviews pending specimens, approves in batches, and filing to the station library happens automatically after that.
no human measuring
Humans approve. They never enter a dimension by hand.

station library handoff

Once a specimen is approved, the courier files it into the ch21 station library: one record per request, idempotency key so a retry can't double-post, and the remote id written back onto the library record. If no external network endpoint is configured, the courier runs in dry mode and logs the exact payload it would hand off.