AS AgentScopeAPI 手册 / API Reference

AgentscopeFactory

@Factory @Requires(classes = ReActAgent.class) public class AgentscopeFactory
源码Source io/agentscope/micronaut/AgentscopeFactory.java:115–201

Agentscope 工厂,承载智能体的部署、调度与服务化运行。位于 io.agentscope.micronaut 包。核心成员包括 agentscopeMemory、agentscopeToolkit、agentscopeModel、agentscopeReActAgent。

Micronaut factory that exposes default Model, Memory, Toolkit and ReActAgent beans for AgentScope.

Basic configuration with DashScope (default provider):

`agentscope:
# Select model provider (defaults to dashscope when omitted)
model:
provider: dashscope

dashscope:
enabled: true
api-key: ${DASHSCOPE_API_KEY}
model-name: qwen-plus
stream: true
enable-thinking: true

agent:
enabled: true
name: "Assistant"
sys-prompt: "You are a helpful AI assistant."
max-iters: 10
`

Using OpenAI as provider:

`agentscope:
model:
provider: openai

openai:
enabled: true
api-key: ${OPENAI_API_KEY}
model-name: gpt-4.1-mini
stream: true
`

Using Gemini as provider (direct API):

`agentscope:
model:
provider: gemini

gemini:
enabled: true
api-key: ${GEMINI_API_KEY}
model-name: gemini-2.0-flash
stream: true
`

Using Gemini via Vertex AI:

`agentscope:
model:
provider: gemini

gemini:
enabled: true
project: your-gcp-project-id
location: us-central1
model-name: gemini-2.0-flash
vertex-ai: true
stream: true
`

Using Anthropic as provider:

`agentscope:
model:
provider: anthropic

anthropic:
enabled: true
api-key: ${ANTHROPIC_API_KEY}
model-name: claude-sonnet-4.5
stream: true
`

方法摘要Method Summary

方法Method说明Description
public Memory agentscopeMemory()
返回 `agentscopeMemory` 结果。
Default Memory implementation backed by InMemoryMemory.
public Toolkit agentscopeToolkit()
返回 `agentscopeToolkit` 结果。
Default Toolkit implementation with an initially empty tool set.
public Model agentscopeModel(AgentscopeProperties properties)
设置该参数。
Default Model implementation.
public ReActAgent agentscopeReActAgent(Model model, Memory memory, Toolkit toolkit, AgentscopeProperties properties)
执行 `agentscopeReActAgent` 方法。
Default ReActAgent that wires together the configured Model, Memory and Toolkit beans using `AgentProperties`.

方法详情Method Detail

agentscopeMemory

public Memory agentscopeMemory()

返回 agentscopeMemory 结果。

Default Memory implementation backed by InMemoryMemory.

返回Returns Memory
返回记忆。Returns memory.
源码Source io/agentscope/micronaut/AgentscopeFactory.java:126–130

agentscopeToolkit

public Toolkit agentscopeToolkit()

返回 agentscopeToolkit 结果。

Default Toolkit implementation with an initially empty tool set.

返回Returns Toolkit
返回工具包。Returns toolkit.
源码Source io/agentscope/micronaut/AgentscopeFactory.java:139–143

agentscopeModel

public Model agentscopeModel(AgentscopeProperties properties)

设置该参数。

Default Model implementation.

参数Parameters
名称Name类型Type说明Description
propertiesAgentscopeProperties属性(类型 `AgentscopeProperties`)。The properties.
返回Returns Model
返回模型。Returns model.
源码Source io/agentscope/micronaut/AgentscopeFactory.java:151–156

agentscopeReActAgent

public ReActAgent agentscopeReActAgent(Model model, Memory memory, Toolkit toolkit, AgentscopeProperties properties)

执行 agentscopeReActAgent 方法。

Default ReActAgent that wires together the configured Model, Memory and Toolkit beans using AgentProperties.

参数Parameters
名称Name类型Type说明Description
modelModel模型实例(类型 `Model`)。The model.
memoryMemory记忆(类型 `Memory`)。The memory.
toolkitToolkit工具包(类型 `Toolkit`)。The toolkit.
propertiesAgentscopeProperties属性(类型 `AgentscopeProperties`)。The properties.
返回Returns ReActAgent
返回ReActAgent。Returns ReAct agent.
源码Source io/agentscope/micronaut/AgentscopeFactory.java:166–200
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.