Returns the AdCP protocol version this client is configured to speak.
Defaults to ADCP_VERSION (the GA version the SDK ships against)
unless overridden via new SingleAgentClient(agent, { adcpVersion }).
Plumbing surface — Stage 2 of the multi-version refactor exposes the configured value but does not yet vary validator/schema selection by version. Wire-shape adapters key off this method in subsequent stages.
Observe a persisted seller task using the continuation polling path. Does not submit work or emit protocol_request/protocol_response activity for each poll. Terminal status_change activity carries operation_id and server_task_id. Results use the seller's original tool response shape. Persist the returned operationId if none was supplied. Polling handles are local to this client; matching identities can reattach to existing work. Local observation failures do not publish seller terminal lifecycle events.
Execute the typed AdCP get_task_status tool, including its result and error fields.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsPoll one task and map its status to TaskInfo. Preserved for existing callers.
Optionaltransport: TransportOptionsOptionalsignal: AbortSignalOptionalwireOptions: { wireAdcpVersion?: string; versionEnvelope?: VersionEnvelopeMode }Recover the current generation of an opt-in direct mutation pause.
Handle webhook from agent (async task status updates and completions)
Accepts webhook payloads from both MCP and A2A protocols:
The method normalizes both formats so handlers receive the unwrapped
AdCP response data (AdCPAsyncResponseData), not the raw protocol structure.
Registered callbacks require trusted HTTP method and public-URL context;
use createWebhookHandler() or verifyAndParseWebhook() for those flows.
Protocol-specific webhook payload (MCPWebhookPayload | Task | TaskStatusUpdateEvent)
Task type (e.g create_media_buy) from url param or url part of the webhook delivery
Operation id (e.g used for client app to track the operation) from the param or url part of the webhook delivery
Optionalsignature: WebhookHeaderValue
X-ADCP-Signature header (format: "sha256=...")
Optionaltimestamp: WebhookHeaderValue
X-ADCP-Timestamp header (Unix timestamp)
OptionalrawBody: string | Uint8Array<ArrayBufferLike> | Buffer<ArrayBufferLike>OptionalrequestContext: WebhookRequestContext
Trusted method and public URL. Required for registered callbacks.
Whether webhook was handled successfully
app.post(
'/webhook/:task_type/:operation_id',
express.raw({ type: 'application/json' }),
client.createWebhookHandler({
getRequestUrl: req => `https://buyer.example${req.originalUrl}`,
}),
);
createWebhookHandler() preserves the SDK's typed HTTP mapping: authentication
failures return 401, invalid/conflicting deliveries return 400/409, rate abuse
returns 429, and transient verification, storage, or publication failures return
503 for seller retry. Do not map every handleWebhook() exception to 401.
Verify and normalize an inbound webhook without dispatching handlers.
This is the lower-level receiver primitive for integrations that need to
map malformed webhooks to precise HTTP responses. It verifies the mode
selected by the trusted outbound registration (RFC 9421 by default, or
legacy HMAC when webhookSecret was used), parses raw JSON bodies,
validates the transport envelope shape, and returns the canonicalized
AdCP result plus routing metadata. Legacy wire inspection is intentionally
confined to the transport adapter and is not returned by this primary API.
Every registered callback must include its trusted HTTP method and externally
visible absolute request URL so the persisted callback target is enforced.
Generate webhook URL using macro substitution
Type of task (e.g., 'get_products', 'media_buy_delivery')
Operation ID for this request
Full webhook URL with macros replaced
// With template: "https://myapp.com/webhook/{task_type}/{agent_id}/{operation_id}"
const webhookUrl = client.getWebhookUrl('sync_creatives', 'op_123');
// Returns: https://myapp.com/webhook/sync_creatives/agent_x/op_123
// With template: "https://myapp.com/webhook?agent={agent_id}&op={operation_id}"
const webhookUrl = client.getWebhookUrl('sync_creatives', 'op_123');
// Returns: https://myapp.com/webhook?agent=agent_x&op=op_123
Create an HTTP webhook handler that automatically verifies signatures
This helper creates a standard HTTP handler (Express/Next.js/etc.) that:
HTTP handler function compatible with Express-style adapters.
const client = new SingleAgentClient(agent, {
webhookUrlTemplate: 'https://buyer.example/webhook/{task_type}/{operation_id}',
handlers: {
onSyncCreativesStatusChange: async (result) => {
console.log('Creative synced:', result);
}
}
});
app.post(
'/webhook/:task_type/:operation_id',
express.raw({ type: 'application/json' }),
client.createWebhookHandler({
getRequestUrl: req => `https://buyer.example${req.originalUrl}`,
}),
);
Verify webhook signature using HMAC-SHA256 per AdCP spec.
HMAC is computed over the raw HTTP body bytes — the exact bytes received on the wire, before JSON parsing. This ensures cross-language interop since different JSON serializers may produce different byte representations of the same logical payload.
For backward compatibility, a parsed object is still accepted but will be re-serialized with JSON.stringify, which may not match the sender's bytes. Always prefer passing the raw body string.
Signature format: sha256={hex_signature} Message format: {timestamp}.{raw_body}
Raw HTTP body string (preferred) or parsed payload object (deprecated)
X-ADCP-Signature header value (format: "sha256=...")
X-ADCP-Timestamp header value (Unix timestamp)
true if signature is valid
Discover available advertising products
brand is optional when catalog is absent, including for the brief-only
request below. Requests with catalog must include brand; otherwise,
include it whenever discovery should account for a specific advertiser.
Product discovery parameters
OptionalinputHandler: InputHandler
Handler for clarification requests
Optionaloptions: CanonicalReadTaskOptions
Task execution options
Discover products through the compact AdCP 3.2 catalog task.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsExperimental
Read the seller's collection catalog using AdCP 3.3.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsExperimental
Read proposals in an authorized account using AdCP 3.3.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsOptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsList a legacy named-format catalog for migration tooling.
Format listing parameters
OptionalinputHandler: InputHandler
Handler for clarification requests
Optionaloptions: TaskOptions
Task execution options
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsCreate a new media buy
Media buy creation parameters
OptionalinputHandler: InputHandler
Handler for clarification requests
Optionaloptions: CreativeDeliveryTaskOptions
Task execution options
OptionalinputHandler: InputHandlerOptionaloptions: CreativeDeliveryTaskOptionsUpdate an existing media buy
Media buy update parameters
OptionalinputHandler: InputHandler
Handler for clarification requests
Optionaloptions: CreativeDeliveryTaskOptions
Task execution options
OptionalinputHandler: InputHandlerOptionaloptions: CreativeDeliveryTaskOptionsSync creative assets
Creative sync parameters
OptionalinputHandler: InputHandler
Handler for clarification requests
Optionaloptions: SyncCreativesTaskOptions
Task execution options
OptionalinputHandler: InputHandlerOptionaloptions: SyncCreativesTaskOptionsResolve the creative wire mode used by the canonical write methods without sending a mutation. Discovers capabilities and the current tool's input schema, or reuses fresh cached/primed evidence, with this client's wire pin.
This context-free check returns unknown when capabilities and schema do
not establish support. A write to a proven 3.1 seller can still select
canonical delivery from matching seller-advertised product options;
otherwise projection requires an unambiguous legacy reference.
Conflicting evidence and unproven support with a 3.2+ buyer pin throw
CreativeFormatCapabilityError, just as they do during a write.
Optionaloptions: ReadRequestOptionsList creatives through the canonical SDK boundary.
Legacy format filters are rejected and returned creative identities are
projected to format_kind / format_option_ref. Migration tooling that
needs the negotiated raw wire shape must call listCreativesLegacy().
Creative listing parameters
OptionalinputHandler: InputHandler
Handler for clarification requests
Optionaloptions: CanonicalReadTaskOptions
Task execution options
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsPreview a creative using canonical capability or creative-library identity.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsOptionaladcp_version?: stringRelease-precision AdCP version (VERSION.RELEASE, e.g. "3.0", "3.1", "3.1-beta"). On a request: the buyer's release pin — the seller validates against its supported_versions and returns VERSION_UNSUPPORTED on cross-major mismatch, or downshifts to the highest supported release within the same major. On a response: the release the seller actually served — clients SHOULD validate the response against that release's schema, not against their pin. Patches are not negotiated; surface them as build_version on capabilities for operational visibility. When omitted, falls back to adcp_major_version (deprecated) or server default. Buyers SHOULD emit both adcp_version and adcp_major_version through 3.x to remain compatible with sellers that only read the legacy field. NORMALIZATION: SDKs that read full-semver values from bundle metadata (e.g. ComplianceIndex.published_version = "3.1.0-beta.1") MUST normalize to release-precision ("3.1-beta.1") before emitting on the wire — meta-field values are NOT valid wire values.
Optionaladcp_major_version?: numberDEPRECATED in favor of adcp_version (release-precision string). Servers MUST continue to honor this field through 3.x. Removed in 4.0. Original semantics: the AdCP major version the buyer's payloads conform to. Sellers validate against their supported major_versions and return VERSION_UNSUPPORTED if unsupported. When omitted, the seller assumes its highest supported version.
Preview mode. 'single' previews one creative manifest. 'batch' previews multiple creatives in one call. 'variant' replays a post-flight variant by ID.
Optionalcreative_manifest?: LegacyCreativeManifestOptionaltarget_capability_id?: stringCanonical preview-operation selector. Identifies one get_adcp_capabilities creative.supported_formats[].capability_id entry whose operations contains preview. In single mode it selects the renderer for this request; in batch mode it is the default for items that omit their own target_capability_id. When omitted, the agent MAY resolve the renderer only if exactly one advertised preview capability satisfies the manifest's canonical declaration; zero matches or multiple matches MUST be rejected with FORMAT_NOT_SUPPORTED rather than choosing nondeterministically. Mutually exclusive with deprecated format_id.
Optionalformat_id?: LegacyFormatReferenceStructuredObjectOptionalinputs?: {Array of input sets for generating multiple preview variants. Each input set defines macros and context values for one preview rendering. Used in single mode.
Optionaltemplate_id?: stringSpecific template ID for custom format rendering. Used in single mode.
Optionalquality?: CreativeQualityOptionaloutput_format?: PreviewOutputFormatOptionalitem_limit?: numberMaximum number of catalog items to render per preview variant. Used in single mode. Creative agents SHOULD default to a reasonable sample when omitted and the catalog is large.
Optionalrequests?: {Array of preview requests (1-50 items). Required when request_type is 'batch'. Each item follows the single request structure.
Optionalvariant_id?: stringAgent-assigned AdCP served-execution identifier from get_creative_delivery. Required when request_type is 'variant'. It is agent-unique when the source agent advertises creative.supports_revisions; for legacy agents the published scope remains agent plus creative, and callers SHOULD also send creative_id to disambiguate reused values.
Optionalcreative_id?: stringCreative-library identifier. In single mode, previews the stored canonical creative without requiring the caller to reconstruct its manifest. Also available as context in variant mode.
Optionalallow_async?: booleanOpt in to an asynchronous preview response. When true, the creative agent MAY return status 'submitted' with a task_id only when rendering has been handed to a queue or external renderer and will continue after the request connection is released. Active processing on an open connection uses working progress instead. The buyer polls get_task_status for completion. When false or absent, the agent MUST return a synchronous preview response or a terminal protocol error; it MUST NOT return the submitted shape. This field applies to preview_creative only; build_creative already defines its own async lifecycle.
Optionalpush_notification_config?: PushNotificationConfigOptionalcontext?: ContextObjectOptionalext?: ExtensionObjectOptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsGet media buy status, creative approvals, and optional delivery snapshots
Request parameters
OptionalinputHandler: InputHandler
Handler for clarification requests
Optionaloptions: CanonicalReadTaskOptions
Task execution options
Get media buy delivery information
Delivery information parameters
OptionalinputHandler: InputHandler
Handler for clarification requests
Optionaloptions: CanonicalReadTaskOptions
Task execution options
Retrieve canonical creative-level and variant-level delivery metrics.
OptionalinputHandler: InputHandlerOptionaloptions: CanonicalReadTaskOptionsProvide performance feedback
Performance feedback parameters
OptionalinputHandler: InputHandler
Handler for clarification requests
Optionaloptions: TaskOptions
Task execution options
Get audience signals
Signals request parameters
OptionalinputHandler: InputHandler
Handler for clarification requests
Optionaloptions: TaskOptions
Task execution options
Activate audience signals
Signal activation parameters
OptionalinputHandler: InputHandler
Handler for clarification requests
Optionaloptions: TaskOptions
Task execution options
Sync campaign plans to a governance agent. Plans define authorized parameters: budget, channels, flight dates, markets, policies, delegations.
Uses the governance agent from config.governance.campaign.agent by default. Pass an explicit agent via options.agent to override.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptions & { agent?: AgentConfig }Get governance audit logs for one or more plans. Returns budget state, channel allocation, per-campaign breakdown, and audit trail.
Uses the governance agent from config.governance.campaign.agent by default. Pass an explicit agent via options.agent to override.
Optionaloptions: TaskOptions & { agent?: AgentConfig }Get governance audit logs for one or more plans. Returns budget state, channel allocation, per-campaign breakdown, and audit trail.
Uses the governance agent from config.governance.campaign.agent by default. Pass an explicit agent via options.agent to override.
Optionaloptions: TaskOptions & { agent?: AgentConfig }Report a governance outcome for an async task that has resolved.
Use this when a task returned status 'submitted' or 'working' and
later resolves via polling or webhooks. The checkId is available
on the original TaskResult at result.governance.checkId. After a
TaskTimeoutError during governance postflight, pass the error's
governanceRecovery.outcomeIdempotencyKey in options to safely retry.
OptionalgovernanceContext: stringOptionalsellerResponse: Record<string, unknown>Optionalerror: { code?: string; message: string }Optionaloptions: { outcomeIdempotencyKey?: string; signal?: AbortSignal }Accept a committed proposal to create or amend a media buy, or apply a negotiated cancellation.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsExecute the AdCP acquire_rights tool.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsGenerate, transform, refine, retrieve, or adapt creative manifests for advertised creative capabilities.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsCreate a media buy directly from published seller products and record its accepted commercial snapshot.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsExecute the AdCP calibrate_content tool.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsExecute the AdCP check_governance tool.
Optionaladcp_version?: stringRelease-precision AdCP version (VERSION.RELEASE, e.g. "3.0", "3.1", "3.1-beta"). On a request: the buyer's release pin — the seller validates against its supported_versions and returns VERSION_UNSUPPORTED on cross-major mismatch, or downshifts to the highest supported release within the same major. On a response: the release the seller actually served — clients SHOULD validate the response against that release's schema, not against their pin. Patches are not negotiated; surface them as build_version on capabilities for operational visibility. When omitted, falls back to adcp_major_version (deprecated) or server default. Buyers SHOULD emit both adcp_version and adcp_major_version through 3.x to remain compatible with sellers that only read the legacy field. NORMALIZATION: SDKs that read full-semver values from bundle metadata (e.g. ComplianceIndex.published_version = "3.1.0-beta.1") MUST normalize to release-precision ("3.1-beta.1") before emitting on the wire — meta-field values are NOT valid wire values.
Optionaladcp_major_version?: numberDEPRECATED in favor of adcp_version (release-precision string). Servers MUST continue to honor this field through 3.x. Removed in 4.0. Original semantics: the AdCP major version the buyer's payloads conform to. Sellers validate against their supported major_versions and return VERSION_UNSUPPORTED if unsupported. When omitted, the seller assumes its highest supported version.
Optionalplan_id?: stringCampaign governance plan identifier. Required on the initial intent or availability check, before a governance_context exists. Optional on subsequent checks: the governance agent derives the plan from its own signed governance_context. If both are present, the governance agent MUST reject the request when plan_id does not match the token's plan binding. Services MUST treat governance_context as authoritative and MUST NOT require a buyer to disclose plan_id. A plan is owned by the authenticated buyer principal that synchronized it; plan_id is an identifier, not an account credential.
Claimed URL of the agent making the request. The transport credential MUST resolve to an agent URL; the governance agent requires an exact match and uses only that resolved URL for authorization, audit, and signed context issuance. On intent checks the authenticated buyer must be the plan owner or hold an active delegation, while approved_sellers is evaluated against the target service that becomes the token audience. On execution checks the authenticated caller MUST equal that preserved audience. An unresolved body assertion never grants plan access or authorization.
Optionalpurchase_type?: PurchaseTypeOptionalbudget_period_id?: stringOptional assertion of the plan budget period (plans[].budget.periods[].budget_period_id) this action belongs to. The buyer never has to name a period: the governance agent derives it from the action's flight. When present and different from the derived period, the check is denied. When the plan has no periods, or the action carries no flight, there is no derived period and the assertion cannot match, so the check is denied. The response carries the matched budget_period_id either way.
Optionaltarget_agent?: stringExact agent URL of the downstream service that will receive the governed task. Required on intent checks and copied byte-for-byte into the signed governance_context aud claim. This routing and authorization field is not part of payload: payload remains exactly the downstream task arguments. A consultation re-check MUST use the same target_agent.
Optionalproposed_commitment?: { amount: number; currency: string }Task-neutral monetary amount the intent would authorize. For update_media_buy and control_media_buy this is the buyer-computed positive incremental commitment, not the post-update total. For accept_proposal it is derived from the supplied proposal commercial_terms; for buy_products it is derived from the purchase payload. Amount 0 explicitly represents a verified no-cost action. The governance agent persists this value as authoritative check state.
Optionalexecution_commitment?: { amount: number; currency: string }Seller-computed positive incremental commitment for a MediaBuy execution check. The seller MUST derive this atomically from its authoritative proposal or current revision and the requested operation, and the governance agent MUST reject it when it exceeds the prior intent ceiling or uses another currency.
Optionaltool?: stringThe AdCP tool being checked (e.g., 'create_media_buy', 'acquire_rights', 'activate_signal'). Present on intent checks (orchestrator). The governance agent uses the presence of tool+payload to identify an intent check.
Optionalpayload?: {}The full downstream tool arguments exactly as they will be sent to target_agent. Present on intent checks. Governance routing metadata is carried by target_agent, never injected into this object. The governance agent can inspect any field to validate against the plan.
Optionalproposal?: CanonicalProposalOptionalgovernance_context?: stringOpaque authorization context from a prior approved check_governance response. Services pass it verbatim on execution and lifecycle checks; the issuing governance agent derives the plan and prior decision from the token. Intermediaries MUST NOT parse it for business logic. Governance agents MUST emit a compact JWS per the AdCP JWS profile.
Optionalconsultation_context?: stringOpaque, non-authorizing handle returned with an intent conditions verdict. Pass it only when re-checking the adjusted intent so the governance agent can correlate negotiation attempts. The governance agent MUST resolve it under the authenticated principal and reject the re-check unless principal, caller, plan_id, tool, purchase_type, and target audience match the original conditions check. Services MUST NOT receive or accept this value as authorization.
Optionalphase?: GovernancePhaseOptionalplanned_delivery?: {Optionalmedia_buy_id?: stringSeller-assigned media buy identifier. Optional on a purchase-phase prepare/check because the service may not assign the identifier until commit; required on modification and delivery lifecycle checks.
Optionalproposal_id?: stringProposal snapshot being executed or currently governing the MediaBuy.
Optionalproposal_terms_digest?: stringDigest of the proposal commercial_terms. The governance agent compares it to the digest bound during the intent check.
Optionalgeo?: { countries?: string[]; regions?: string[] }Geographic targeting the seller will apply.
Optionalcountries?: string[]ISO 3166-1 alpha-2 country codes where ads will deliver.
Optionalregions?: string[]ISO 3166-2 subdivision codes where ads will deliver.
Optionalchannels?: MediaChannel[]Channels the seller will deliver on.
Optionalstart_time?: stringActual flight start the seller will use.
Optionalend_time?: stringActual flight end the seller will use.
Optionalfrequency_cap?: {Optionalsuppress?: DurationCooldown period between consecutive exposures to the same entity. Prevents back-to-back ad delivery (e.g. {"interval": 60, "unit": "minutes"} for a 1-hour cooldown). Preferred over suppress_minutes.
Optionalsuppress_minutes?: numberOptionalmax_impressions?: numberMaximum number of impressions per entity per window. For duration windows, implementations typically use a rolling window. campaign applies across the owning field's full flight: the package flight for a targeting overlay, or the MediaBuy flight for a root cap.
Optionalper?: ReachUnitEntity granularity for impression counting. Required when max_impressions is set.
Optionalwindow?: DurationTime window for the max_impressions cap (e.g. {"interval": 7, "unit": "days"} or {"interval": 1, "unit": "campaign"} for the full flight). Required when max_impressions is set.
Optionalaudience_summary?: stringHuman-readable summary of the audience the seller will target.
Optionalaudience_targeting?: [AudienceSelector, ...AudienceSelector[]]Structured audience targeting the seller will activate. Each entry is either a signal reference or a descriptive criterion. When present, governance agents MUST use this for bias/fairness validation and SHOULD ignore audience_summary for validation purposes. The audience_summary field is a human-readable rendering of this array, not an independent declaration.
Optionaltotal_budget?: numberTotal budget the seller will deliver against.
Optionaldaily_budget_cap?: numberHard aggregate daily spend ceiling the seller will enforce. Governance checks compare it with the authorized execution controls; it does not allocate spend to packages.
Optionalbudget_cap_timezone?: stringIANA timezone defining the calendar-day boundary for every daily cap on the planned media buy.
Optionalcurrency?: stringISO 4217 currency code for the budget. Governance execution checks require it whenever total_budget is present and require it to match the intent-authorized currency.
Optionalbudget_allocation?: BudgetAllocationSeller-accepted cross-package allocation authority and goals. Presence with seller_optimized mode means automatic within-buy reallocations are part of the committed delivery, not separate modification actions.
Optionalpacing?: PacingOptionalbidding?: {Seller-interpreted media-buy bidding policy used for governance and delivery transparency. Goal-bound controls follow budget-allocation scope semantics and monetary fields use the planned delivery currency. Package-authored overrides, including explicit automatic overrides, remain on packages rather than being copied into this aggregate field.
Optionalautomatic?: trueExplicitly use seller/provider automatic bidding at this authored scope. At package scope this is a complete override of a media-buy policy, not inheritance. It MUST be the only field in the block and MUST be preserved on readback.
Optionalbid_amount?: numberManual auction bid denominated in the media-buy currency and expressed per the selected pricing option's auction unit. For example, a CPM option interprets the amount per thousand impressions. This is the amount submitted to the auction, not a promise that the clearing price equals it. Requires an auction-priced pricing option whose currency equals the media-buy currency.
Optionalmax_bid?: numberHard per-auction ceiling denominated in the media-buy currency and expressed per the selected pricing option's auction unit. This is the only canonical hard auction ceiling and MUST NOT be translated into an average outcome-cost control. Requires an auction-priced pricing option whose currency equals the media-buy currency. May stand alone or supplement cost_per/roas only when the relevant scope capability advertises that combination.
Optionalcost_per?: { amount: number; strength: "cap" | "target" }Average cost control per result of the scope-bound primary optimization goal. At seller-optimized media-buy scope it binds to budget_allocation.optimization_goals; at package scope it binds to that package's optimization_goals; at fixed media-buy scope it binds independently to each inheriting package and is valid only when their primary-goal result units are compatible. Metric goals are compatible only when metric and every result-defining qualifier match; vendor_metric goals only when vendor and metric_id match; event goals only when the event_type/custom_event_name set and resolved attribution_window match. Primary is the earliest array entry among goals tied for the lowest explicit numeric priority; unprioritized goals follow explicitly prioritized goals; when all priorities are absent, the first entry is primary.
Average cost amount per scope-bound primary-goal result, denominated in the media-buy currency.
cap optimizes for an average at or below the amount and accepts underdelivery when necessary; target optimizes around the amount while balancing volume and spend. Neither is a per-result or per-auction guarantee.
Optionalroas?: { value: number; strength: "target" | "floor" }Dimensionless return-on-ad-spend control bound to the same scope-specific primary goal rules as cost_per. The bound goal must be value-bearing; a fixed media-buy default requires a value-bearing primary goal on every inheriting package. Every referenced value-bearing event source MUST declare value_currencies containing the media-buy currency. The seller validates this at buy creation; each buy consumes only exact-currency records, while other declared currencies remain available to other buys. Sellers MUST NOT perform currency conversion.
Return per unit of ad spend; 4 means 4 units of value per 1 unit spent.
floor prefers underdelivery to knowingly optimizing below the requested return; target optimizes around the requested return. Neither guarantees realized return.
Optionalenforced_policies?: string[]Registry policy IDs the seller will enforce for this delivery.
Optionalext?: ExtensionObjectOptionaldelivery_metrics?: {Seller-attributed canonical delivery statement. MUST be present for 'delivery' phase. The authenticated seller binds one immutable statement_id and digest to a monotonically increasing sequence; the buyer can later submit the copy it received or an independent observation through report_plan_outcome.
Optionalstatement_id?: stringStable seller-issued identifier for this immutable delivery statement.
Optionalstatement_digest?: stringSHA-256 digest of RFC 8785 JCS over {seller_reference, delivery_metrics}, excluding statement_digest itself. The authenticated submission binds the seller to this digest.
Optionalsequence?: numberMonotonically increasing sequence for this governed action. A statement ID or sequence cannot be reused with different content.
Optionalissued_at?: stringWhen the seller issued the canonical statement.
Start and end timestamps for the reporting window.
Optionalspend?: numberTotal spend during the reporting period.
Optionalcumulative_spend?: numberTotal spend since the governed action started.
Optionalcurrency?: stringCurrency of spend fields; must match the plan and planned delivery.
Optionalimpressions?: numberImpressions delivered during the reporting period.
Optionalcumulative_impressions?: numberTotal impressions since the governed action started.
Optionalgeo_distribution?: { [k: string]: number | undefined }Actual geographic distribution. Keys are ISO 3166-1 alpha-2 codes, values are percentages.
Optionalchannel_distribution?: { [k: string]: number | undefined }Actual channel distribution. Keys are channel enum values, values are percentages.
Optionalpacing?: "ahead" | "on_track" | "behind"Whether delivery is ahead of, on track with, or behind the planned pace.
Optionalaudience_distribution?: {Actual audience composition during the reporting period. Enables mid-flight drift detection when actual delivery skews from planned audience targeting.
Population baseline used for index calculation. 'census': national census or equivalent population data. 'platform': the seller's active user base. 'custom': a custom baseline defined by the seller (describe in baseline_description).
Optionalbaseline_description?: stringDescription of the baseline when baseline is 'custom' (e.g., 'US adults 18+ with broadband access').
Audience index values for the current reporting period. Keys are seller-defined dimension:value strings (e.g., 'age:25-34', 'gender:female', 'income:high'). The protocol does not mandate a taxonomy — dimensions and value labels vary by seller. Values are index relative to the declared baseline (1.0 = at parity, >1.0 = over-indexed, <1.0 = under-indexed).
Optionalcumulative_indices?: { [k: string]: number | undefined }Cumulative audience index values since the governed action started. Same key format as indices (dimension:value). Use for detecting sustained bias drift that may not appear in a single reporting period.
Optionalmodification_summary?: stringHuman-readable summary of what changed. SHOULD be present for 'modification' phase.
Optionalruntime_attestations?: (Optional independently issued runtime evidence for an activate_signal intent check whose payload action is activate (or omitted, which defaults to activate). It MUST NOT be supplied for deactivate. Each item is the shared portable AttestationReference from the core #4529 contract; it carries no authoritative buyer-supplied decision or confidence. The governance agent MUST evaluate every item under adcp.attestations plus governance.runtime_attestations capability policy, preserve input order in response runtime_attestation_evaluations[], and reject off-policy issuers, resolvers, credential origins, and verifier nominations without network access. This field is per-check evidence outside the synced plan and therefore outside the plan_hash preimage. Other tools and purchase types cannot carry this field.
Optionalinvoice_recipient?: BusinessEntityOptionalcontext?: ContextObjectOptionalext?: ExtensionObjectOptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsControl a seller compliance scenario. Intended for conformance testing.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsRename, pause, resume, cancel, or adjust delivery controls within accepted proposal change rights.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsExecute the AdCP create_collection_list tool.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsExecute the AdCP create_content_standards tool.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsTerminally decline one or more proposals and record the buyer's reason.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsExecute the AdCP delete_collection_list tool.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsRetrieve spend, credit or balance status, and invoice history for an operator-billed account.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsExecute the AdCP get_brand_identity tool.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsExecute the AdCP get_collection_list tool.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsExecute the AdCP get_content_standards tool.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsEvaluate a creative manifest and return scored safety, content, quality, and governance features.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsExecute the AdCP get_media_buy_artifacts tool.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsCheck reporting health, enumerate expected periods and all retained revisions, or resolve one exact reporting revision.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsExecute the AdCP get_rights tool.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsExecute the AdCP list_collection_lists tool.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsExecute the AdCP list_content_standards tool.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsExecute the AdCP list_creative_formats tool.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsDiscover account-scoped creative transformers and their selectable configuration options.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsLog batches of marketing events against a configured event source for measurement and attribution.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsRevise draft proposals, finalize them into committed, inventory-held snapshots, or extend a committed hold.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsExecute the AdCP report_plan_adjustment tool.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsExecute the AdCP report_plan_outcome tool.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsReport vendor-service consumption and final measurements for revenue tracking and billing reconciliation.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsOpen or change an advertiser account through the seller's account-request
lifecycle (experimental account.requests, AdCP 3.3). Read requests back
through listAccounts({ include_requests: true }).
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsRaise a seller-action issue report against an authorized media buy (AdCP 3.3).
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsRead the latest seller-owned state of one media-buy issue (AdCP 3.3).
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsAsk a seller to create one or more draft media-plan proposals from a campaign brief.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsExecute the AdCP search_brands tool.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsRegister, replace, pause, or clear caller-scoped webhooks for agent-level notifications.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsList or synchronize buyer-managed account catalog feeds, suppress or restore specific items, and read current availability state.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsList or synchronize account event sources with upsert and optional replacement semantics.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsBind or replace the governance agent used for approval across specific advertiser accounts.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsRecord a consumer's independently verified reporting totals and destination evidence in the seller ledger.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsTell a seller whether expected reporting was received, omitted, missing, unreadable, or contradictory.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsExecute the AdCP update_collection_list tool.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsExecute the AdCP update_content_standards tool.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsExecute the AdCP update_rights tool.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsExecute the AdCP validate_content_delivery tool.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsPreflight a creative manifest against canonical formats, products, third-party formats, or agent capabilities.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsExecute the AdCP validate_property_delivery tool.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsExecute the AdCP verify_brand_claim tool.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsExecute the AdCP verify_brand_claims tool.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsGet AdCP capabilities
A client pinned to a preview release (e.g. adcpVersion: '3.3.0-rc.3')
discovers unpinned first, so a seller that does not offer the preview still
answers. When that answer lists the exact preview in
adcp.supported_versions, the client asks again pinned to it and returns
the pinned answer, so preview-only experimental_features are declared.
If the pinned request fails, the unpinned answer is returned.
To pin one call, pass adcp_version in params at release precision
('3.3-rc.3'); a full-semver value ('3.3.0-rc.3') is collapsed to that
form. A pinned call is not re-probed or retried: a seller without that
release answers VERSION_UNSUPPORTED, with its releases in
adcpError.details.supported_versions.
To see which release answered, read result.metadata.adcpVersion: the
seller's echoed release, also data.adcp_version. Compare it with your pin
at release precision; a different release means the seller did not answer
at your pin. On a re-probed answer, result.metadata.wireAdcpVersion also
carries the client pin the re-probe was sent at.
Capabilities request parameters
OptionalinputHandler: InputHandler
Handler for clarification requests
Optionaloptions: TaskOptions
Task execution options
Build a creative through the legacy named-format protocol.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsRead the durable change feed for one account.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsRead the authenticated caller's durable principal configuration.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsReplaces each submitted section. To add a reporting subscription, use client.reporting.subscribe.
Atomically replace selected sections of the authenticated caller's principal configuration.
Each submitted section is the complete desired state, so omitting an active reporting
subscription deactivates it and omitting a destination revokes it for every account. Before
such a write the client reads the current principal and refuses, before sending, with
ReportingSubscriptionError (SUBSCRIPTION_WOULD_DEACTIVATE or DESTINATION_WOULD_REVOKE,
dispatched: false) unless you pass allowDeactivation / allowRevocation.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptions & SyncPrincipalGuardOptionsList accounts
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsResolve an account for the authenticated caller. Explicit-account sellers are discovered with list_accounts; implicit-account sellers are registered with sync_accounts. Stable-ID sellers are addressed by ID; legacy implicit sellers keep their natural key. includeDetails also exposes the seller handle.
Optionaloptions: TaskOptionsOptionalonTaskResult: (result: TaskResult<unknown>) => voidResolve an account for the authenticated caller. Explicit-account sellers are discovered with list_accounts; implicit-account sellers are registered with sync_accounts. Stable-ID sellers are addressed by ID; legacy implicit sellers keep their natural key. includeDetails also exposes the seller handle.
Optionalhints: ResolveAccountOptions & { includeDetails?: false }Optionaloptions: TaskOptionsOptionalonTaskResult: (result: TaskResult<unknown>) => voidResolve an account for the authenticated caller. Explicit-account sellers are discovered with list_accounts; implicit-account sellers are registered with sync_accounts. Stable-ID sellers are addressed by ID; legacy implicit sellers keep their natural key. includeDetails also exposes the seller handle.
Optionaloptions: TaskOptionsOptionalonTaskResult: (result: TaskResult<unknown>) => voidSync accounts
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsSync audiences
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsCreate a property list
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsGet a property list
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsUpdate a property list
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsList property lists
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsDelete a property list
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsList content standards
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsGet content standards
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsCalibrate content against standards
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsValidate content delivery
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsGet an SI offering
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsInitiate an SI session
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsSend a message in an SI session
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsTerminate an SI session
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsExecute any task by name with type safety
Name of the task to execute
Task parameters
OptionalinputHandler: InputHandler
Handler for clarification requests
Optionaloptions: TaskOptions & {Task execution options
Execute an extension task that is not part of the standard AdCP task set.
Keeping custom tasks on an explicitly named API prevents a response-type
generic from weakening the canonical request types enforced by
executeTask() for standard creative-boundary tasks.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsExplicit raw-task compatibility escape hatch for conformance and migration tooling.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsResume a deferred task using its token
Deferred task token
Human- or application-provided answer for the paused task
Continue an existing conversation with the agent
Message to send to the agent
Conversation context ID to continue
OptionalinputHandler: InputHandler
Handler for any clarification requests
const agent = new ADCPClient(config);
const initial = await agent.getProducts({ brief: 'Tech products' });
// Continue the conversation — use the server-returned contextId, not
// the client-minted correlation taskId.
const refined = await agent.continueConversation(
'Focus only on laptops under $1000',
initial.metadata.contextId!
);
Clear conversation history for a task
Get the agent configuration with normalized protocol
Returns the agent config with:
For guaranteed canonical URL, use getResolvedAgent() instead.
Get the fully resolved agent configuration
This async method ensures the agent config has the canonical URL resolved:
Promise resolving to agent config with canonical URL
Get the agent ID
Get the agent name
Get the agent protocol (may be normalized from original config)
Resolved MCP endpoint already used by this client; never performs discovery.
Get the canonical base URL for this agent
Returns the canonical URL if already resolved, or computes it synchronously from the configured URL. For the most accurate canonical URL (especially for A2A where the agent card contains the authoritative URL), use resolveCanonicalUrl() first.
The canonical URL is:
The canonical base URL (synchronous, may not be fully resolved)
Resolve and return the canonical base URL for this agent
This async method ensures the canonical URL is properly resolved:
The result is cached, so subsequent calls are fast.
Promise resolving to the canonical base URL
Check if this agent is the same as another agent
Compares agents by their canonical base URLs. Two agents are considered the same if they have the same canonical URL, regardless of:
Another agent configuration or SingleAgentClient to compare
true if agents have the same canonical URL
Async version of isSameAgent that resolves canonical URLs first
This provides more accurate comparison for A2A agents since it fetches the agent card to get the authoritative canonical URL.
Another agent configuration or SingleAgentClient to compare
Promise resolving to true if agents have the same canonical URL
Get active tasks for this agent
Query the seller's typed AdCP list_tasks tool. Pass {} for an unfiltered query.
OptionalinputHandler: InputHandlerOptionaloptions: TaskOptionsList local tasks only. Pass {} to query the seller's list_tasks tool.
Get detailed information about a specific task
ID of the task to get information for
Promise resolving to task information
Subscribe to task notifications for this agent
Function to call when task status changes
Unsubscribe function
Subscribe to all task events (create, update, complete, error)
Unsubscribe function
Register webhook URL for receiving task notifications
URL to receive webhook notifications
OptionaltaskTypes: string[]
Optional array of task types to watch (defaults to all)
Unregister webhook notifications
Get comprehensive agent information including name, description, and available tools/skills
Works with both MCP (tools) and A2A (skills) protocols to discover what the agent can do.
Auth resolution: this method forwards agent.headers as customHeaders
to the MCP transport so header-only auth (HTTP Basic via gateways like
Apigee/Kong, x-api-key, custom tenant routing) reaches the precheck
path. The invariant — basic-auth credentials live entirely on
headers.Authorization; do not also set auth_token — is documented
at docs/guides/BASIC-AUTH.md. See #1864 for the failure mode if it's
violated.
Optionaloptions: ReadRequestOptionsPromise resolving to agent information including tools
Get agent capabilities, including AdCP version support
For v3 servers, calls get_adcp_capabilities tool. Requires AdCP 3 capability discovery; retired AdCP 2 agents are rejected.
Optionaloptions: ReadRequestOptionsPromise resolving to normalized capabilities object
Return the client-bound scope required by primeCapabilities.
Obtain this scope before an application-owned, tenant-scoped preflight and attach it unchanged to the resulting snapshot. The opaque key prevents a snapshot collected for another client, credential, or transport instance from being installed accidentally.
Reuse a fresh capability observation made by the embedding application.
Returns false and leaves discovery cold when the scope, endpoint,
configured release, or freshness window does not match. Per-call scoped
transports (trustedFetchFn) continue to bypass this cache and discover
within their own request scope.
Drop discovery evidence for this client: its in-memory capability and
tool-schema caches, the discovered endpoint, and the shared
discoveryCache entry (when configured). The next call rediscovers.
Call this when you learn the seller changed (a deploy, a version bump, a capability-dependent error you observed). The SDK also invalidates by itself when a feature check fails against shared evidence, and when a seller answers with a version or capability error.
Optionaloptions: Pick<TaskOptions, "transport">Pre-seed the shared discoveryCache with capability evidence the caller
already holds (for example from a registry sync), so no client sharing
this identity probes the seller within the TTL. Unlike
primeCapabilities the seeded evidence outlives this instance.
Returns true only once the backing cache has accepted the entry. Returns
false — having seeded nothing — when sharing is not configured, the
client uses a scoped trustedFetchFn, or the evidence is synthetic,
malformed or not cloneable. When the cache rejects the write or does not
answer within the backend deadline, the result is also false, but the
outcome is indeterminate: a write already handed to the backend may still
land, whereas one still queued behind earlier operations is dropped. Treat
false as "not confirmed", and seed again (or invalidate) rather than
assuming the cache is empty. Seed endpoint as well
to skip the endpoint probe on the first call; without it that probe still
runs once per cold client.
Detect server AdCP version
Optionaloptions: ReadRequestOptions'v2' or 'v3' based on server capabilities
Check if server supports a specific AdCP major version
Return the seller's declared adcp.idempotency.replay_ttl_seconds.
BYOK callers use this to compare the age of persisted keys against the seller's replay window — past the window, the safe recovery is a natural-key lookup rather than reusing the key.
Fails closed when the seller is v3 but does not declare the field: the spec makes the declaration REQUIRED, and silently defaulting to 24h would mislead buyers about retry safety.
Check if the seller supports a feature.
Feature names resolve as follows:
Absent features return false.
Require that the seller supports all listed features. Throws FeatureUnsupportedError if any are missing.
Call this before making feature-dependent task calls to fail fast with an actionable error message.
Force-refresh cached capabilities from the server. Useful when seller capabilities may have changed.
Assert that the seller's capabilities corroborate the major this client
is pinned to (per getAdcpVersion()).
A self-reported version: 'v3' is not enough — a hostile or
misconfigured seller can just string-claim the version. For sellers
that return an authoritative get_adcp_capabilities response, the
guard requires:
capabilities.majorVersions.includes(<this client's major>)capabilities.idempotency.replayTtlSeconds present (spec-required
for real major-3+ sellers)Synthetic v3 evidence is accepted only when the agent advertises discovery. Agents without discovery and AdCP 2-only agents are rejected.
Throws VersionUnsupportedError with the specific reason on failure.
Optionaloptions: ReadRequestOptionsDeprecated alias for requireSupportedMajor. Original name from
the AdCP v2/v3 split; the function generalized in Stage 3 to check the
client's per-instance major instead of hardcoded 3, and requireV3
stopped reflecting what the function actually does.
StaticdiscoverQuery a legacy creative-agent named-format catalog.
Canonical applications discover seller-supported declarations through
AgentClient.getProducts() and consume format_options[] instead.
URL of the creative agent (e.g., 'https://creative.adcontextprotocol.org/mcp')
Protocol to use ('mcp' or 'a2a'), defaults to 'mcp'
Promise resolving to the list of available formats
Patch-shaped reporting-subscription writes:
subscribe,unsubscribe,replaceSubscriptions,listSubscriptions,preview; reads:reconcile,explain; events:poll,events,handleWebhook(experimentalmedia_buy.reporting_subscriptions, AdCP 3.3).