Skip to main content
How AdCP handles conversation state differs significantly between protocols.

Key Identifiers

AdCP uses two distinct identifiers for different purposes:

context_id vs task_id

context_id:
  • Comes from the protocol layer (built into A2A)
  • Provides conversation history and session continuity
  • Lives at the protocol level
  • Used for maintaining state across multiple task calls in a conversation
  • Expires after conversation timeout (typically 1 hour)
task_id:
  • Specific to individual requests that could be asynchronous
  • Lives beyond the conversation
  • Used for tracking operation progress over time
  • Persists until the task completes (may be days for complex media buys)
  • Can be referenced across different conversations or sessions

Usage Example

Protocol Differences

  • A2A: Context is handled automatically by the protocol
  • MCP: Requires manual context_id management

A2A Context (Automatic)

A2A handles sessions natively - you don’t need to manage context:
The A2A protocol maintains:
  • Session state
  • Conversation history
  • Task relationships
  • Context switching

MCP Context (Manual)

MCP requires explicit context management to maintain state:

MCP Context Management Pattern

What Context Maintains

The context_id maintains conversation state, regardless of protocol:
  • Current media buy and products being discussed
  • Search results and applied filters
  • Conversation history and user intent
  • User preferences expressed in the session
  • Workflow state and temporary decisions
Note: Long-term task state (like media buy status, creative assets, performance data) is tracked via task_id, not context_id.

Application-Level Context

Task request payloads may include an optional context object that carries application-level metadata (session hints, correlation tokens, tracking identifiers, etc.). The agent must echo this object back unchanged inside the task payload, including webhook result payloads.

Example: Create media buy with application-level context

Response (application-level context is repeated inside the payload):
Application context lifecycle diagram showing initiator request flow Application context lifecycle diagram showing webhook response flow Webhook updates include the same application-level context inside the webhook result payload.

Best Practices

For A2A

  • Let the protocol handle context
  • Use contextId for explicit conversation threading
  • Trust the session management

For MCP

  • Always preserve context_id between calls
  • Implement a session wrapper (see pattern above)
  • Handle context expiration (1 hour timeout)
  • Start fresh context for new workflows