corsConfigurer) {
- this.corsConfigurer = corsConfigurer;
- return this;
- }
-
- /**
- * Build the Runner instance by proxying the AgentAdapter.
- *
- * This method creates a Runner instance that proxies calls to the AgentAdapter.
- *
- * @return this AgentApp instance for method chaining
- */
- public synchronized AgentApp buildRunner() {
- if (this.runner == null) {
- this.runner = new Runner(adapter);
- logger.info("[AgentApp] Runner built with adapter framework type: {}", adapter.getFrameworkType());
- }
- return this;
- }
-
- /**
- * Get the Runner instance.
- *
- * @return the Runner instance, or null if not built yet
- */
- public Runner getRunner() {
- return runner;
- }
-
-
- /**
- * Register a query handler with optional framework type.
- *
- * The handler will be called to process agent queries.
- *
- * Supported framework types: "agentscope", "saa"
- *
- * Usage example:
- * {@code
- * AgentApp app = new AgentApp(adapter);
- * app.query("agentscope", (request) -> {
- * // Process the request and return response
- * return processAgentRequest(request);
- * });
- * }
- *
- * @param framework the framework type (must be one of: agentscope, saa, langchain4j)
- * @param handler the query handler function that takes a request map and returns a response
- * @return this AgentApp instance for method chaining
- * @throws IllegalArgumentException if framework type is not supported
- */
- public AgentApp query(String framework, Function