Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Cancel Task

A2AClient::CancelTask asks the server to cancel in-flight work.

When to use cancellation

  • A user aborts an operation.
  • A deadline expires upstream.
  • Supervising logic needs to reclaim compute or queue capacity.

Semantics

Cancellation is best-effort. A task can complete before the cancellation request is processed, and servers can reject cancellation for completed, unknown, or policy-protected tasks.

  • Make higher-level cancellation idempotent.
  • Return or display the latest task state after cancellation attempts.
  • Preserve enough audit data to explain whether the task was canceled, completed, or rejected.