public ActionResult apply(Agent agent, Map<String, String> request) {
        log.debug("Searching web with query {}", request.get("query"));

        String query = request.get("query");
        if (query == null || query.isEmpty()) {
            return ActionResult.builder()
                    .status(ActionResult.Status.FAILURE)
                    .summary("The query parameter is missing or has an empty value.")
                    .error("The query parameter is missing or has an empty value.")
                    .build();
        }

        try {
            List<SearchResult> searchResults = getSearchResults(query);
            return ActionResult.builder()
                    .status(ActionResult.Status.SUCCESS)
                    .result(searchResults)
                    .summary(String.format("Searched the web for \"%s\" and returned multiple results.", query))
                    .build();
        } catch (Exception e) {
            return ActionResult.builder()
                    .status(ActionResult.Status.FAILURE)
                    .summary("The web search did not return any results.")
                    .error(e.getMessage())
                    .build();
        }
    }
@Test
    void testApplyWithMissingQuery() {
        Map<String, String> request = new HashMap<>();

        ActionResult result = searchWebAction.apply(agent, request);

        assertEquals(ActionResult.Status.FAILURE, result.getStatus());
        assertEquals("The query parameter is missing or has an empty value.", result.getSummary());
        assertEquals("The query parameter is missing or has an empty value.", result.getError());
    }