AI Agent Invoker abstraction SDK — Provider-agnostic AI agent invocation for Java.
Provides a unified abstraction for invoking AI agents across different providers (OpenClaw, Spring AI, Bedrock, etc.).
AiAgentInvoker— interface for submitting AI tasks, canceling, and handling callbacksAiAgentInvokerRouter— routes to the correct provider based onproviderCodeanddefaultProviderCallbackRouter— routes callbacks to the correct provider adapterOpenClawAiAgentInvoker— OpenClaw provider adapter (requiresopenclaw-java-sdk)OpenClawInvokeRequestMapper— mapsAgentInvokeCmdto OpenClawInvokeAgentRequest
AiAgentInvokerRouter router = new AiAgentInvokerRouter();
router.setDefaultProvider("openclaw");
router.register(new OpenClawAiAgentInvoker(openClawClient, "http://localhost:7088"));
AgentInvokeCmd cmd = AgentInvokeCmd.builder()
.taskId("task-001")
.agentId("main")
.providerCode("openclaw")
.enhancedPrompt("Generate content...")
.callbackUrl("http://localhost:7088/api/generation/save") // optional; overrides callback base URL
.tenantId("t1")
.userId("u1")
.channel("xiaohongshu")
.variables(Collections.singletonMap("tone", "casual"))
.build();
AiAgentInvoker invoker = router.route("openclaw");
SubmitResult result = invoker.submit(cmd);OpenClaw Gateway Hooks (POST /hooks/agent) has no dedicated callbackUrl field. The adapter:
- Resolves URL from
AgentInvokeCmd.callbackUrl, else adaptercallbackBaseUrl - Embeds the URL and
task_id/ metadata in the agentmessagefor OpenClaw to POST results back
OpenClawAiAgentInvoker.cancel(taskId) tracks taskId → runId after successful submit. The HTTP SDK has no run-cancel API; cancel sends a best-effort wake signal when a runId is known.
Use openclaw-spring-boot-starter for OpenClawClient (openclaw.*). Use agent-invoker-spring-boot-starter for routing (agents.provider.*):
| Key | Purpose |
|---|---|
agents.provider.default-provider |
Router fallback when providerCode is empty |
agents.provider.openclaw.enabled |
Enable OpenClaw adapter |
agents.provider.openclaw.callback-base-url |
Adapter callback base (overrides openclaw.callback-base-url when set) |
openclaw.gateway-base-url |
Gateway URL for OpenClawClient |
openclaw.hooks-token |
Webhook auth for OpenClawClient |
openclaw.callback-base-url |
Bridged to adapter when agent-invoker key is unset |
9 branches for different Spring Boot lines: 2.3.x, 2.7.x, 3.0.x–4.0.x.
Each branch has its pom.xml generated by scripts/render-branch-pom.py.