Alibaba AgentScope
Alibaba AgentScope Adapter
Section titled “Alibaba AgentScope Adapter”AgentRuntime implementation backed by AgentScope Java
(Tongyi Lab) ReActAgent. When this JAR is on the classpath, @AiEndpoint runs AgentScope agents and streams their output to browser clients in real-time over Atmosphere’s transport.
Maven Coordinates
Section titled “Maven Coordinates”<dependency> <groupId>org.atmosphere</groupId> <artifactId>atmosphere-agentscope</artifactId> <version>${project.version}</version></dependency><dependency> <groupId>io.agentscope</groupId> <artifactId>agentscope-core</artifactId> <version>${agentscope.version}</version></dependency>How It Works
Section titled “How It Works”Drop the dependency alongside atmosphere-ai and the framework auto-detects it via ServiceLoader. The AgentScopeAgentRuntime has priority 100, taking precedence over the built-in client (priority 0):
@AiEndpoint(path = "/ai/chat", systemPrompt = "You are a helpful assistant")public class MyChat {
@Prompt public void onPrompt(String message, StreamingSession session) { session.stream(message); // uses AgentScope automatically }}Spring Boot Auto-Configuration
Section titled “Spring Boot Auto-Configuration”AtmosphereAgentScopeAutoConfiguration builds an OpenAIChatModel and a ReActAgent automatically when llm.api-key is set, so the default spring-boot-ai-chat template runs unchanged:
llm: api-key: ${OPENAI_API_KEY} base-url: https://api.openai.com/v1 model: gpt-4o-miniOverride the system prompt with atmosphere.agentscope.system-prompt (it falls back to llm.system-prompt). For full control, declare your own ReActAgent @Bean — the auto-configuration detects it via @ConditionalOnMissingBean and skips the default.
Per-Request Extension
Section titled “Per-Request Extension”AgentScopeAgent lets a single request route through a different ReActAgent topology (for example a planner agent vs. a quick-lookup agent) without re-installing the runtime client. See the AI Reference for the per-request sidecar pattern.
Runtime Caveat
Section titled “Runtime Caveat”AgentScope is exposed as a streaming AgentRuntime. As of the bundled AgentScope version it has no native tool dispatch through Atmosphere’s @AiTool bridge — for @AiTool-driven tool calling, pick a tool-capable runtime (Built-in, Spring AI, LangChain4j, ADK, Koog, Semantic Kernel, Anthropic, or Cohere). See the per-runtime capability matrix for the authoritative set.
Samples
Section titled “Samples”- Spring Boot AI Chat — drop
atmosphere-agentscopeon the classpath and the same@AiEndpointcode switches to AgentScope
See Also
Section titled “See Also”- AI Reference —
AgentRuntimeSPI,@AiEndpoint, capability matrix, per-request extensions - Spring AI Alibaba Adapter
- Module README