Core AdCP Concepts
Essential concepts for building AdCP clients, regardless of which protocol you’re using (MCP, A2A, or future protocols).Task Status System
Every AdCP response includes astatus field that tells you exactly what state the operation is in and what action you should take next.
Status Values
AdCP uses the same status values as the A2A protocol’s TaskState enum:| Status | Meaning | Your Action |
|---|---|---|
submitted | Task queued for execution | Show “queued” indicator, wait for updates |
working | Agent actively processing | Show progress, poll frequently for updates |
input-required | Needs information from you | Read message field, prompt user, send follow-up |
completed | Successfully finished | Process data, show success message |
canceled | User/system canceled task | Show cancellation notice, clean up |
failed | Error occurred | Show error from message, handle gracefully |
rejected | Agent rejected the request | Show rejection reason, don’t retry |
auth-required | Authentication needed | Prompt for auth, retry with credentials |
unknown | Indeterminate state | Log for debugging, may need manual intervention |
Response Structure
Every AdCP response has this structure:Client Decision Logic
Basic Status Handling
Advanced Status Patterns
1. Clarification Flow
When status isinput-required, the message tells you what’s needed:
2. Approval Flow
Human approval is a special case ofinput-required:
3. Long-Running Operations
Async operations start withworking and provide updates:
- MCP: Poll with context_id for updates
- A2A: Subscribe to SSE stream for real-time updates
Async Operations
Operation Types
AdCP operations fall into three categories:-
Synchronous - Return immediately with
completedorfailedget_products,list_creative_formats- Fast operations that don’t require external systems
-
Interactive - May return
input-requiredbefore proceedingget_products(when brief is vague)- Operations that need clarification or approval
-
Asynchronous - Return
workingorsubmittedand require polling/streamingcreate_media_buy,activate_signal,sync_creatives- Operations that integrate with external systems or require human approval
Timeout Handling
Set reasonable timeouts based on operation type:Context Management
Session Continuity
Thecontext_id maintains conversation state across requests:
Context Expiration
Contexts typically expire after 1 hour of inactivity:Task Management & Webhooks
Task Tracking
All async operations return atask_id at the protocol level for tracking:
Protocol-Level Webhook Configuration
Webhook configuration is handled at the protocol wrapper level, not in individual task parameters:MCP Webhook Pattern
A2A Native Support
Server Decision on Webhook Usage
The server decides whether to use webhooks based on the initial response status:completed,failed,rejected: Synchronous response - webhook is NOT called (client already has complete response)working: Will respond synchronously within ~120 seconds - webhook is NOT called (just wait for the response)submitted: Long-running async operation - webhook WILL be called on ALL subsequent status changes- Client choice: Webhook is optional - clients can always poll with
tasks/get
submitted.
When webhooks are called (for submitted operations):
- Status changes to
input-required→ Webhook called (human needs to respond) - Status changes to
completed→ Webhook called (final result) - Status changes to
failed→ Webhook called (error details) - Status changes to
canceled→ Webhook called (cancellation confirmation)
Webhook POST Format
When an async operation changes status, the publisher POSTs a payload with protocol fields at the top-level and the task-specific payload nested underresult.
Webhook Scenarios
Scenario 1: Synchronous completion (no webhook)For Other Async Operations
Each async operation posts its specific response schema:activate_signal→activate-signal-response.jsonsync_creatives→sync-creatives-response.jsonupdate_media_buy→update-media-buy-response.json
Webhook URL Patterns
Structure your webhook URLs to identify the operation and agent:https://buyer.com/webhooks/adcp/create_media_buy/agent_abc/op_xyzhttps://buyer.com/webhooks/adcp/activate_signal/agent_abc/op_123https://buyer.com/webhooks/adcp/sync_creatives/agent_abc/op_456
Webhook Payload Structure
Every webhook POST contains protocol fields plus aresult object for the task-specific payload of that status.
input-required webhook (human needs to respond):
completed webhook (operation finished - full create_media_buy response):
failed webhook (operation failed):
submitted operations, and each webhook contains an envelope plus result matching the task’s response schema.
Task State Reconciliation
Usetasks/list to recover from lost state:
Status Progression
Tasks progress through predictable states:submitted: Task queued for execution, provide webhook or pollworking: Agent actively processing, poll frequentlyinput-required: Need user input, continue conversationcompleted: Success, process resultsfailed: Error, handle appropriately
Webhook Reliability
Delivery Semantics
AdCP webhooks use at-least-once delivery semantics with the following characteristics:- Not guaranteed: Webhooks may fail due to network issues, server downtime, or configuration problems
- May be duplicated: The same event might be delivered multiple times
- May arrive out of order: Later events could arrive before earlier ones
- Timeout behavior: Webhook delivery has limited retry attempts and timeouts
Security
Webhook Authentication (Required)
AdCP adopts A2A’s PushNotificationConfig structure for webhook configuration. This provides a standard, flexible authentication model that supports multiple security schemes. Configuration Structure (A2A-Compatible):-
Bearer Token (Simple, Recommended for Development)
-
HMAC Signature (Enterprise, Recommended for Production)
- Bearer tokens: Simple, good for development and testing
- HMAC signatures: Prevents replay attacks, recommended for production
- Credentials exchanged out-of-band (during publisher onboarding)
- Minimum 32 characters for all credentials
- Store securely (environment variables, secret management)
- Support credential rotation (accept old and new during transition)
Retry and Circuit Breaker Patterns
Publishers MUST implement retry logic with circuit breakers to handle temporary buyer endpoint failures without overwhelming systems or accumulating unbounded queues.Retry Strategy
Publishers SHOULD use exponential backoff with jitter for webhook delivery retries:- Attempt 1: Immediate
- Attempt 2: After ~1 second (with jitter)
- Attempt 3: After ~2 seconds (with jitter)
- Attempt 4: After ~4 seconds (with jitter)
- Give up after 4 total attempts
Circuit Breaker Pattern
Publishers MUST implement circuit breakers to prevent webhook queues from growing unbounded when buyer endpoints are down:- CLOSED: Normal operation, webhooks delivered
- OPEN: Endpoint is down, webhooks are dropped (not queued)
- HALF_OPEN: Testing if endpoint recovered, limited webhooks sent
Queue Management
Publishers SHOULD implement bounded queues with overflow policies:- Set max queue size based on available memory and recovery time
- Monitor queue depth and dropped webhook counts
- Alert operations when queues are consistently full
- Use dead letter queues for manual investigation of persistent failures
- Implement queue per buyer endpoint (not global queue)
Implementation Requirements
Idempotent Webhook Handlers
Always implement idempotent webhook handlers that can safely process the same event multiple times:Sequence Handling
Use timestamps to ensure proper event ordering:Polling as Backup
Use polling as a reliable backup mechanism:Webhook Event Format
AdCP webhook events include all necessary information for processing, with task-specific data inresult:
Security Considerations
Webhook Authentication
Verify webhook authenticity using the authentication method specified during webhook registration:Replay Attack Prevention
Use timestamps and event IDs to prevent replay attacks:Best Practices Summary
- Always implement polling backup - Don’t rely solely on webhooks
- Handle duplicates gracefully - Use idempotent processing with event IDs
- Check timestamps - Ignore out-of-order events based on timestamps
- Return 200 quickly - Acknowledge webhook receipt immediately
- Verify authenticity - Always validate webhook signatures
- Log webhook events - Keep audit trail for debugging
- Set reasonable timeouts - Don’t wait forever for webhook delivery
- Graceful degradation - Fall back to polling if webhooks consistently fail
Reporting Webhooks
In addition to task status webhooks, AdCP supports reporting webhooks for automated delivery performance notifications. These webhooks are configured during media buy creation and follow a scheduled delivery pattern.Configuration
Reporting webhooks are configured via thereporting_webhook parameter in create_media_buy:
Publisher Commitment
When a reporting webhook is configured, publishers commit to sending: (campaign_duration / reporting_frequency) + 1 notifications- One per frequency period during the campaign
- One final notification at campaign completion
- Delayed notifications if data isn’t ready within expected delay window
Payload Structure
Reporting webhooks deliver the same payload asget_media_buy_delivery with additional metadata:
scheduled: Regular periodic updatefinal: Campaign completeddelayed: Data not yet available (prevents missed notification detection)
Webhook Aggregation
Publishers SHOULD aggregate webhooks when multiple media buys share the same webhook URL, reporting frequency, and reporting period. This reduces webhook volume significantly for buyers with many active campaigns. Example: Buyer with 100 active campaigns receives:- Without aggregation: 100 webhooks per reporting period
- With aggregation: 1 webhook containing all 100 campaigns in
media_buy_deliveriesarray
media_buy_deliveries as an array, even when it contains a single media buy.
Timezone Handling
For daily and monthly frequencies, the publisher’s reporting timezone (from product’sreporting_capabilities.timezone) determines period boundaries:
- Daily: Midnight to midnight in publisher’s timezone
- Monthly: 1st to last day of month in publisher’s timezone
- Hourly: UTC unless specified
Implementation Requirements
- Array Handling: Always process
media_buy_deliveriesas an array (may contain 1 to N media buys) - Idempotent Processing: Same as task webhooks - handle duplicates safely
- Sequence Tracking: Use
sequence_numberto detect gaps or out-of-order delivery - Fallback Strategy: Continue polling
get_media_buy_deliveryas backup - Delay Handling: Treat
"delayed"notifications as normal, not errors - Frequency Validation: Ensure requested frequency is in product’s
available_reporting_frequencies - Metrics Validation: Ensure requested metrics are in product’s
available_metrics
Error Handling
Error Categories
-
Protocol Errors - Transport/connection issues
- Handle with retries and fallback
- Not related to AdCP business logic
-
Task Errors - Business logic failures
- Returned as
status: "failed"with error details - Should be displayed to user
- Returned as
-
Validation Errors - Malformed requests
- Fix request format and retry
- Usually development-time issues
Error Response Format
Failed operations return statusfailed with details:
Human-in-the-Loop Workflows
Design Principles
- Optional by default - Approvals are configured per implementation
- Clear messaging - Users understand what they’re approving
- Timeout gracefully - Don’t block forever on human input
- Audit trail - Track who approved what when
Approval Patterns
Protocol-Agnostic Examples
Product Discovery with Clarification
Campaign Creation with Approval
Migration Guide
From Custom Status Fields
If you’re using custom status handling: Before:Backwards Compatibility
During the transition period, responses may include both old and new fields:Next Steps
- MCP Integration: See MCP Guide for tool calls and context management
- A2A Integration: See A2A Guide for artifacts and streaming
- Protocol Comparison: See Protocol Comparison for choosing between MCP and A2A