Skip to main content
Non-normative. These are sandbox tenants of the public test agent, built for testing buyer and storefront agents over the life of a buy. The sandbox_clock controller scenario is proposed in #9025 and is served only by these two tenants for now. Their behaviour is a simulation, not a model of any real ad server.
Most test agents answer each call correctly but hold fixed data. Nothing forecasts from traffic, serves a booking day by day, or delivers differently from what was forecast. The two inventory agents on the test agent do all three, driven by a seeded simulation and a clock you can move. You can test what your agent does over a 30-day flight in a few calls: when a guarantee falls behind, when actual traffic differs from the forecast, or when an episode is cancelled. Both play the inventory role from #8993: they hold the catalogue and avails, execute media buys and report delivery. A storefront agent can book through both, as their buyer, over AdCP. See Storefront and inventory roles.

Connect

Authenticate with the same bearer tokens as the rest of the test agent; see the quickstart. Each tenant serves the media buy and creative tasks as they are, with no new tasks:
  • get_products returns each product with a forecast for the flight in filters.start_date and filters.end_date (30 days from now when omitted). targeting_overlay and filters.countries narrow the forecast, and a product with no inventory under them is left out. See Targeting. filters.delivery_type and filters.channels filter the products. Both brief and wholesale buying modes are served, so a storefront can read either tenant as a wholesale catalogue.
  • create_media_buy books each package:
    • Guaranteed packages take impressions as their goal. Without it, the goal is what the budget buys at the fixed price. A goal larger than the impressions available for the package’s flight and targeting, net of your other bookings, fails with PRODUCT_UNAVAILABLE. The error names the goal and what is available. It is never capped. That figure is the mid impressions of a get_products forecast for the same flight and countries, requested with your account and without budget_range.
    • The takeover and the sponsorships take every impression of what they cover, whatever the budget. So one live booking sells the takeover for each day of its flight, and a sponsorship for each installment in it. Another booking of those days or installments fails with PRODUCT_UNAVAILABLE until that one is cancelled, which frees them. Your token’s buys under every account share one market, so they compete with each other.
    • Auction packages bid bid_price, first-price, above the floor.
    • targeting_overlay narrows a package by country, place or segment. See Targeting.
    • A package’s creatives (uploaded inline) and creative_assignments (from your library) are assigned to it.
  • update_media_buy pauses, resumes and cancels a buy or a package, and changes a package’s budget, impressions or bid_price, or the buy’s end_time. Raising impressions is checked the same way, against what the rest of the package’s flight has available once the whole request is applied. Lowering it always succeeds. Cancelling the buy ignores the request’s other fields, and cancelling a package ignores that package’s other fields. It does not change a package’s targeting. A package’s creatives or creative_assignments replace its assignments.
  • get_media_buys and get_media_buy_delivery report what was booked and what was delivered. They include by_package, daily_breakdown and pacing_index for guaranteed packages. In get_media_buys, each package lists its creative_approvals.
  • sync_creatives, list_creatives and list_creative_formats manage the creatives you traffic your buys with. See Creatives.
Everything you book is private to your credential. All the accounts you use with one credential book into the same simulated market on each tenant, so your own buys compete for inventory. A get_products call that names an account returns cache_scope: "account", with forecasts net of your bookings. Provision that account with sync_accounts first: an account reference the tenant never provisioned fails with ACCOUNT_NOT_FOUND. One without an account returns the public card, cache_scope: "public", with forecasts against an empty market. Neither tenant requires operator authentication, so a storefront can call them with its own credential. The publishers use .example domains, so a registry or DNS check of their properties fails. That is expected in this sandbox.

Creatives

Both tenants keep a creative library for each account. Sync creatives to it with sync_creatives, or upload them inline on a package, and assign them to the packages you have bought.
  • Formats. list_creative_formats returns only the formats the tenant serves: display, pre-roll video and the takeover image on the ad server; the podcast spot, newsletter sponsorship and creator brief on the content platform. Name a creative’s format canonically, with format_kind and the params of one of the product’s format_options (or its format_option_ref); the size of the creative’s image or video picks the format when params is omitted. A named format_id copied from format_options also works. A request whose format still matches more than one option is refused, naming them. A product you seed also serves the format_options its fixture declares; name one with its format_option_ref. A creative in a seeded option is held to the values that option declares: a cta outside its cta_values is refused with CREATIVE_VALUE_NOT_ALLOWED. A creative can only be assigned to a package whose product serves its format. Otherwise the request fails with FORMAT_NOT_SUPPORTED.
  • Assignments. assignment_operations supports assign, unassign and replace. A request’s operations apply together or not at all. The deprecated assignments field still works, and reports each failed assignment in the creative’s assignment_errors. Merges, assignment-level trackers and landing pages, installment scoping and placement routing are rejected with UNSUPPORTED_FEATURE.
  • Review and delivery. Every creative is approved as soon as it arrives. A buy reports pending_creatives while none of its live packages has a creative, then pending_start or active as usual. Delivery does not wait for a creative, though: an unassigned package delivers as the simulation’s actual traffic dictates. The creatives exist to test trafficking, not to gate serving.
  • Scope. Creatives are private to the account that synced them, like the buys they are assigned to. Each account holds up to 200 creatives of up to 32 KiB each; reference hosted media by URL. reset_state clears them with the rest of your market.

Targeting

A package’s targeting_overlay can name countries, places and segments. The season’s geography is four sales regions, and its audiences are segments of audience profiles: The ad server’s segments are sports_fans, household_decision_makers and news_loyalists. Each is a set of audience profiles, which the traffic carries per region. Every field you send is checked. A targeting field a product does not support is refused by name with UNSUPPORTED_FEATURE, and is never ignored. That includes property_list, device_platform and the other overlay fields these tenants do not serve. Malformed values, an unknown region or segment, and a field in both its include and exclude form fail with INVALID_REQUEST and the path of the field. Values that are valid but leave no inventory in the product, such as geo_countries: ["GB"], fail with PRODUCT_UNAVAILABLE.

Countries

geo_countries and geo_countries_exclude take ISO 3166-1 alpha-2 codes (US, CA). Lowercase codes are accepted and returned in uppercase. Every product takes them.

Places

geo_places and geo_places_exclude take sales regions as places. Each entry names a country, a place system, a place_type and the region ids as values:
  • The system is the server’s TRAINING_AGENT_INVENTORY_PLACE_SYSTEM setting, https://adcontextprotocol.org/training-agent/places by default. The place_type is the system followed by /types/sales-region.
  • The values are region ids. A region in a different country from the entry’s country fails with INVALID_REQUEST.
  • The catalogue is at version "1". A system_version other than "1" fails with INVALID_REQUEST. Packages echo it as "1" when you leave it out.
  • A different system, place_type or country is refused with UNSUPPORTED_FEATURE.
  • Countries and places combine: a package takes the regions in both its countries and its places, less its exclusions.
The ad server advertises its place system in get_adcp_capabilities, with a resolver. The resolver is a public GET that needs no authentication:
  • Send country and exactly one of q (a case-insensitive match on a region’s name or id) or value (an exact region id).
  • subdivision, place_type, system_version and limit (1 to 100, default 20) are optional. Matches come back in one page.
  • It returns system, system_version, the echoed request and matches. Each match has value, country, place_type, label, canonical_name, parent_labels and status.
  • A bad query returns 400 with { "error": "..." }.

Segments

A segment is a signal that belongs to a product: a signal_ref with scope product and the segment id as signal_id. Each product that takes segments lists the ones it offers in signal_targeting_options. The takeover and the content products declare none. A product’s own segment is in included_signals instead, because it already sells to it. Segments are binary, so value is always true. signal_targeting_groups has an operator of all over groups. A group with any keeps the audience in at least one of its segments. A group with none removes the audience in any of its segments:
An unknown segment id fails with INVALID_REQUEST. A known segment the product does not offer (including the product’s own segment, or any segment on a product that takes countries only) is refused with UNSUPPORTED_FEATURE. Groups that leave no audience fail with PRODUCT_UNAVAILABLE.

Which products take what

  • Every product takes geo_countries and geo_countries_exclude.
  • Products with no share_of_voice and no collections also take places and segments. On the ad server, that is every product except the homepage takeover. The content platform takes countries only.
  • Each product states this in its overlay_support. Send required_overlay_support to get_products to keep only the products that cover it.

Forecasts and bookings

get_products takes a request-level targeting_overlay and forecasts each product for it, together with filters.countries. A product that cannot serve the overlay is left out of the response, rather than failing the call. An overlay that is malformed fails the whole call with INVALID_REQUEST. create_media_buy applies each package’s overlay to what that package books, delivers and reports, and returns it on the package. A package whose targeting is refused fails the request. update_media_buy does not change targeting. A targeting_overlay on a package change is refused with UNSUPPORTED_FEATURE, naming packages[i].targeting_overlay. To change it, cancel the package and book another.

Move the clock

Every time-dependent behaviour of these tenants reads your sandbox clock. Until you move it, it reads the wall clock. Move it with comply_test_controller:
  • get returns simulated.simulated_now, and pinned: false while the clock still reads the wall clock.
  • start pins the clock at to, an RFC 3339 instant in the past or the future, within ten years of the wall clock. It returns simulated_now, previous_simulated_now, pinned: true, seed_id, season_fingerprint and engine_version, as get and advance_time do (see Versions and the market reset). It takes to only: by is refused with INVALID_PARAMS, as is a missing, malformed or out-of-range to. A start in the future also runs the account-request work that falls due by that instant, as advance_time does. It runs no market days, because a start leaves no market to run.
  • advance_time takes either to (an RFC 3339 instant) or by (an ISO 8601 duration in weeks, days, hours, minutes or seconds). It returns the new simulated_now and days_crossed, the number of UTC days the clock moved across. The tenant you call runs those days at once; the other runs them on your next call to it, with the same results.
  • advance_time only moves the clock forward: an earlier instant is refused with INVALID_TRANSITION. Once the clock is pinned, start is refused too. To start again, reset the sandbox first with reset_state.
  • reset_state on either inventory tenant unpins the clock and discards your buys and win share cuts on both. A reset_state elsewhere that unpins the clock, such as /sales/mcp’s, also leaves your inventory buys and win share cuts behind: a market that has run days the clock has not reached starts fresh.
  • You have one clock per credential. It is the same clock that reporting_subscription_probe advance_time moves on /sales/mcp, so moving it on either tenant moves it for both.

Start on an unused sandbox

start is the only operation that sets the clock to an earlier instant you choose, so it is accepted only while your sandbox is unused. Everything the tenants stamp from the clock would otherwise sit in the future of the new time. All of these must hold:
  • The clock is unpinned.
  • You have recorded no account timezone changes.
  • Every grant on your accounts is untouched: never revoked, reduced or granted again.
  • Neither tenant holds media buys, creatives, seeded products or a win share cut for you.
start removes your untouched grants, which are recreated at the started clock the next time you read your accounts. It also discards an empty market. Otherwise start returns INVALID_TRANSITION with the first reason, such as the clock is already pinned at 2026-12-31T12:00:00.000Z or inventory-adserver holds your media buys, creatives or seeded products, or a win share cut. Reset either inventory tenant with reset_state, then start again. The rule covers the state that inventory reset_state clears. State on /sales/mcp keeps the stamps it already has, such as holds, account requests and reporting subscriptions. The public sandbox credential is one caller for everyone who holds it, so they share one clock. A start on it moves time for all of them, and is accepted only while that sandbox is unused. A typical run:
  1. reset_state.
  2. sandbox_clock start, to the day before the first flight. Buys confirmed that day serve from the flight start.
  3. sync_accounts.
  4. get_products, then create_media_buy.
  5. sandbox_clock advance_time by P1D, as many times as you need.
  6. get_media_buy_delivery.
Use fresh idempotency keys on each run. The idempotency cache runs on the wall clock and survives reset_state, so a rerun with the same keys gets the old replies back and books nothing. Both tenants list sandbox_clock, simulation_truth, win_share_cut, reset_state and the seeds and simulations below in list_scenarios and in compliance_testing.scenarios.

Test controller seeds

A storyboard’s fixtures are seeded through the same controller, so the media-buy storyboards run against these tenants:
  • seed_account provisions an account, exactly as on /sales/mcp.
  • seed_product adds a product to your market on the tenant you call. It is sold on the season’s own placements, so it forecasts, books and delivers like any other product. A video fixture uses the video placements, an audio fixture the audio ones, and anything else display. A season without that channel uses its nearest installment placement instead: the creator series for video, the podcast for audio, the newsletter otherwise. The product shows the fixture’s own name, channels, formats and publisher properties.
  • seed_pricing_option prices a seeded product. A floor_price is the lowest bid an auction booking places, and a fixed_price is a guaranteed booking’s rate. A seeded product with no seeded pricing option is priced like the season’s own products.
Seeded products are private to your credential, like your buys. A credential that never seeds sees only the season’s products. reset_state discards your seeds with the rest of your market.

Simulated delivery

The delivery storyboards inject delivery through the controller. It lands in the simulation as delivery on your sandbox day, so it counts like served delivery:
  • simulate_delivery records the impressions, clicks, conversions and reported_spend you send on the buy’s live packages, shared in proportion to their budgets. It is reported at once, without the reporting delay. Without reported_spend, each package spends what its impressions cost at its rate. is_final, finalized_at and measurement_window mark the buy’s delivery as provisional or final in get_media_buy_delivery, from then on.
  • simulate_budget_spend brings each live package of a buy, or of every buy on an account, to spend_percentage of its budget, with the impressions that spend buys. Spend never goes down.
Both count toward each package’s budget and goal, so the days that follow serve only what is left.

Read the simulation’s truth

simulation_truth returns what your simulated market actually did, for scoring a buyer or checking a forecast against its source. It reads only days that have already run, and never forecasts. It is a comply_test_controller scenario on a sandbox account, never an AdCP read, and it changes nothing, not even the clock.
  • media_buy_ids limits the response to those buys. Without it, it covers all your buys on the tenant. More than 200 packages fails with INVALID_PARAMS; narrow it with media_buy_ids. An unknown id fails with NOT_FOUND.
  • include can list cell_daily_actuals. Without it, the response has no daily data.
  • start_date and end_date (YYYY-MM-DD, both inclusive) bound the daily actuals. Days that have not run yet are left out. The default is the last 92 processed days, and a window is at most 92 days. The 92-day limit applies to the window after it is clamped to processed days. A longer window, a reversed one (start after end), or a malformed or impossible date fails with INVALID_PARAMS.
  • A request on an account that is not a sandbox fails with FORBIDDEN.
The response has:
  • seed_id, season_fingerprint, engine_version, simulated_now and processed_through_date, the last day that ran. processed_through_date is absent until a day has run. seed_id, season_fingerprint and engine_version are the same values sandbox_clock reports in its simulated block, so a score can record which season and engine it ran against.
  • world: the regions with their traffic share, the audience profiles with their share and rate_multipliers, and the segments with their profile_ids.
  • packages: for each package, its package_id, media_buy_id, account_id, product_id, kind, status, impression_goal (guaranteed packages), cpm and the targeting it booked as region and profile ids, with what it delivered. Its cells break delivery down by region, property, placement and audience profile. Each cell has the rates it is drawn around and the delivered_rates the package saw.
  • Delivery you inject with simulate_delivery or simulate_budget_spend has no cell: a package’s delivered impressions are its cells’ served impressions plus its simulated impressions. The other counts match within each day’s rounding, and the cells carry no spend. simulated holds the injected totals (impressions, spend, clicks, viewable_impressions, completed_views and conversions), and is absent until you inject something.
  • With cell_daily_actuals: a cell_index that labels each cell by cell_id, and cell_daily_actuals, one entry per day: [{ "date": "2027-01-01", "actuals": [[cell_id, impressions], ...] }].
The cells are the simulation’s own, so an oracle can compare a forecast, a delivery report or a buyer’s own estimate to the rates that generated them.

Cut what your auction lines win

The win_share_cut controller scenario makes your auction lines win only a fraction of what they would, over a window of days, as if a rival had outbid them. It is a comply_test_controller scenario on a sandbox account, never an AdCP read. Nothing on get_products, get_media_buys, get_media_buy_delivery or get_adcp_capabilities shows a cut. Only simulation_truth reports it.
operation is set or clear; anything else fails with INVALID_PARAMS. A set takes:
  • cut_id: 1 to 64 characters of lowercase letters, digits, _ or -, starting with a letter or digit.
  • win_share: a number from 0 up to, but not including, 1. It is the fraction of its normal wins that an affected line keeps.
  • start_date and end_date (YYYY-MM-DD): the days the cut covers. Both are inclusive whole UTC days, start_date is not after end_date, and the window overlaps the season.
  • placement_ids, property_ids and region_ids, all optional: the cells the cut covers. A cell is covered when it falls inside every list you send, and an omitted list covers every one. An empty list fails with INVALID_PARAMS, and so does an unknown id, which the error names.
A market holds at most 20 cuts.

What a cut does

  • It applies to your auction lines only. After each covered day’s allocation, an affected line keeps win_share of what it won on the cells in scope, rounded down to whole impressions and spread over those cells as the allocation spreads them. Guaranteed lines, the takeover and the sponsorships are unchanged.
  • The impressions it withholds are unsold. No other line picks them up.
  • Cell traffic is unchanged: cell_daily_actuals shows the same impressions with or without a cut.
  • Overlapping cuts compound. In cut_id order, each keeps its share of what the earlier ones left.
  • Forecasts never carry it. get_products forecasts, availability and every dry run read expected traffic, which a cut never changes.
  • An auction line spreads what is left of its budget over the days left in its flight, so a line a cut underdelivers on one day asks for more the next. Its daily ask rises with its shortfall, so a cut that runs to the end of the flight lowers the line’s total by less than the share it cuts, and the line stays behind pace for most of the flight. A cut that ends lets the line catch up.
  • inventory-content sells no auction packages in its shipped season, so a cut there acts only on a non-guaranteed product you seed. On inventory-adserver it acts on ros_display_auction.
  • A cut applies to your market on the tenant you set it on. The other tenant, and other credentials, are unaffected.

Set, retry and clear

  • The tenant runs the days the clock has crossed before it checks a set. start_date must be on or after the sandbox day, the first day that has not run. An earlier one fails with INVALID_TRANSITION, so a cut never changes a day that already ran. A cut has started once its start_date is before the sandbox day.
  • A set with the cut_id of an existing cut and identical params succeeds without changing anything, and returns the stored cut. A set with the same cut_id and other params fails with INVALID_TRANSITION.
  • clear with a cut_id removes that cut. A cut_id that holds no cut succeeds. A cut that has started cannot be cleared: that fails with INVALID_TRANSITION.
  • clear with no cut_id removes every cut, all or nothing. While any cut has started it fails with INVALID_TRANSITION and removes none. With no cuts it succeeds.
  • A request on an account with sandbox: false fails with FORBIDDEN. A missing or mistyped param, a param the operation does not take, a value out of range and a 21st cut fail with INVALID_PARAMS.
A set replies with success, win_share_cut (the stored cut), win_share_cuts (every cut in your market on this tenant, in cut_id order) and a message. A clear replies with success, win_share_cuts (the cuts left) and a message. A failure replies with success: false, error and error_detail.

What simulation_truth reports

When your market holds any cut, the simulation_truth response has a top-level win_share_cuts, in cut_id order. It is absent otherwise. Each cut has its cut_id, win_share, start_date, end_date, the placement_ids, property_ids and region_ids lists you set, sorted and without duplicates, and withheld_impressions: the impressions it has taken from your lines, summed over the days that have run. It is 0 until a covered day takes impressions from a line.

Shared credentials and resets

  • The public sandbox credential is one caller for everyone who holds it. A cut on a shared token changes the market for everyone holding it, as the clock does.
  • reset_state discards your cuts with the rest of your market, as does a market the engine restarts. See Versions and the market reset.
  • sandbox_clock start is refused while a cut exists. See Start on an unused sandbox.

What happens each simulated day

When the clock passes the end of a day, that day runs:
  1. Bookings start. A buy confirmed by the end of day N serves from day N+1, or from its flight start if that is later.
  2. Actual traffic arrives. Each day’s traffic is the expected pattern, times one deviation (the publisher’s same-day deviation, its revisions and the cell deviation, added and clipped together), times a seeded daily variation, times the season’s scripted events and any traffic spikes. An installment’s audience also carries the episode’s audience shock. These deviations are part of the traffic itself, and each forecast knows only some of them. See How forecasts are wrong.
  3. Guarantees are served first. The takeover and the sponsorships take their share. Impression goals are then served by the high-water mark method. Each package’s daily target is what is left of its goal, in proportion to that day’s share of its expected traffic for the remaining days. Expected traffic is the pattern every forecast starts from, so the pace does not follow any forecast’s errors. The package with the least usable supply goes first, and each takes the same share of every impression it can use, never more than its target. A package that falls short catches up over its remaining days in proportion to their expected traffic, and the pace in delivery reports follows the same line.
  4. The auction takes what is left. The highest bid above the floor wins until each package’s daily budget is spent.
  5. Installments run. Each one runs, is postponed or is cancelled, as the season says. One that runs builds its audience over its channel’s curve: newsletter opens over 3 days, podcast listens over 30, video views over 6 weeks.
Delivery is reported once the day has closed and the product’s reporting delay has passed: the next day for the websites, a day later for the podcast and the creator series. A sponsorship package keeps delivering after its flight ends, while its installments’ audience builds.

What a goal is checked against

The impressions available to a guaranteed package with a goal come from a dry run of the days still to come. The dry run plays each day as above on forecast impressions, fractional and with no budget limit, and writes nothing. Takeovers and sponsorships take their share first. Goals are then served in the same order, each paced to expected traffic and drawing on the forecast. The package’s available impressions are the largest goal it could hold such that it delivers as well as it would alone beside the takeovers and sponsorships, and no other guaranteed booking’s undelivered impressions grow by more than half an impression. A package that is paused counts as active, because it can resume. Simulated delivery counts as delivered in the dry run and in every check below, so a goal the controller has met needs no room. Because pacing follows expected traffic while supply follows the forecast, the figure can sit below capacity minus your other goals. A goal that paces to expected traffic takes more than its forecast share on the days the forecast runs below expected and, because a goal never delivers ahead of its pace, the forecast’s extra impressions on days it runs above expected go unsold when they come before the shortfall. get_products and the checks on create_media_buy and update_media_buy read the same figure, so a goal at the forecast’s available is accepted and one more is not. The search stops within 0.05% of the largest goal that fits, so the figure reads at most that far under it. Two other changes are checked the same way, and a refusal leaves the booking as it was:
  • A takeover or sponsorship is refused with PRODUCT_UNAVAILABLE when it would leave another booking short of its goal, and its forecast shows 0 available. The check that the days are not already sold comes first.
  • A flight end that moves on a package with an impression goal, earlier or later, is refused when the package could no longer deliver what is left of its goal, or when the new end would starve another booking. Ending a flight today is refused while its goal is unmet. Cancel the package to stop it. A takeover’s or sponsorship’s end that moves later is checked for the added days only: it is refused when another takeover or sponsorship has sold them, or when it would leave another booking short of its goal. Shortening one is not checked.
The engine version, 3, covers these figures: a change to how they are found changes the version, and a market stored under another version restarts. See Versions and the market reset.

How forecasts are wrong

The forecast errors live in the actual traffic. The simulation draws each day’s traffic with its deviations from the expected pattern already in it, and a forecast is the expected pattern plus whatever part of those deviations was known on the day it was made. A forecast made on a given day:
  • carries the publisher’s bias, as an offset from the expected pattern, and knows the expected pattern, every revision revealed before that day and every past same-day deviation;
  • never knows that day’s own deviation, revisions revealed later, the cell deviation, the daily variation, scripted events or a spike before it starts.
Lead time is how many days separate your sandbox clock from the day forecast. The forecast is built as seen from the sandbox day of your call.
The error, before events, spikes and the daily variation, is b' + (deviation - known part), where b' = -b is the publisher’s bias. It widens with lead time and levels off. The revision part stops growing at lead_time_horizon_days, and the unknown same-day part rises with lead time, from 1 - ar1_phi² of a full deviation’s variance on the day itself toward all of it, at a rate set by ar1_phi. Everything delivery history could reveal about the publisher’s deviation is already in the forecast’s known part, and the part a forecast does not see is independent across days. Delivery history therefore cannot beat the forecast on that part, deviation - known part. The bias is a systematic offset that history can learn. Every dial is a season key, under forecast_error unless noted:
  • Expected pattern. A placement’s base traffic, shaped by weekday, trend_per_day and the month_shape multipliers (twelve values, January first) under traffic. A season can leave out month_shape, which then does not change traffic. Expected traffic is the median of the actual traffic, so the mean sits slightly above it (about 1% at the shipped sizes).
  • Publisher bias. publishers[].bias is how far actual traffic sits from the forecast. Negative means actual comes in below the forecast; the shipped ad server uses -0.02. bias_sigma adds a seeded per-publisher offset with that standard deviation, and error_scale multiplies the publisher’s deviation. A property joins a publisher through its publisher_id, or is its own publisher. Publishers that are not listed have no bias and an error_scale of 1. The forecast carries the bias.
  • Same-day deviation. Each publisher has a seeded deviation for each day, shared across the publisher’s channels, whose neighbouring days are correlated by ar1_phi. channel_sigma sets its size per channel. A forecast knows the deviations of days that have closed, and carries them forward into the days after at the rate ar1_phi allows. It never knows the deviation of the day itself.
  • Revisions. Each day, information about each later day (up to lead_time_horizon_days ahead) is revealed. Each revision is a seeded deviation of size channel_sigma (times error_scale) divided by the square root of lead_time_tau_days: the larger lead_time_tau_days is, the less each revision weighs and the more slowly the error widens with lead time. A forecast knows every revision revealed before its day.
  • Cell deviation. Each cell-day carries a deviation whose size is cell_kappa divided by the square root of the cell’s expected impressions, never counting a cell as smaller than cell_min_impressions. Thin cells deviate more than busy ones. It is independent across cells and days, and no forecast knows it.
  • Daily variation. traffic.truth_daily_sigma is the spread of a seeded day-to-day variation of each placement. It is part of the actual traffic and no forecast knows it.
  • Audience shock. Each installment’s audience is scaled in actual traffic by a seeded shock of size audience_sigma (a collection key), applied across the whole audience curve of the episode. No forecast sees it. It is why content actuals differ from forecasts even though the content tenant’s channel_sigma is 0.
  • The clip. log_clip limits the deviation and the forecast’s known part separately, on a log scale, in both directions. The error therefore never exceeds the unclipped error, and stays within twice the clip. The bias sits outside the clip. The clip does not limit the daily variation, spikes or scripted events.
  • Spikes. A season can script random traffic spikes per publisher under spikes: how many (per_publisher_min to per_publisher_max), how large (size_min to size_max) and how much of the jump is left each day (decay, so a higher value fades more slowly). A negative size is a slump. A forecast made before a spike’s first day does not know it, even for later days. A forecast made on or after that day knows its size and estimates its decay with an error of decay_forecast_sigma. The shipped seasons have none.
Scripted events are in actual traffic only. A forecast never knows an outage, a cancellation or a postponement.

What delivery history can teach

By design, some things can be learned from what has been delivered:
  • An ongoing scripted event, such as an outage that is still running.
  • An episode’s audience shock, after the first days of its audience curve.
  • A started spike’s true decay.
  • The publisher’s bias.
None of these helps with the deviation a forecast cannot see on the day, which is why history cannot beat the forecast on it.

The published range

The published range is the 10th to 90th percentile of the error, to first order and without the clip. It is built per publisher, since publishers’ deviations are independent of each other, and capped at twice the clip. It reflects the same-day deviation and the revisions not yet revealed, the cell deviation, the daily variation, the audience spread of installments and the forecaster’s uncertainty about the decay of spikes that have already started. It excludes the publisher bias, spikes that have not started and scripted events, so actual traffic can land outside it for those reasons. get_products builds low and high on capacity, subtracts your bookings and caps them at what the budget buys.

Forecasts change as you move the clock

Forecasts depend on your sandbox day where a season sets a channel_sigma above 0, as the ad server does. There the same get_products call returns different numbers after you advance the clock: the midpoint of a flight’s forecast moves a little, and the band narrows as the flight gets closer. Each revision is independent of the other revisions and of the forecast already published, so one forecast gives no hint of which way the next will move. The latest forecast holds everything the forecasts made before it did. Nothing is random between calls: the same call at the same simulated time returns the same forecast. The day you set with start is the day your first forecasts are built from, so it sets the lead time between your clock and a flight. Start a day before a flight and its first forecasts have a lead time of one day. Start 30 days before it and they have 30. The content tenant’s channel_sigma is 0, so a cell-day’s forecast does not change with the clock. Only the days left in the flight window and your bookings change. Forecasts differ from delivery through the cell deviation, the daily variation and the audience shocks, none of which depends on lead time. A flight that ended before the clock forecasts zero.

Error sizes are assumptions

The shipped sizes are assumptions and have not been measured: a 6% same-day spread for display and video, 5% cell noise at the median cell on the ad server, and a -2% publisher bias. Change them in the season file. They are to be recalibrated from real publisher data. Book exactly the forecast midpoint on sports_hero_guaranteed, a single-publisher product, for a 30-day flight booked 30 days ahead: it delivers under 90% of the booked amount in 7.6% of flights, about 1 in 13. That is measured as actual traffic against the forecast, so it is a floor for real bookings. Products that span several publishers miss less, because their publishers’ deviations are independent. The engine’s tests pin this rate to 5–11%. That range would catch a doubling of the error sizes (about 15.7%) or a halving (about 0.5%), so changing the shipped sizes needs a deliberate update of the pin. To test how robust your agent is to the sizes, the sweep levels are ×0.5, ×1 and ×2 on channel_sigma and cell_kappa together, and 0, 0.03 and 0.06 on truth_daily_sigma. Run them as season files, each with its own seed_id. These change the actual traffic’s volatility, not only the forecast’s, and since expected traffic is the median of the actual traffic, its mean rises with the sizes (about 1% at the shipped sizes, about 4% at ×2).

Versions and the market reset

Results from these tenants depend on the engine and on the season. sandbox_clock get, start and advance_time report them, inside simulated:
  • engine_version: the version of the engine’s behaviour.
  • seed_id and season_fingerprint: the season’s name, and a hash of every value in it.
Record all three with every result, and compare only results that share them. A stored market restarts, discarding its bookings, seeded products, creatives and win share cuts, when the engine version, the season’s seed_id or the season’s fingerprint changes. Editing a local season file therefore restarts the stored market, even under the same seed_id. Give an edited season its own seed_id to name it. Hosted seasons are fixed. The engine version is 3 and the shipped seasons’ ids are adserver-2027-lead-time and content-2027-lead-time, so a market stored under any other version or id on either tenant restarts once. The guarantee that forecasts reveal none of the actual traffic holds within one timeline. Keep the test controller (the clock and reset_state) away from the agent under test.

The season

The simulation is deterministic: the same calls at the same simulated times always give the same results. The season runs from 2026-11-01 to 2028-10-30 and includes these scripted events: A start before the season’s first day is allowed. The market runs empty days until the season begins, and delivery starts on the season’s first day. A content product lists the installments scheduled in the requested flight, with each one’s status as known at your sandbox time: scheduled, then published, postponed (with the new scheduled_at) or cancelled once its date passes. A sponsorship package buys every installment of its product scheduled in its flight.

A month in five calls

On /inventory-adserver/mcp:
  1. Start the clock before the flight: sandbox_clock start to 2026-12-31T12:00:00Z. If you have used the sandbox before, reset it first with reset_state.
  2. create_media_buy for 2027-01-01 to 2027-01-31 with one package on sports_hero_guaranteed (pricing_option_id sports_hero_guaranteed_cpm, impressions 180000).
  3. create_media_buy for the same flight with one package on preroll_auction (preroll_auction_cpm, bid_price 10). Two buys keep each one’s daily_breakdown separate.
  4. sandbox_clock advance_time by P31D.
  5. get_media_buy_delivery for both buys.
In the daily breakdown, the guarantee drops to under half its usual delivery during the outage and delivers above its earlier pace afterwards. The auction package’s delivery differs from the forecast get_products gave for the same flight.

Run on your own season

The two tenants run on any season you supply as a file, so you can test against your own sites, products and scripted events. Run the training agent on your machine and point a tenant at the file. The environment variables apply to the whole server, so every caller of that server’s inventory tenants gets the file’s season. That makes season files a fit for local and self-hosted runs. The hosted test agent serves its shipped seasons, so a season file never leaves your machine. A season is a YAML or JSON file. Its fields are the SeasonSeed type in engine/types.ts. The starter, server/tests/fixtures/inventory-sim/small-season.yaml, is a complete season for one site with a guaranteed and an auction product. Copy it and edit it. The sketch below shows the shape only. It does not load on its own, because it leaves out required fields: audience_profiles, segments, traffic and forecast_error (with its channel_sigma for every channel a placement uses, ar1_phi, lead_time_tau_days, lead_time_horizon_days, log_clip, cell_kappa and cell_min_impressions), each placement’s name, formats, rates and reporting_lag_days, and each product’s name and description. The starter file is the complete, loadable example.
The loader checks:
  • The shape and value ranges. Reporting lags are whole numbers, 0 or more. Collection cadences and counts are whole numbers, 1 or more. share_of_voice is above 0 and at most 1, and rates are between 0 and 1. Property traffic_multiplier, audience-profile rate multipliers, weekday_shape values and a collection’s audience_sigma are not negative. The currency is an upper-case three-letter code, property domains are lower-case hostnames, floors are not negative, every placement lists at least one format, and the season has at least one placement and one product.
  • A file over 5 MB, or a path that is not a regular file, is refused before it is read.
  • Dates are real calendar dates, every installment of a collection falls inside the season, and so does the date an installment is postponed to.
  • References that the engine leaves unchecked: product properties and collections, and the ids traffic events name.
  • The forecast-error settings, checked together with the references, and listed in full with their paths:
    • Ranges. month_shape has twelve values above 0 and at most 100. channel_sigma values, truth_daily_sigma, bias_sigma and decay_forecast_sigma are from 0 to 5. error_scale is from 0 to 100, and cell_kappa from 0 to 1000. A publisher’s bias is from -5 to 5. ar1_phi and a spike’s decay are at least 0 and below 1. lead_time_tau_days is at least 0.01, and log_clip is above 0. cell_min_impressions is at least 1. A spike’s size_min is above -1 and size_max is at least size_min. per_publisher_min and per_publisher_max are whole numbers, 0 or more, with per_publisher_max at least the minimum, at most the season’s days and at most 100.
    • References. Every channel a placement uses has a channel_sigma, and each publishers[].publisher_id names a publisher that some property resolves to, once.
    • Size. lead_time_horizon_days is a whole number from 0 to 366, and the build stays within a budget: publishers × (days + horizon) × (horizon + 1) is at most 20,000,000 draws. A season at that budget can take a few seconds and on the order of 160 MB to build.
    • Finite traffic. If the build produces expected or actual traffic that is not a finite number, for example from a very large spike size_max, the season is refused, naming the first day and cell.
  • Placement formats are format labels the training agent knows, such as display_300x250 or video_preroll; the error for any other lists them.
  • The engine’s own rules. The season’s days is a whole number from 1 to 1100, and weekday_shape has seven values. Region and audience-profile shares are positive and sum to 1. Event multipliers are not negative. The engine checks the forecast-error settings too. Ids are unique, and the other references resolve: product placements and segments, segment profiles, placement properties and collection placements. Each placement on the display or olv channel has base_daily_impressions (podcast, newsletter and creator-video placements take their audience from their collections instead), and each guaranteed product has rate_cpm.
  • Every product covers some inventory.
The shape, reference (including the forecast-error settings) and coverage checks each list every problem they find. The engine’s own rules report the first problem only. Set one environment variable per tenant: A tenant whose variable is unset or empty serves its shipped season. A tenant whose variable is set serves the file, and logs one line naming it. If the file is missing or invalid, the server refuses to start. The error names the variable and the path. Editing a season file restarts the stored market on that tenant, because the season’s fingerprint changes. Give an edited season its own seed_id to name it. The server needs PostgreSQL. Start the one in docker-compose.yml, create the schema the migrations expect, then start the server from the repository root. The one-line create schema is enough for a throwaway local database. The local bootstrap in the runbook has the full setup.
The WorkOS values are placeholders that only satisfy the server’s start-up checks. FLY_PROCESS_GROUP=web starts the server without its background crawlers and scheduled jobs, which would otherwise reach external hosts. The tenants are at http://localhost:3917/api/training-agent/inventory-adserver/mcp and .../inventory-content/mcp, and local-token is their bearer token. The log shows inventory-adserver: season small-season from server/tests/fixtures/inventory-sim/small-season.yaml. To start from a shipped season instead of the starter, print one as YAML. The content season, for example, has collections the starter lacks:
To use the library directly, traffic.day(d) returns expected and actual tables. ForecastResult.sigma is the standard deviation of the forecast error on a log scale. Its low and high are built on capacity, net of bookings, and capped at what the budget buys. Bookings here is booked, which is capacity minus available, so it counts the unsold slack described in What a goal is checked against and can exceed the goals it nets. A forecast’s clicks and conversions use the expected rates. To use a season without a server, read it with readSeasonFile from server/src/training-agent/inventory-sim/season-file.ts, and pass the result to InventorySimulation.create(seed, nowMs), where nowMs is the start instant, from server/src/training-agent/inventory-sim/engine/. The engine behind these tenants lives in server/src/training-agent/inventory-sim/engine/ and has no dependencies on the rest of the test agent, so it can move into @adcp/sdk if that proves useful.