diff --git a/core/src/main/java/com/google/adk/flows/llmflows/Functions.java b/core/src/main/java/com/google/adk/flows/llmflows/Functions.java index 0639d0d3..519a79c0 100644 --- a/core/src/main/java/com/google/adk/flows/llmflows/Functions.java +++ b/core/src/main/java/com/google/adk/flows/llmflows/Functions.java @@ -254,16 +254,6 @@ private static Function> getFunctionCallMapper( .toolConfirmation(functionCall.id().map(toolConfirmations::get).orElse(null)) .build(); - ToolConfirmation toolConfirmation = toolContext.toolConfirmation().orElse(null); - if (toolConfirmation != null && !toolConfirmation.confirmed()) { - return Maybe.just( - buildResponseEvent( - tool, - ImmutableMap.of("error", "User declined tool execution for " + tool.name()), - toolContext, - invocationContext)); - } - Map functionArgs = functionCall.args().orElse(new HashMap<>()); Maybe> maybeFunctionResult = diff --git a/core/src/test/java/com/google/adk/flows/llmflows/RequestConfirmationLlmRequestProcessorTest.java b/core/src/test/java/com/google/adk/flows/llmflows/RequestConfirmationLlmRequestProcessorTest.java index b93e02ed..26d456b7 100644 --- a/core/src/test/java/com/google/adk/flows/llmflows/RequestConfirmationLlmRequestProcessorTest.java +++ b/core/src/test/java/com/google/adk/flows/llmflows/RequestConfirmationLlmRequestProcessorTest.java @@ -82,21 +82,6 @@ public class RequestConfirmationLlmRequestProcessorTest { .build())) .build(); - private static final Event USER_DECLINE_EVENT = - Event.builder() - .author("user") - .content( - Content.fromParts( - Part.builder() - .functionResponse( - FunctionResponse.builder() - .id(FUNCTION_CALL_ID) - .name(REQUEST_CONFIRMATION_FUNCTION_CALL_NAME) - .response(ImmutableMap.of("confirmed", false)) - .build()) - .build())) - .build(); - private static final RequestConfirmationLlmRequestProcessor processor = new RequestConfirmationLlmRequestProcessor(); @@ -123,30 +108,6 @@ public void runAsync_withConfirmation_callsOriginalFunction() { assertThat(fr.response()).hasValue(ImmutableMap.of("result", ORIGINAL_FUNCTION_CALL_ARGS)); } - @Test - public void runAsync_withDecline_returnsErrorFunctionResponse() { - LlmAgent agent = createAgentWithEchoTool(); - Session session = - Session.builder("session_id") - .events(ImmutableList.of(REQUEST_CONFIRMATION_EVENT, USER_DECLINE_EVENT)) - .build(); - - InvocationContext context = createInvocationContext(agent, session); - - RequestProcessor.RequestProcessingResult result = - processor.processRequest(context, LlmRequest.builder().build()).blockingGet(); - - assertThat(result).isNotNull(); - assertThat(result.events()).hasSize(1); - Event event = result.events().iterator().next(); - assertThat(event.functionResponses()).hasSize(1); - FunctionResponse fr = event.functionResponses().get(0); - assertThat(fr.id()).hasValue(ORIGINAL_FUNCTION_CALL_ID); - assertThat(fr.name()).hasValue(ECHO_TOOL_NAME); - assertThat(fr.response()) - .hasValue(ImmutableMap.of("error", "User declined tool execution for echo_tool")); - } - @Test public void runAsync_withConfirmationAndToolAlreadyCalled_doesNotCallOriginalFunction() { LlmAgent agent = createAgentWithEchoTool();