Package io.agentscope.spring.boot
Class AgentscopeAutoConfiguration
java.lang.Object
io.agentscope.spring.boot.AgentscopeAutoConfiguration
@AutoConfiguration
@EnableConfigurationProperties(AgentscopeProperties.class)
@ConditionalOnClass(io.agentscope.core.ReActAgent.class)
public class AgentscopeAutoConfiguration
extends Object
Spring Boot auto-configuration that exposes default Memory, Toolkit and ReActAgent beans for
AgentScope.
Model beans are provided by provider-specific starters such as
agentscope-dashscope-spring-boot-starter, agentscope-openai-spring-boot-starter,
agentscope-gemini-spring-boot-starter, agentscope-anthropic-spring-boot-starter,
or by user-defined Model beans.
Basic configuration:
agentscope:
agent:
enabled: true
name: "Assistant"
sys-prompt: "You are a helpful AI assistant."
max-iters: 10
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionio.agentscope.core.memory.MemoryDefault Memory implementation backed by InMemoryMemory.io.agentscope.core.ReActAgentagentscopeReActAgent(io.agentscope.core.model.Model model, io.agentscope.core.memory.Memory memory, io.agentscope.core.tool.Toolkit toolkit, AgentscopeProperties properties) Default ReActAgent that wires together the configured Model, Memory and Toolkit beans usingAgentProperties.io.agentscope.core.tool.ToolkitDefault Toolkit implementation with an initially empty tool set.
-
Constructor Details
-
AgentscopeAutoConfiguration
public AgentscopeAutoConfiguration()
-
-
Method Details
-
agentscopeMemory
@Bean @ConditionalOnProperty(prefix="agentscope.agent", name="enabled", havingValue="true") @ConditionalOnMissingBean @Scope("prototype") public io.agentscope.core.memory.Memory agentscopeMemory()Default Memory implementation backed by InMemoryMemory.Memory is stateful and not thread-safe, so we expose it as a prototype-scoped bean. In multi-threaded / web environments, it is recommended to obtain instances lazily via
ObjectProvider<Memory>or method injection. -
agentscopeToolkit
@Bean @ConditionalOnProperty(prefix="agentscope.agent", name="enabled", havingValue="true") @ConditionalOnMissingBean @Scope("prototype") public io.agentscope.core.tool.Toolkit agentscopeToolkit()Default Toolkit implementation with an initially empty tool set.Toolkit holds mutable state and is not thread-safe, so it is also exposed as a prototype-scoped bean. In application code, prefer obtaining instances lazily via
ObjectProvider<Toolkit>or method injection. -
agentscopeReActAgent
@Bean @ConditionalOnMissingBean @ConditionalOnBean(io.agentscope.core.model.Model.class) @ConditionalOnProperty(prefix="agentscope.agent", name="enabled", havingValue="true") public io.agentscope.core.ReActAgent agentscopeReActAgent(io.agentscope.core.model.Model model, io.agentscope.core.memory.Memory memory, io.agentscope.core.tool.Toolkit toolkit, AgentscopeProperties properties) Default ReActAgent that wires together the configured Model, Memory and Toolkit beans usingAgentProperties. ReActAgent in 2.0 is thread-safe, so we just use a singleton instance.
-