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.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_productsreturns each product with aforecastfor the flight infilters.start_dateandfilters.end_date(30 days from now when omitted).targeting_overlayandfilters.countriesnarrow the forecast, and a product with no inventory under them is left out. See Targeting.filters.delivery_typeandfilters.channelsfilter the products. Bothbriefandwholesalebuying modes are served, so a storefront can read either tenant as a wholesale catalogue.create_media_buybooks each package:- Guaranteed packages take
impressionsas 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 withPRODUCT_UNAVAILABLE. The error names the goal and what is available. It is never capped. That figure is themidimpressions of aget_productsforecast for the same flight and countries, requested with your account and withoutbudget_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_UNAVAILABLEuntil 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_overlaynarrows a package by country, place or segment. See Targeting.- A package’s
creatives(uploaded inline) andcreative_assignments(from your library) are assigned to it.
- Guaranteed packages take
update_media_buypauses, resumes and cancels a buy or a package, and changes a package’sbudget,impressionsorbid_price, or the buy’send_time. Raisingimpressionsis 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’screativesorcreative_assignmentsreplace its assignments.get_media_buysandget_media_buy_deliveryreport what was booked and what was delivered. They includeby_package,daily_breakdownandpacing_indexfor guaranteed packages. Inget_media_buys, each package lists itscreative_approvals.sync_creatives,list_creativesandlist_creative_formatsmanage the creatives you traffic your buys with. See Creatives.
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 withsync_creatives, or upload them inline on a package, and assign them to the packages you have bought.
- Formats.
list_creative_formatsreturns 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, withformat_kindand theparamsof one of the product’sformat_options(or itsformat_option_ref); the size of the creative’s image or video picks the format whenparamsis omitted. A namedformat_idcopied fromformat_optionsalso works. A request whose format still matches more than one option is refused, naming them. A product you seed also serves theformat_optionsits fixture declares; name one with itsformat_option_ref. A creative in a seeded option is held to the values that option declares: actaoutside itscta_valuesis refused withCREATIVE_VALUE_NOT_ALLOWED. A creative can only be assigned to a package whose product serves its format. Otherwise the request fails withFORMAT_NOT_SUPPORTED. - Assignments.
assignment_operationssupportsassign,unassignandreplace. A request’s operations apply together or not at all. The deprecatedassignmentsfield still works, and reports each failed assignment in the creative’sassignment_errors. Merges, assignment-level trackers and landing pages, installment scoping and placement routing are rejected withUNSUPPORTED_FEATURE. - Review and delivery. Every creative is approved as soon as it arrives. A buy reports
pending_creativeswhile none of its live packages has a creative, thenpending_startoractiveas 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_stateclears them with the rest of your market.
Targeting
A package’stargeting_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
systemis the server’sTRAINING_AGENT_INVENTORY_PLACE_SYSTEMsetting,https://adcontextprotocol.org/training-agent/placesby default. Theplace_typeis the system followed by/types/sales-region. - The
valuesare region ids. A region in a different country from the entry’scountryfails withINVALID_REQUEST. - The catalogue is at version
"1". Asystem_versionother than"1"fails withINVALID_REQUEST. Packages echo it as"1"when you leave it out. - A different
system,place_typeor country is refused withUNSUPPORTED_FEATURE. - Countries and places combine: a package takes the regions in both its countries and its places, less its exclusions.
get_adcp_capabilities, with a resolver. The resolver is a public GET that needs no authentication:
- Send
countryand exactly one ofq(a case-insensitive match on a region’s name or id) orvalue(an exact region id). subdivision,place_type,system_versionandlimit(1 to 100, default 20) are optional. Matches come back in one page.- It returns
system,system_version, the echoedrequestandmatches. Each match hasvalue,country,place_type,label,canonical_name,parent_labelsandstatus. - A bad query returns
400with{ "error": "..." }.
Segments
A segment is a signal that belongs to a product: asignal_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:
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_countriesandgeo_countries_exclude. - Products with no
share_of_voiceand 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. Sendrequired_overlay_supporttoget_productsto 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 withcomply_test_controller:
getreturnssimulated.simulated_now, andpinned: falsewhile the clock still reads the wall clock.startpins the clock atto, an RFC 3339 instant in the past or the future, within ten years of the wall clock. It returnssimulated_now,previous_simulated_now,pinned: true,seed_id,season_fingerprintandengine_version, asgetandadvance_timedo (see Versions and the market reset). It takestoonly:byis refused withINVALID_PARAMS, as is a missing, malformed or out-of-rangeto. A start in the future also runs the account-request work that falls due by that instant, asadvance_timedoes. It runs no market days, because a start leaves no market to run.advance_timetakes eitherto(an RFC 3339 instant) orby(an ISO 8601 duration in weeks, days, hours, minutes or seconds). It returns the newsimulated_nowanddays_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_timeonly moves the clock forward: an earlier instant is refused withINVALID_TRANSITION. Once the clock is pinned,startis refused too. To start again, reset the sandbox first withreset_state.reset_stateon either inventory tenant unpins the clock and discards your buys and win share cuts on both. Areset_stateelsewhere 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_probeadvance_timemoves 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:
reset_state.sandbox_clockstart, to the day before the first flight. Buys confirmed that day serve from the flight start.sync_accounts.get_products, thencreate_media_buy.sandbox_clockadvance_timebyP1D, as many times as you need.get_media_buy_delivery.
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_accountprovisions an account, exactly as on/sales/mcp.seed_productadds 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_optionprices a seeded product. Afloor_priceis the lowest bid an auction booking places, and afixed_priceis a guaranteed booking’s rate. A seeded product with no seeded pricing option is priced like the season’s own 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_deliveryrecords theimpressions,clicks,conversionsandreported_spendyou send on the buy’s live packages, shared in proportion to their budgets. It is reported at once, without the reporting delay. Withoutreported_spend, each package spends what its impressions cost at its rate.is_final,finalized_atandmeasurement_windowmark the buy’s delivery as provisional or final inget_media_buy_delivery, from then on.simulate_budget_spendbrings each live package of a buy, or of every buy on an account, tospend_percentageof its budget, with the impressions that spend buys. Spend never goes down.
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_idslimits the response to those buys. Without it, it covers all your buys on the tenant. More than 200 packages fails withINVALID_PARAMS; narrow it withmedia_buy_ids. An unknown id fails withNOT_FOUND.includecan listcell_daily_actuals. Without it, the response has no daily data.start_dateandend_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 withINVALID_PARAMS.- A request on an account that is not a sandbox fails with
FORBIDDEN.
seed_id,season_fingerprint,engine_version,simulated_nowandprocessed_through_date, the last day that ran.processed_through_dateis absent until a day has run.seed_id,season_fingerprintandengine_versionare the same valuessandbox_clockreports in itssimulatedblock, so a score can record which season and engine it ran against.world: theregionswith their trafficshare, the audience profiles with theirshareandrate_multipliers, and thesegmentswith theirprofile_ids.packages: for each package, itspackage_id,media_buy_id,account_id,product_id,kind,status,impression_goal(guaranteed packages),cpmand thetargetingit booked as region and profile ids, with what itdelivered. Itscellsbreak delivery down by region, property, placement and audience profile. Each cell has theratesit is drawn around and thedelivered_ratesthe package saw.- Delivery you inject with
simulate_deliveryorsimulate_budget_spendhas no cell: a package’sdeliveredimpressions are its cells’ served impressions plus itssimulatedimpressions. The other counts match within each day’s rounding, and the cells carry no spend.simulatedholds the injected totals (impressions,spend,clicks,viewable_impressions,completed_viewsandconversions), and is absent until you inject something. - With
cell_daily_actuals: acell_indexthat labels each cell bycell_id, andcell_daily_actuals, one entry per day:[{ "date": "2027-01-01", "actuals": [[cell_id, impressions], ...] }].
Cut what your auction lines win
Thewin_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_dateandend_date(YYYY-MM-DD): the days the cut covers. Both are inclusive whole UTC days,start_dateis not afterend_date, and the window overlaps the season.placement_ids,property_idsandregion_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 withINVALID_PARAMS, and so does an unknown id, which the error names.
What a cut does
- It applies to your auction lines only. After each covered day’s allocation, an affected line keeps
win_shareof 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_actualsshows the same impressions with or without a cut. - Overlapping cuts compound. In
cut_idorder, each keeps its share of what the earlier ones left. - Forecasts never carry it.
get_productsforecasts, 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-contentsells no auction packages in its shipped season, so a cut there acts only on a non-guaranteed product you seed. Oninventory-adserverit acts onros_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_datemust be on or after the sandbox day, the first day that has not run. An earlier one fails withINVALID_TRANSITION, so a cut never changes a day that already ran. A cut has started once itsstart_dateis before the sandbox day. - A
setwith thecut_idof an existing cut and identical params succeeds without changing anything, and returns the stored cut. Asetwith the samecut_idand other params fails withINVALID_TRANSITION. clearwith acut_idremoves that cut. Acut_idthat holds no cut succeeds. A cut that has started cannot be cleared: that fails withINVALID_TRANSITION.clearwith nocut_idremoves every cut, all or nothing. While any cut has started it fails withINVALID_TRANSITIONand removes none. With no cuts it succeeds.- A request on an account with
sandbox: falsefails withFORBIDDEN. A missing or mistyped param, a param the operation does not take, a value out of range and a 21st cut fail withINVALID_PARAMS.
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_statediscards your cuts with the rest of your market, as does a market the engine restarts. See Versions and the market reset.sandbox_clockstartis 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:- 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.
- 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.
- 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.
- The auction takes what is left. The highest bid above the floor wins until each package’s daily budget is spent.
- 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.
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_UNAVAILABLEwhen 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.
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.
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_dayand themonth_shapemultipliers (twelve values, January first) undertraffic. A season can leave outmonth_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[].biasis how far actual traffic sits from the forecast. Negative means actual comes in below the forecast; the shipped ad server uses -0.02.bias_sigmaadds a seeded per-publisher offset with that standard deviation, anderror_scalemultiplies the publisher’s deviation. A property joins a publisher through itspublisher_id, or is its own publisher. Publishers that are not listed have no bias and anerror_scaleof 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_sigmasets its size per channel. A forecast knows the deviations of days that have closed, and carries them forward into the days after at the ratear1_phiallows. It never knows the deviation of the day itself. - Revisions. Each day, information about each later day (up to
lead_time_horizon_daysahead) is revealed. Each revision is a seeded deviation of sizechannel_sigma(timeserror_scale) divided by the square root oflead_time_tau_days: the largerlead_time_tau_daysis, 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_kappadivided by the square root of the cell’s expected impressions, never counting a cell as smaller thancell_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_sigmais 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’schannel_sigmais 0. - The clip.
log_cliplimits 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_mintoper_publisher_max), how large (size_mintosize_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 ofdecay_forecast_sigma. The shipped seasons have none.
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.
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 achannel_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_idandseason_fingerprint: the season’s name, and a hash of every value in it.
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:
- Start the clock before the flight:
sandbox_clockstartto2026-12-31T12:00:00Z. If you have used the sandbox before, reset it first withreset_state. create_media_buyfor 2027-01-01 to 2027-01-31 with one package onsports_hero_guaranteed(pricing_option_idsports_hero_guaranteed_cpm,impressions180000).create_media_buyfor the same flight with one package onpreroll_auction(preroll_auction_cpm,bid_price10). Two buys keep each one’sdaily_breakdownseparate.sandbox_clockadvance_timebyP31D.get_media_buy_deliveryfor both buys.
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 theSeasonSeed 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 shape and value ranges. Reporting lags are whole numbers, 0 or more. Collection cadences and counts are whole numbers, 1 or more.
share_of_voiceis above 0 and at most 1, and rates are between 0 and 1. Propertytraffic_multiplier, audience-profile rate multipliers,weekday_shapevalues and a collection’saudience_sigmaare 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_shapehas twelve values above 0 and at most 100.channel_sigmavalues,truth_daily_sigma,bias_sigmaanddecay_forecast_sigmaare from 0 to 5.error_scaleis from 0 to 100, andcell_kappafrom 0 to 1000. A publisher’sbiasis from -5 to 5.ar1_phiand a spike’sdecayare at least 0 and below 1.lead_time_tau_daysis at least 0.01, andlog_clipis above 0.cell_min_impressionsis at least 1. A spike’ssize_minis above -1 andsize_maxis at leastsize_min.per_publisher_minandper_publisher_maxare whole numbers, 0 or more, withper_publisher_maxat least the minimum, at most the season’sdaysand at most 100. - References. Every channel a placement uses has a
channel_sigma, and eachpublishers[].publisher_idnames a publisher that some property resolves to, once. - Size.
lead_time_horizon_daysis 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.
- Ranges.
- Placement
formatsare format labels the training agent knows, such asdisplay_300x250orvideo_preroll; the error for any other lists them. - The engine’s own rules. The season’s
daysis a whole number from 1 to 1100, andweekday_shapehas 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 thedisplayorolvchannel hasbase_daily_impressions(podcast, newsletter and creator-video placements take their audience from their collections instead), and each guaranteed product hasrate_cpm. - Every product covers some inventory.
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.
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:
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.