่จปๅ†Šไธฆๅˆ†ไบซ้‚€่ซ‹้€ฃ็ต๏ผŒๅฏ็ฒๅพ—ๅฝฑ็‰‡ๆ’ญๆ”พ่ˆ‡้‚€่ซ‹็Žๅ‹ตใ€‚

cv usk
@cv_usk
AI / Software Research Notes AI Agent, LLMOps, MLOps, Software Architecture ๆŠ•็จฟใฏๅ€‹ไบบใฎๆ„่ฆ‹ใงใ™ใ€‚
ๅŠ ๅ…ฅ May 2026
258 ๆญฃๅœจ้—œๆณจ    220 ็ฒ‰็ตฒ
# Practical and Useful Patterns with ADK โœ‹ "Are you sure you want to send this email?" โ€” ADK's Action Confirmations add pre-execution user approval for irreversible operations, building safer agents. ๐Ÿ“Œ Title: Action Confirmations โ€” Pre-Execution Approval for Irreversible Operations ๐Ÿ”— URL: ๐Ÿงฉ Overview ADK's Action Confirmations require explicit user approval before executing hard-to-reverse operations like email sending, data deletion, and payment processing. The agent asks "Should I proceed?" and only executes upon user approval. This maintains human control at critical decision points while keeping agents autonomous for routine tasks. ๐Ÿ›  Usage Defining tools with confirmation requirements. To define tools with confirmation, import `Agent` and `ToolContext` from `google.adk`. In `send_email(to: str, subject: str, body: str, tool_context: ToolContext)`, call `tool_context.actions.request_confirmation(message=...)` before the actual send, displaying a preview with recipient, subject, and body. The email is only sent if the user approves. Similarly, `delete_records(table: str, condition: str, tool_context: ToolContext)` counts records to be deleted first, then displays the count in a confirmation message for user approval. Pass both tools to an `Agent` with `name="admin_assistant"` and `model="gemini-2.5-flash"` via the `tools` parameter. ๐Ÿ— Practical Patterns **When to Require Confirmation**: Add confirmation for these categories: - External sends (email, messages, API calls) - Data modification or deletion - Operations that incur charges - Permission or access control changes For payment processing, define `process_payment(amount: float, currency: str, recipient: str, tool_context: ToolContext)`. This function calls `tool_context.actions.request_confirmation(message=...)` with the recipient, currency, and amount details. Only after user approval does it execute `payment_gateway.charge(amount=..., currency=..., recipient=...)` to process the transaction. **Confirmation Message Design**: Include the target, scope of impact, and irreversibility in confirmation messages. Provide exactly the information users need to make an informed decision. **Staged Confirmations**: For multi-step operations, decide whether to confirm at each step or summarize at the final step. Balance thoroughness with user experience. ๐Ÿ’ก Use Cases ๐Ÿ“ง Email and message send confirmation ๐Ÿ—‘๏ธ Database record deletion approval ๐Ÿ’ณ Payment and transfer execution confirmation ๐Ÿ” Permission and access control change approval โš ๏ธ Caveats - Too many confirmations degrade user experience. Limit confirmations to truly irreversible operations. - Insufficient confirmation messages prevent users from making informed decisions. Be specific about the operation's impact. - Confirmations become bottlenecks in batch processing and automation pipelines. Consider skippable confirmations for automated scenarios. โœจ Properly configured Action Confirmations balance agent autonomy with human safety oversight. The key is confirming only "can't-undo" operations! #ADK# #AIAgent#
้กฏ็คบๆ›ดๅคš