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 摘要。