Basic Implementation
To implement approvals, you inject the extension and callrequest_approval() within your tool execution logic or a framework handler.
This example uses the BeeAI Framework to request user approval before executing a tool call:
Import the Approval extension
Import
ApprovalExtensionServer, ApprovalExtensionSpec, ApprovalExtensionParams, and ToolCallApprovalRequest from agentstack_sdk.a2a.extensions.interactions.approval.Inject the extension
Add an approval parameter to your agent function using the
Annotated type hint with ApprovalExtensionServer and ApprovalExtensionSpec.Request user approval
Within your agent logic or tool handler, call await
approval_ext.request_approval(). This triggers a UI prompt for the user and pauses execution until they respond.