Skip to main content
This document defines the canonical structure for AdCP responses transmitted over the A2A protocol.

Required Structure

Final Responses (status: “completed”)

AdCP responses over A2A MUST:
  • Include at least one DataPart (kind: ‘data’) containing the task response payload
  • Use single artifact with multiple parts (not multiple artifacts)
  • Use the last DataPart as authoritative when multiple data parts exist
  • NOT wrap AdCP payloads in custom framework objects (no { response: {...} } wrappers)
Recommended pattern:
  • TextPart (kind: ‘text’): Human-readable summary - recommended but optional
  • DataPart (kind: ‘data’): Structured AdCP response payload - required
  • FilePart (kind: ‘file’): Optional file references (previews, reports)
Multiple artifacts: Only for fundamentally distinct deliverables (e.g., creative asset + separate trafficking report). Rare in AdCP - prefer single artifact with multiple parts.

Interim Responses (working, submitted, input-required)

Interim status responses can include optional AdCP-structured data for progress tracking.
Interim response characteristics:
  • TextPart is recommended for human-readable status
  • DataPart is optional but follows AdCP schemas when provided
  • Interim status schemas (*-async-response-working.json, *-async-response-input-required.json, etc.) are work-in-progress and may evolve
  • Implementors may choose to handle interim data more loosely given schema evolution
When final status is reached (status: "completed" or status: "failed"), DataPart with full AdCP task response becomes required in .artifacts.

Framework Wrappers (NOT PERMITTED)

CRITICAL: DataPart content MUST be the direct AdCP response payload, not wrapped in framework-specific objects.
Why this matters:
  • Breaks schema validation (clients expect products at root, not response.products)
  • Adds unnecessary nesting layer
  • Violates protocol-agnostic design (wrapper is framework-specific)
  • Complicates client extraction code
If your implementation adds wrappers, this is a bug that should be fixed in the framework layer, not worked around in client code.

Canonical Client Behavior

This section defines EXACTLY how clients MUST extract AdCP responses from A2A protocol responses.

Quick Reference

Key Insights:
  • Final statuses use Task object with data in .artifacts
  • Interim statuses use TaskStatusUpdateEvent with optional data in status.message.parts[]
  • All statuses use AdCP schemas when data is present
  • Interim status schemas are work-in-progress and may evolve

Rule 1: Status-Based Handling

Clients MUST branch on status field to determine the correct data extraction location:
Critical:
  • Interim statuses use TaskStatusUpdateEvent → extract from status.message.parts[]
  • Final statuses use Task object → extract from .artifacts[0].parts[]

Rule 2: Data Extraction Helpers

Extract data from the appropriate location based on webhook type:

Rule 3: Schema Validation

All AdCP responses use schemas, but validation approach varies by status:
Schema Evolution Note: Interim status schemas (*-async-response-working.json, etc.) are work-in-progress. Implementors may choose to handle these more loosely while schemas stabilize.

Complete Example

Putting it all together with proper handling of both Task and TaskStatusUpdateEvent payloads:

Last Data Part Authority Pattern

Test Cases

✅ Correct Behavior

❌ Incorrect Behavior (Common Mistakes)

Error Handling

Task-Level Errors (Partial Failures)

Task executed but couldn’t complete fully. Use errors array in DataPart with status: "completed":
When to use errors array:
  • Platform authorization issues (PLATFORM_UNAUTHORIZED)
  • Partial data availability
  • Validation issues in subset of data

Protocol-Level Errors (Fatal)

Task couldn’t execute. Use status: "failed" with message:
When to use status: failed:
  • Authentication failures (invalid credentials, expired tokens)
  • Invalid request parameters (malformed JSON, missing required fields)
  • Resource not found (unknown taskId, expired context)
  • System errors (database unavailable, internal service failure)

Status Mapping

AdCP uses A2A’s TaskState enum directly:

Webhook Payloads

Async operations (status: "submitted") deliver the same artifact structure in webhooks:
Extract AdCP data using the same last-DataPart pattern. For webhook authentication, retry patterns, and security, see Core Concepts - Webhook Reliability.

File Parts in Responses

Creative operations MAY include file references:
File part usage: Preview URLs, generated assets, trafficking reports. Not for raw AdCP response data (always use DataPart).

Retry and Idempotency

TaskId-Based Deduplication

A2A’s taskId enables retry detection. Agents SHOULD:
  • Return cached response if taskId matches a completed operation (within TTL window)
  • Reject duplicate taskId submission if operation is still in progress

Examples

Implementation Checklist

When implementing A2A responses for AdCP: Final Responses (status: “completed” or “failed”) - Use Task object:
  • Always include status field from TaskState enum
  • Use .artifacts array with at least one DataPart containing AdCP response payload
  • Include TextPart with human-readable message (recommended for UX)
  • Use single artifact with multiple parts (not multiple artifacts)
  • Use last DataPart as authoritative if multiple exist
  • Never nest AdCP data in custom wrappers (no { response: {...} } objects)
  • DataPart content MUST match AdCP schemas (validate against [task]-response.json)
Interim Responses (status: “working”, “submitted”, “input-required”) - Use TaskStatusUpdateEvent:
  • Use status.message.parts[] for optional data (not .artifacts)
  • TextPart is recommended for human-readable status updates
  • DataPart is optional but follows AdCP schemas when provided ([task]-async-response-[status].json)
  • Interim schemas are work-in-progress - clients may handle more loosely
  • Include progress indicators when applicable (percentage, current_step, ETA)
Error Handling:
  • Use status: "failed" for protocol errors only (auth, invalid params, system errors)
  • Use errors array for task failures (platform auth, partial data) with status: "completed"
General:
  • Include taskId and contextId for tracking
  • Follow discriminated union patterns for task responses (check schemas)
  • Use correct payload type: Task for final states, TaskStatusUpdateEvent for interim
  • Support taskId-based deduplication for retry detection

See Also