# ADR 001: Resource and cost contract boundary

- HTML version: https://robbiepalmer.me/projects/pathologize/adrs/001-resource-and-cost-contract-boundary
- Project: Pathologize (https://robbiepalmer.me/projects/pathologize.md)
- Status: Accepted
- Date: 2026-11-06
- Initiatives: Personalized Medicine (https://robbiepalmer.me/initiatives/personalized-medicine.md)

## Context

Pathologize needs resource budgets that make benchmark results reproducible and
comparable. Input volume, pixels processed, compute time, and memory describe
the work performed. Provider authorization and funding depend on accounts,
budgets, and deployment policy. They do not describe the benchmark adapter.

A provider-call count is not a substitute for cost. Calls can use different
models, request sizes, currencies, prepaid access, and metered rates.

The Agent Coordinator models money as a non-negative amount with an
ISO-style three-letter currency code. It distinguishes prepaid and metered
provider use, records measured provider-request cost, and tracks resource
quantities independently. Rewriting a smaller Python version in Pathologize
would create two contracts with the same names and different release cycles.

[ADR 000](/projects/pathologize/adrs/000-standards-based-pathology-data-boundary)
keeps registry ownership outside the benchmark package. Cost needs the same
kind of ownership boundary.

## Decision

Pathologize adapter specifications, resource budgets, resource usage, and
scorecards will not contain provider authorization or provider-call limits.

Pathologize continues to own benchmark-specific resource limits and
measurements: input bytes, prediction bytes, input pixels, wall time, CPU time,
peak resident memory, accelerator wall time, and peak accelerator memory. The
runner can observe these quantities without asking an adapter to estimate its
own work. These quantities affect whether a candidate is practical on the
benchmark workload.

Provider funding, account policy, and spending authorization remain in the
orchestrator. If a future benchmark adapter uses metered inference, extract the
Agent Coordinator's `Money` and `ResourceQuantity` semantics into a versioned
JSON Schema 2020-12 contract owned by the platform. TypeScript and Python
bindings must validate the same examples and generated schema. The benchmark
scorecard will record observed monetary cost by currency. The orchestrator will
continue to decide whether payment is allowed.

Do not publish a Pathologize money field before a real adapter needs it.

## Consequences

Benchmark manifests describe experiments instead of account policy. A free,
prepaid, or metered route can run the same adapter without changing its model
identity.

Scorecards cannot compare monetary cost until the platform has a shared
cross-language contract and a measured use case. They can compare bytes,
pixels, time, and memory.

Adding cost later will require a scorecard schema revision and cross-language
contract tests. It will also need a clear rule for estimates, final charges,
currency conversion, and missing provider cost data.

## Alternatives considered

### Put a boolean permission field in the adapter

A boolean is easy to validate, but authorization depends on the owner, account,
budget, and route. The adapter cannot answer that question.

### Put a maximum provider-call count in the resource budget

Calls can have different token, image, model, and provider prices. A count is
neither a cost budget nor a stable resource comparison.

### Define a Pathologize-specific money type

This would let Python scorecards record a value without coordinating a platform
release. It would not produce a shared contract. A later change could leave
Zod and Pydantic accepting different data. The project waits for one
language-neutral schema instead.

---

Markdown index of this site: https://robbiepalmer.me/llms.txt
