Module adcp.types.domains.creative.preview_creative_request
Classes
class Input (**data: Any)-
Expand source code
class Input(AdCPBaseModel): model_config = ConfigDict( extra='allow', ) name: Annotated[ str, Field( description="Human-readable name for this input set (e.g., 'Sunny morning on mobile', 'Evening podcast ad', 'Desktop dark mode')" ), ] macros: Annotated[ dict[str, str] | None, Field( description="Macro values to use for this preview. Supports all universal macros from the format's supported_macros list." ), ] = None context_description: Annotated[ str | None, Field( description="Natural language description of the context for AI-generated content (e.g., 'User just searched for running shoes', 'Podcast discussing weather patterns')" ), ] = NoneBase model for AdCP types with spec-compliant serialization.
Defaults to
extra='ignore'so unknown fields from newer spec versions are silently dropped rather than causing validation errors. Generated types whose schemas setadditionalProperties: trueoverride this withextra='allow'in their ownmodel_config.Set
ADCP_STRICT_VALIDATION=1in the environment ("1","true","yes","on"are accepted) to flip the default toextra='forbid'. Use this during spec upgrades to catch silently-dropped renamed fields in tests. See :func:_resolve_extra_policy.Important
The env var is resolved once at module import time. Set it in your shell or CI environment before
import adcpruns — mutatingos.environ["ADCP_STRICT_VALIDATION"]after the firstadcpimport has no effect on already-imported model classes (they captured the policy at class-body evaluation).Consumers who want per-model strict validation can override
model_configon their subclass.Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.Ancestors
- AdCPBaseModel
- pydantic.main.BaseModel
Class variables
var context_description : str | Nonevar macros : dict[str, str] | Nonevar model_configvar name : str
Inherited members
class Input10 (**data: Any)-
Expand source code
class Input10(AdCPBaseModel): model_config = ConfigDict( extra='allow', ) name: Annotated[str, Field(description='Human-readable name for this input set')] macros: Annotated[ dict[str, str] | None, Field(description='Macro values to use for this preview') ] = None context_description: Annotated[ str | None, Field(description='Natural language description of the context for AI-generated content'), ] = NoneBase model for AdCP types with spec-compliant serialization.
Defaults to
extra='ignore'so unknown fields from newer spec versions are silently dropped rather than causing validation errors. Generated types whose schemas setadditionalProperties: trueoverride this withextra='allow'in their ownmodel_config.Set
ADCP_STRICT_VALIDATION=1in the environment ("1","true","yes","on"are accepted) to flip the default toextra='forbid'. Use this during spec upgrades to catch silently-dropped renamed fields in tests. See :func:_resolve_extra_policy.Important
The env var is resolved once at module import time. Set it in your shell or CI environment before
import adcpruns — mutatingos.environ["ADCP_STRICT_VALIDATION"]after the firstadcpimport has no effect on already-imported model classes (they captured the policy at class-body evaluation).Consumers who want per-model strict validation can override
model_configon their subclass.Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.Ancestors
- AdCPBaseModel
- pydantic.main.BaseModel
Class variables
var context_description : str | Nonevar macros : dict[str, str] | Nonevar model_configvar name : str
Inherited members
class PreviewCreativeRequest (**data: Any)-
Expand source code
class PreviewCreativeRequest(AdcpRequest, AdcpVersionEnvelope): model_config = ConfigDict( extra='allow', ) request_type: Annotated[ RequestType, Field( description="Preview mode. 'single' previews one creative manifest. 'batch' previews multiple creatives in one call. 'variant' replays a post-flight variant by ID." ), ] creative_manifest: Annotated[ creative_manifest_1.CreativeManifest | None, Field( description='Complete creative manifest with all required assets for the format. In single mode, provide exactly one of creative_manifest or creative_id. Also accepted per item in batch mode.' ), ] = None target_capability_id: Annotated[ str | None, Field( description="Canonical 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.", pattern='^[a-zA-Z0-9_-]+$', ), ] = None format_id: Annotated[ format_id_1.FormatReferenceStructuredObject | None, Field( deprecated=True, description='**DEPRECATED in 3.2.** Legacy named-format preview route. New requests select an advertised preview renderer with target_capability_id and carry portable format identity in creative_manifest_1.format_kind plus optional creative_manifest_1.format_option_ref.', ), ] = None inputs: Annotated[ list[Input] | None, Field( description='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.', min_length=1, ), ] = None template_id: Annotated[ str | None, Field(description='Specific template ID for custom format rendering. Used in single mode.'), ] = None quality: Annotated[ creative_quality.CreativeQuality | None, Field( description="Render quality. 'draft' produces fast, lower-fidelity renderings. 'production' produces full-quality renderings. In batch mode, sets the default for all requests (individual items can override)." ), ] = None output_format: Annotated[ preview_output_format.PreviewOutputFormat | None, Field( description="Output format. 'url' returns preview_url (iframe-embeddable URL), 'html' returns preview_html (raw HTML). In batch mode, sets the default for all requests (individual items can override). Default: 'url'." ), ] = preview_output_format.PreviewOutputFormat.url item_limit: Annotated[ SchemaInt | None, Field( description='Maximum 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.', ge=1, ), ] = None requests: Annotated[ list[Request] | None, Field( description="Array of preview requests (1-50 items). Required when request_type is 'batch'. Each item follows the single request structure.", max_length=50, min_length=1, ), ] = None variant_id: Annotated[ str | None, Field( description="Agent-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." ), ] = None creative_id: Annotated[ str | None, Field( description='Creative-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.' ), ] = None allow_async: Annotated[ StrictBool | None, Field( description="Opt 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." ), ] = False push_notification_config: Annotated[ push_notification_config_1.PushNotificationConfig | None, Field( description='Optional webhook configuration for terminal completion/failure notifications when allow_async is true and preview_creative returns a submitted task envelope. Submitted tasks remain pollable through get_task_status whether or not this field is present. If the agent accepts this configuration and returns submitted, it MUST deliver at least the terminal notification; if it cannot honor the webhook, it MUST return a structured error. Presence of this field alone MUST NOT cause asynchronous execution.' ), ] = None context: context_1.ContextObject | None = None ext: ext_1.ExtensionObject | None = NoneThe request message of a task in the pinned bundle's task registry.
A consumer holding one can resolve its account, decide at-most-once, echo its context and negotiate version – the whole transport-boundary job – before knowing which tool it is.
issubclass(model, AdcpRequest)is the registration-time proof that a model is spec-derived rather than a hand-written parallel: a field test passes for a forged model, descent does not.Each accessor returns the field's value, or
Nonewhen this tool's schema declares no such field. Only 49 of the 87 request schemas declare anaccountand only 43 anidempotency_key, so asking the request is what replacesgetattr(req, "account", None)againstAnyat the boundary.Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.Ancestors
- AdcpRequest
- adcp.types.base._AdcpMessage
- AdcpVersionEnvelope
- AdCPBaseModel
- pydantic.main.BaseModel
Class variables
var allow_async : bool | Nonevar context : ContextObject | Nonevar creative_id : str | Nonevar creative_manifest : CreativeManifest | Nonevar ext : ExtensionObject | Nonevar format_id : FormatReferenceStructuredObject | Nonevar inputs : list[Input] | Nonevar item_limit : int | Nonevar model_configvar output_format : PreviewOutputFormat | Nonevar push_notification_config : PushNotificationConfig | Nonevar quality : CreativeQuality | Nonevar request_type : RequestTypevar requests : list[Request] | Nonevar target_capability_id : str | Nonevar template_id : str | Nonevar variant_id : str | None
Inherited members
class Request (**data: Any)-
Expand source code
class Request(AdCPBaseModel): model_config = ConfigDict( extra='allow', ) target_capability_id: Annotated[ str | None, Field( description='Canonical preview-operation selector for this batch item. Overrides the batch-level target_capability_id and MUST identify an advertised capability whose operations contains preview. If neither item nor batch supplies one, renderer inference is permitted only for a unique compatible preview capability.', pattern='^[a-zA-Z0-9_-]+$', ), ] = None format_id: Annotated[ format_id_1.FormatReferenceStructuredObject | None, Field( deprecated=True, description='**DEPRECATED in 3.2.** Legacy named-format preview route. Use target_capability_id plus the canonical identity in creative_manifest.', ), ] = None creative_manifest: Annotated[ creative_manifest_1.CreativeManifest | None, Field(description='Complete creative manifest with all required assets.'), ] = None creative_id: Annotated[ str | None, Field( description='Creative-library identifier. Use instead of creative_manifest to preview a stored canonical creative.' ), ] = None inputs: Annotated[ list[Input10] | None, Field( description='Array of input sets for generating multiple preview variants', min_length=1 ), ] = None template_id: Annotated[ str | None, Field(description='Specific template ID for custom format rendering') ] = None quality: Annotated[ creative_quality.CreativeQuality | None, Field(description='Render quality for this preview. Overrides batch-level default.'), ] = None output_format: Annotated[ preview_output_format.PreviewOutputFormat | None, Field(description='Output format for this preview. Overrides batch-level default.'), ] = preview_output_format.PreviewOutputFormat.url item_limit: Annotated[ SchemaInt | None, Field(description='Maximum number of catalog items to render in this preview.', ge=1), ] = NoneBase model for AdCP types with spec-compliant serialization.
Defaults to
extra='ignore'so unknown fields from newer spec versions are silently dropped rather than causing validation errors. Generated types whose schemas setadditionalProperties: trueoverride this withextra='allow'in their ownmodel_config.Set
ADCP_STRICT_VALIDATION=1in the environment ("1","true","yes","on"are accepted) to flip the default toextra='forbid'. Use this during spec upgrades to catch silently-dropped renamed fields in tests. See :func:_resolve_extra_policy.Important
The env var is resolved once at module import time. Set it in your shell or CI environment before
import adcpruns — mutatingos.environ["ADCP_STRICT_VALIDATION"]after the firstadcpimport has no effect on already-imported model classes (they captured the policy at class-body evaluation).Consumers who want per-model strict validation can override
model_configon their subclass.Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.Ancestors
- AdCPBaseModel
- pydantic.main.BaseModel
Class variables
var creative_id : str | Nonevar creative_manifest : CreativeManifest | Nonevar format_id : FormatReferenceStructuredObject | Nonevar inputs : list[Input10] | Nonevar item_limit : int | Nonevar model_configvar output_format : PreviewOutputFormat | Nonevar quality : CreativeQuality | Nonevar target_capability_id : str | Nonevar template_id : str | None
Inherited members
class RequestType (*args, **kwds)-
Expand source code
class RequestType(StrEnum): single = 'single' batch = 'batch' variant = 'variant'Enum where members are also (and must be) strings
Ancestors
- enum.StrEnum
- builtins.str
- enum.ReprEnum
- enum.Enum
Class variables
var batchvar singlevar variant