agentscope-ai / agentscope-ai/agentscope-java

[Feature]: Support Declarative Multi-Agent & Multi-Provider Configuration in Spring Boot

未关闭
#2,096 2 条评论 0 个 reaction 已指派 1 人 已被 @jujn 认领 在 GitHub 查看
area/ext/spring-boot enhancement
主要语言
Java
星标
5.6k
派生
1.3k
平均合并
4 天 12 小时
30 天内合并 PR
77

描述

## The Problem

Currently, AgentScope-Java's Spring Boot Auto-Configuration only supports declaring a **single Agent instance**. This is a major blocker for real-world business scenarios where multiple agents are needed to handle different tasks.

We lack a declarative way to:
- Configure **multiple LLM providers** (OpenAI, DashScope, Anthropic, Gemini, Ollama, etc.) simultaneously.
- Define **multiple models** under each provider with independent parameters.
- Declare **multiple agents** that reference different models and carry different system prompts.
- Dynamically **resolve agents by name** at runtime without manual Spring Bean injection.
- Register **custom tools** and reference them in agent configurations by name.

Without this, every team has to build their own integration layer, leading to duplicated effort and inconsistency.

## Proposed Solution

Native Spring Boot `@AutoConfiguration` / `@ConfigurationProperties` support that enables developers to define Providers, Models, and Agents purely through YAML configuration:

agentscope:

providers:
my-openai:
name: "My OpenAI"
api-key: "sk-xxx"
provider-type: "openai"
base-url: "https://api.openai.com/v1/"
models:
gpt-4o:
name: "GPT-4o"
model-name: "gpt-4o"
generate-options:
temperature: 0.7
max-tokens: 4096

agents:
translator:
name: "Translator"
model: "my-openai:gpt-4o"
sys-prompt: "You are a translator."
max-iters: 10
analyzer:
name: "Analyzer"
model: "my-openai:gpt-4o"
sys-prompt: "You are an analyst."
toolkit:
- my-tool

Additionally, provide a simple static API to resolve agents by name at runtime:

ReActAgent agent = AgentRegistry.resolve("translator");

And support registering custom tools to be referenced by name in agent config:

AgentRegistry.registerTool("my-tool", new MyCustomTool());

## Alternatives Considered

- Writing manual Java code for each agent.
- Wrapping agents behind custom service layers.

Both approaches require significant boilerplate and become hard to maintain as the number of providers or agents grows.

## Additional Context

N/A

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。