Skip to content

Alibaba AgentScope

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.

<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>

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
}
}

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-mini

Override 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.

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.

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.

  • Spring Boot AI Chat — drop atmosphere-agentscope on the classpath and the same @AiEndpoint code switches to AgentScope