Skip to content

Conversation

@copybara-service
Copy link

feat: Add a tool confirmation flow which gathers custom input from the user before tool execution

The flow is similar to current OAuth flow:

  • User need to define a custom before_tool_call_back that request a custom input config. They are also responsible for check and validate the provided input before proceed with tool call.
  • ADK will create corresponding RequestInput FunctionCall Event to ask user for input
  • User provide the expected input to a RequestInput FunctionResponse Event.
  • ADK will check the response and use user's own callback validation to continue the tool call.

… explicit confirmation and custom input

The existing `LongRunningTool` does not define a programmatic way to provide & validate structured input, also it relies on LLM to reason and parse the user's response.

For a quick start, annotate the function with `FunctionTool(my_function, require_confirmation=True)`. A more advanced flow is shown in the `human_tool_confirmation` sample.

The new flow is similar to the existing Auth flow:
- User request a tool confirmation by calling `tool_context.request_confirmation()` in the tool or `before_tool_callback`, or just using the `require_confirmation` shortcut in FunctionTool.
- User can provide custom validation logic before tool call proceeds.
- ADK creates corresponding RequestConfirmation FunctionCall Event to ask user for confirmation
- User needs to provide the expected tool confirmation to a RequestConfirmation FunctionResponse Event.
- ADK then checks the response and continues the tool call.

PiperOrigin-RevId: 801019917
@copybara-service copybara-service bot merged commit a17bcbb into main Aug 29, 2025
@copybara-service copybara-service bot deleted the copybara/797379797 branch August 29, 2025 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants