# ARTF container guide

The Precise container is an IAB Tech Lab Agentic RTB Framework (ARTF) 1.0 agent that runs inside your exchange with networking turned off. It reads a signed list of contextual fields from each bid request and proposes mutations that your host applies or declines.

| Capability | Runtime | Status |
|---|---|---|
| Replay the built image against an independent host conformance harness | Sandbox | Preview |
| Run an admitted scoring image inside the partner’s exchange | Partner Edge | Preview |
| Trace a synthetic auction proposal and host readback on configured public-test Access | Sandbox | Preview |

## The service

The agent serves one unary gRPC method, `com.iabtechlab.bidstream.mutation.services.v1.RTBExtensionPoint/GetMutations`. Your orchestrator calls it with a bid request or response. The agent answers with proposed mutations, and your auction host decides which ones to apply.

```mermaid
flowchart LR
  feed["Signed policy file"]:::said -->|read-only mount| agent["Precise agent"]
  orch["Your orchestrator"] -->|GetMutations| agent
  agent -->|proposed mutations| host["Your auction host"]
  host -->|applies or declines| auction["Auction"]
  host -->|applied-mutation log| readback["Readback"]
```

The agent's inputs are the read-only policy mount, one small writable state volume and your orchestrator's gRPC calls. Its outputs are gRPC answers, health endpoints and Prometheus metrics on the pod's own ports, and optional telemetry to a Unix socket your host mounts.

## What the agent reads

A signed allowlist, `binding.permitted_fields`, names each contextual field the agent may read in your deployment. There are 14 groups holding 20 fields, and each field is granted separately.

| Group | Fields | Notes |
|-|-|-|
| Site domain | `site.domain` | |
| Page | `site.page` | Host and path only. Credentials, literal IP hosts, queries and fragments are excluded |
| App | `app.bundle` | |
| Publisher | `publisher.id` | From the active site, app or DOOH channel |
| Placement | `imp.tagid` | |
| Video placement type | `imp.video.placement` | The signed feature reads OpenRTB `video.plcmt` first, then legacy `video.placement` |
| Start delay | `imp.video.startdelay` | Mapped to pre, mid or post |
| Player size | `imp.video.w`, `imp.video.h` | |
| Banner size | `imp.banner.w`, `imp.banner.h` | |
| Banner position | `imp.banner.pos` | |
| Device type | `device.devicetype` | |
| Operating system | `device.os` | |
| Geography | `device.geo.country`, `device.geo.region`, `device.geo.metro` | |
| Content and supply chain | `content.genre`, `content.livestream`, `source.ext.schain.hops` | Genre and livestream also support DOOH. The supply-chain value is the hop count only |

The input excludes the user object, device identifiers, IP addresses and the user agent. The release verifier rejects an allowlist with an unknown field and a scoring weight on a field that is not granted.

The agent proposes no segment write on a request that carries a positive COPPA or GDPR flag, a nonempty GPP string or section list, or a restrictive US privacy indication. An absent regulations block permits the evaluator to proceed. The worker checks GPP presence without decoding consent. The host determines consent and grants the write.

Your host is the trusted ingress. It authenticates its orchestrator, strips input it has not authorized before it calls the pod, and applies its own data and consent rules before it grants segment writes. A host that carries the supply chain in a legacy JSON extension maps it to the OpenRTB 2.6 `Source.schain` field before the call.

## The seven intents

| Intent | Applies to | Patch | Rule |
|-|-|-|-|
| `ADD_METRICS` | Publisher, SSP or exchange request | Add at `/imp/{imp}` | Adds the observed USD impression floor. A scoring line that signs `publish_score_metric: true` can also publish its integer score as `precise.context_score.<line_id>`. Forwarding a metric is a host write |
| `BID_SHADE` | DSP response | Replace price at `/seatbid/{seat}/bid/{bid}` | For an authorized seat and line, a matched impression, a first-price auction, a USD floor and a lower admissible price. A missing `at` means second price. A shaded bid is always at or below the original |
| `ADJUST_DEAL_FLOOR` | Seller request | Replace floor at `/imp/{imp}/deals/{deal}` | Within signed bounds, on exactly one negotiated deal |
| `ACTIVATE_SEGMENTS` | Publisher request | Add at `/user/data/segment` | The sorted union of selected or explore IDs across advertiser lines. Any qualifying impression can select a line's segment for the request. Below the threshold each line has one explore draw per request, and selection takes precedence |
| `ADJUST_DEAL_MARGIN` | Publisher request | Replace at `/imp/{imp}/deals/{deal}` | A percentage margin on an existing deal, chosen by a signed table |
| `SUPPRESS_DEALS` | Publisher request | Remove at `/imp/{imp}`, with the deal ID | When the deal's signed line or its intraday control is paused. The deal's floor and activation proposals stop with it |
| `ACTIVATE_DEALS` | Seller request with a PMP | Add at `/imp/{imp}` | Eligible, absent IDs from the signed format allowlist that qualify on this impression. Your host resolves them against its catalog |

Three rules apply to every intent:

- The signed deployment grant narrows the image manifest. The agent proposes only the intents your grant names.
- The evaluator requires the originator's type and configured ID, the lifecycle, and the request's explicit intent.
- An empty intent list or an expired policy generation makes the agent abstain: it answers with no mutations.

### Path profile and margin unit

The signed `binding.deal_path_profile` selects the paths. The table above shows `iab_v1`, the default. A host that requires PMP paths signs `pmp_deal`.

| Patch | `iab_v1` (default) | `pmp_deal` |
|-|-|-|
| Metric | `/imp/{imp}` | `/imp/{imp}/metric` |
| Deal floor and deal margin | `/imp/{imp}/deals/{deal}` | `/imp/{imp}/pmp/deals/{deal}` |
| Deal suppression | `/imp/{imp}` | `/imp/{imp}/pmp/deals/{deal}` |

The signed `binding.margin_unit` selects how a margin is written: `fraction`, where 750 basis points is `0.075`, or `percent_points`, where it is `7.5`. Agree the path profile, the margin unit and your upstream permission to activate request-wide segments in the host agreement. See the IAB pages for [deal suppression](https://github.com/IABTechLab/agentic-real-time-framework/blob/main/docs/intents/suppress-deals.md) and [deal margin](https://github.com/IABTechLab/agentic-real-time-framework/blob/main/docs/intents/adjust-deal-margin.md).

## Contextual scoring

Policy v2 carries `contextual_scoring.lines[]`, one entry per advertiser line. Each line binds one catalog deal, one selected segment and one explore segment to its policy line, format family and intraday control.

1. The score is an integer: the sum of signed weights for the field values that match.
2. The threshold is inclusive. A request at or above it gets the line's selected segment.
3. Below the threshold, a hash of the auction and the line makes one explore draw per request, for the signed share set in basis points.
4. One request can be scored for display and video lines together when the impression offers both formats.
5. A line can name required fields. A request that lacks one gets no proposal from that line, on explore traffic too.

Deals qualify per impression. Segment exploration uses one deterministic draw per auction and advertiser line. At a signed 500 basis points, 954 of the same 20,000 auction IDs explored with one, two and eight impressions (4.77% in each case).

For a signed line with threshold 0 and genre `sports` weighted −20, adding `"required_fields":["content.genre"]` makes a missing genre abstain even on exploration traffic. Alternatively sign `"absent_weights":{"content.genre":-20}`, so omission cannot improve that line's score. The loader refuses a negative field without a required-field rule or a conservative absence weight.

The integer score is deterministic for fixed inputs. An RPC can return fewer proposals when a deadline expires, admission fills, the response cap is reached or the snapshot expires. Money uses integer USD CPM micros.

## Signed policy files

A policy generation is one JSON file with a `payload` and a hex Ed25519 `signature` over the payload's RFC 8785 canonical bytes. The signature binds the release ID, the full Policy v2, its matching control, the field and intent binding, `budget_authority` and the pause flag.

Before it publishes a generation as one immutable snapshot, the agent checks the tenant, the pinned verification key, the revision, the activation time and the TTL, and recomputes the policy's SHA-256. A TTL is at most 24 hours. A signed `binding.max_clock_skew_ms` of up to 30,000 lets a generation be admitted early, and does not extend its expiry. With a snapshot, the response includes its release, policy digest, control revision and signed payload digest. With no snapshot the model version is `unloaded`.

| Event | What the agent does |
|-|-|
| A new file appears in the policy directory | Picks it up at the next poll, 250 ms apart by default, with no restart |
| A bad update arrives during service | Rejects the update and keeps the current valid generation. At startup a rejected mounted file masks the bootstrap layer and leaves the service unready |
| The agent starts with no valid generation | Answers 503 on `/health/ready` until a signed generation arrives |
| A generation sets the pause flag | Pauses at the next poll |
| A generation passes its TTL | Stops proposing writes |
| A revision is lower than one already admitted | Rejects it. Reissuing older policy takes a newly signed, higher revision |
| The admitted revision arrives again with different content | Rejects it. After a restart, only the exact file admitted at that revision reopens |

Publish by atomic rename, or by a ConfigMap or CSI projection. The directory is read-only to the agent.

The agent keeps the last admitted revision in a small state file, written and synced before the new snapshot is installed. That file is what makes a rollback fail after a restart.

## Settings

| Setting | Default | Meaning |
|-|-|-|
| `ARTF_PUBLIC_KEY_HEX` | Required | The tenant-scoped verification key your host provisions |
| `ARTF_TENANT` | Required | The tenant ID |
| `ARTF_LAYER` | `/opt/precise/policy.json` | An optional verified bootstrap file, embedded or mounted |
| `ARTF_POLICY_DIR` | `/policy` | The directory polled for `current.json` |
| `ARTF_POLL_MS` | `250` | Milliseconds between polls |
| `ARTF_STATE_FILE` | `/state/revision.json` | Where the agent keeps the last admitted revision, the tenant and the digest of that release file. Mount a writable, private volume for uid 65532 and keep it across pod replacements. One live agent owns each state file |
| `ARTF_MIN_REVISION` | `1` | An optional floor for a first start. After a lost state volume, set it to a revision you trust before resuming |
| `ARTF_GRPC_SERVER_ADDRESS` | `0.0.0.0` | gRPC listen address |
| `ARTF_GRPC_SERVER_PORT` | `50051` | gRPC port, with health and reflection. Fallback environment name `GRPC_PORT` |
| `ARTF_HTTP_SERVER_PORT` | `8080` | `/health/live`, `/health/ready` and `/metrics`. Fallback environment name `HEALTH_PORT` |
| `ARTF_MAX_CONNS` | `64` | Bound on connections and in-flight evaluations |
| `ARTF_RETURN_MARGIN_US` | `500` | Microseconds kept in hand before the earlier of `tmax` and the gRPC deadline. A missing or zero `tmax` gets a stamped empty answer |
| `ARTF_MAX_REQUEST_BYTES` | `262144` | Largest decoded request. Settable from 1 to 16,777,216 |
| `ARTF_MAX_MUTATIONS` | `256` | Most proposals in one answer. Settable from 1 to 4,096 |
| `ARTF_OTLP_SOCKET` | Unset | An optional Unix-domain socket your host mounts. The agent sends cumulative metrics every ten seconds and spans for sampled requests. It exports no auction payload and has no IP destination |

Read `/health/ready` before routing auctions and inspect `artf_active_revision` and `artf_seconds_to_expiry` on `/metrics`. A rejected file logs `artf_reload_refused` with its reason and offered revision. A rising `artf_shed_total` indicates saturated admission. `artf_deadline_total` and `artf_mutation_cap_total` distinguish partial responses and capped output; `artf_intent_proposals_total` counts proposals by intent. A shed evaluation can return an empty response. A deadline during evaluation returns completed proposals while the snapshot remains valid. A newly expired snapshot clears its proposals. Keep managed deals gated on every auction.

```sh
curl -fsS http://127.0.0.1:8080/health/ready
curl -fsS http://127.0.0.1:8080/metrics
```

SIGTERM marks the agent draining and publishes gRPC `NOT_SERVING`. After 150 ms of notice the listeners stop accepting work. In-flight RPCs may finish during the bounded five-second drain; the process exits 0 and logs `artf_drain_timeout` if an open stream outlives that limit. The optional OTLP collector receives telemetry over a host-mounted Unix socket.

## Budget authority

Each generation states who enforces the money limit.

- `external_host`: the exchange enforces the money limit on the effective auction, and the control patch carries no local monetary balances.
- `none`: only the explicitly allowed descriptive metric is eligible.

A generation that claims bidder `host` authority, `lease` authority, or a line-level remaining-budget or local-spend control is rejected by the exchange agent. (Bidder-side components use `host` with supplied balances and reject `external_host`.) An empty answer can leave an existing bid live, so your host drops that bid when it has no other way to enforce a mandatory ceiling.

## Deal eligibility

A grant that covers deal or segment activation, or deal suppression, must sign `binding.deal_eligibility = "segment_gated"`. Under that contract your host requires a fresh positive signal for a managed deal on each auction. A pause, an expiry, a missed deadline or a partial answer then leaves the deal out, which is the safe outcome. A host that keeps managed deals eligible by default cannot honor this contract, so settle it in the host agreement before the first release.

## Run profile

| Property | Value |
|-|-|
| Container flags | `docker run --network none --read-only --cap-drop ALL` |
| Writable storage | One state volume for the revision file. The policy mount is read-only |
| User | uid and gid 65532, non-root |
| Manifest resources | cpu `500m`, memory `128Mi` |
| Manifest network policy | Ingress from the orchestrator, egress none |
| Probes | `/health/live` and `/health/ready` on port 8080 |

## Build and test

Run these from the `artf/` workspace. The scripts use `jq`, `curl`, a gRPC client and Docker. Set `ARTF_ORACLE=1` on the smoke or benchmark script to also check the wire against the pinned IAB descriptors.

```sh
cargo test --locked --workspace
cargo build --locked --release --workspace
scripts/smoke.sh
scripts/build-image.sh precise-artf:local
scripts/container-smoke.sh precise-artf:local
scripts/context-bench.sh
scripts/matrix-bench.sh precise-artf:local
```

Start an agent on a fresh synthetic release, then call it from a second terminal:

```sh
host_dir=$(mktemp -d "$PWD/target/demo.XXXXXX")
target/release/precise-artf-conformance fixture "$host_dir" 1 active
ARTF_PUBLIC_KEY_HEX="$(cat "$host_dir/public.hex")" ARTF_TENANT=demo \
  ARTF_POLICY_DIR="$host_dir/published" ARTF_STATE_FILE="$host_dir/revision.json" ARTF_GRPC_SERVER_ADDRESS=127.0.0.1 \
  target/release/precise-artf-agent
```

```sh
method=com.iabtechlab.bidstream.mutation.services.v1.RTBExtensionPoint/GetMutations
grpcurl -plaintext -d @ 127.0.0.1:50051 "$method" < samples/video-deals.json
```

The fixture command keeps its temporary signing seed in the host directory. Only `published/` and the public key belong on the agent.

The synthetic release from this command uses `iab_v1` and the default fractional margin unit. The sample returns `ACTIVATE_DEALS` at `/imp/imp-1` and a floor of 8.8 at `/imp/imp-1/deals/deal-premium-video`.

## Reading back what your host applied

A proposal counts only when your host's log shows it applied. The conformance harness replays a host-written log and joins it to the win:

```sh
target/release/precise-artf-conformance replay http://127.0.0.1:50051 target/rejected.jsonl reject
```

In that replay, the declined $5.50 bid keeps its price and earns zero. The following app response comes from a separate recorded replay. Answer trimmed to the grant, the mutations and the exposure.

```sh preview
curl -s -X POST "$PRECISE_URL/api/v1/execution/simulate" -H 'content-type: application/json' -d '{"host": "reject"}'
```

```json answer
{
  "host": "reject",
  "granted_intents": [
    "ACTIVATE_SEGMENTS",
    "ACTIVATE_DEALS",
    "ADJUST_DEAL_FLOOR",
    "BID_SHADE",
    "ADD_METRICS"
  ],
  "model": "precise-artf/0.1.0 release=demo-v1 p=sha256:d9f66111200250a80bd73c02a616f490031e9b58ce2472c1fee143db4bbd1672 c=1 activation=sha256:948c330d8ad81608303a59931ac6a8144ea629e432c2ccde0fc46a121a4113c8",
  "mutations": [
    {
      "intent": "ADD_METRICS",
      "path": "/imp/imp-1/metric",
      "request": "sample-video-001",
      "proposed_cpm": null,
      "before_cpm": null,
      "after_cpm": null,
      "applied_by_host": true
    },
    {
      "intent": "ADJUST_DEAL_FLOOR",
      "path": "/imp/imp-1/pmp/deals/deal-premium-video",
      "request": "sample-video-001",
      "proposed_cpm": 8.8,
      "before_cpm": 10,
      "after_cpm": 8.8,
      "applied_by_host": true
    },
    {
      "intent": "ACTIVATE_DEALS",
      "path": "/imp/imp-1",
      "request": "sample-video-001",
      "proposed_cpm": null,
      "before_cpm": null,
      "after_cpm": null,
      "applied_by_host": true
    },
    {
      "intent": "BID_SHADE",
      "path": "/seatbid/dsp-001/bid/bid-abc",
      "request": "sample-bidshade-001",
      "proposed_cpm": 4.675,
      "before_cpm": 5.5,
      "after_cpm": 5.5,
      "applied_by_host": false
    }
  ],
  "exposure": {
    "counted": false,
    "attributed_micros": 0,
    "paid_micros": 5500,
    "bid_cpm_before": 5.5,
    "bid_cpm_after": 5.5,
    "saved_cpm": 0,
    "sentence": "The host did not apply the lower bid, so nothing is counted."
  }
}
```

When the host applies the lower bid, the same auction counts. Answer trimmed to the bid-shade mutation and the exposure.

```sh preview
curl -s -X POST "$PRECISE_URL/api/v1/execution/simulate" -H 'content-type: application/json' -d '{"host": "accept"}'
```

```json answer
{
  "host": "accept",
  "mutations": [
    {
      "intent": "BID_SHADE",
      "path": "/seatbid/dsp-001/bid/bid-abc",
      "request": "sample-bidshade-001",
      "proposed_cpm": 4.675,
      "before_cpm": 5.5,
      "after_cpm": 4.675,
      "applied_by_host": true
    }
  ],
  "exposure": {
    "counted": true,
    "attributed_micros": 4675,
    "paid_micros": 4675,
    "bid_cpm_before": 5.5,
    "bid_cpm_after": 4.675,
    "saved_cpm": 0.825,
    "sentence": "The host applied the lower bid: $5.50 became $4.68 per thousand, and the difference is counted."
  },
  "model": "precise-artf/0.1.0 release=demo-v1 p=sha256:d9f66111200250a80bd73c02a616f490031e9b58ce2472c1fee143db4bbd1672 c=1 activation=sha256:948c330d8ad81608303a59931ac6a8144ea629e432c2ccde0fc46a121a4113c8"
}
```

The sample app serves a historical `pmp_deal` trace. Its metric and deal paths carry `/metric` and `/pmp/deals/`. No margin is proposed and this recording does not expose the signed margin unit. Use the installed binding for that unit. To establish exposure join the host-applied mutation to the winning event on request ID, auction ID, exact model stamp and bid path. The applied effective CPM must match the win. A rejected shade leaves $5.50 in force, giving zero attributed micros. The accepted example attributes 4,675 micros of settled spend; it does not establish 4,675 micros of savings.

## Latency

These measurements were taken on one machine, over loopback, on 24 Nov 2026. Latency inside your exchange depends on your network and your concurrency, and it is measured in your environment during onboarding.

### One warm connection, light requests

Separate optimized client and server processes, one warm HTTP/2 loopback connection, sequential unary calls, 3,000 timed calls after 100 warmups.

| Request | p50 | p99 |
|-|-|-|
| Bid-shade answer | 92.0 µs | 195.5 µs |
| Signed contextual scoring, all 14 groups across alternating site/app requests | 114.3 µs | 283.9 µs |

### Under the run profile's limits, heavy requests

The release agent in its container with 500m CPU, 128 MiB of memory and networking off, and a separate client on the container's loopback. The two rows below show the 128-line, 128-impression cells with a 10 ms host budget.

| Connections | p50 | p99 |
|-|-|-|
| 1 | 1.645 ms | 17.789 ms |
| 4 | 4.223 ms | 40.247 ms |

Across all 20 cells of 200 timed calls, every one of the 4,000 replies carried a mutation. The 256-proposal cap was reached 2,399 times. One deadline returned partial work and zero evaluations were shed. A host enforcing 10 ms end to end may discard a late reply. The agent's deadline guard covers its own processing. A CPU-quota scheduling delay, encoding and transport can still put the client's latency past the host budget, as the p99 column shows. `scripts/matrix-bench.sh` reproduces the full matrix: one and four connections, 10 ms and 150 ms budgets, and 1 to 128 impressions.

Download the [20-cell measurement file](../../downloads/artf/artf-latency-500m.jsonl). It includes line and impression counts, concurrency, host budget, bytes, percentiles, partials and server counters for each cell.

## What your host provides

1. An orchestrator that authenticates itself to the pod and strips unauthorized input.
2. The verification key and tenant ID, and a read-only policy directory updated by atomic rename.
3. A private, persistent state volume, writable by uid 65532, kept across pod replacements.
4. The segment IDs and deals registered in your catalog.
5. The path profile, the margin unit and the deal eligibility contract, confirmed in the host agreement.
6. The log of mutations your host applied.

## Related

[Supply partners overview](README.md) · [Curated deal orchestration](curated-deal-orchestration.md) · [Standards map](../../reference/standards-map.md) · [Offline verification](../security-and-infosec/offline-verification.md)
