agentscope-java
できること
AgentScopeフレームワークでエージェントを作るためのJavaのガイドです。LLMエージェント、ツールの利用、マルチエージェントシステムを作るJava開発者向けです。
使う場面
- ✓AgentScopeフレームワークを使って、Javaのエージェントを書きたいとき。
- ✓言語モデルやツールをAgentScopeのエージェントに接続する必要があるとき。
- ✓リアクティブなJavaコードでマルチエージェントシステムを作りたいとき。
スキルのリンク
https://github.com/agentscope-ai/agentscope-java/blob/main/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“天気ツールとDashScopeのモデルを使うJavaのAgentScopeのReActエージェントを、エラー処理付きで書いてください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
スキルは、エージェントに、AgentScopeの規則と正しいAPIのパターンを与えます。たとえば、リアクティブな型を使うことや、環境変数からキーを読むことなどです。エージェントはそのパターンに従ってJavaコードを書きます。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
When the user asks you to write AgentScope Java code, follow these instructions carefully.
CRITICAL RULES - NEVER VIOLATE THESE
🚫 ABSOLUTELY FORBIDDEN:
- NEVER use
.block()in example code - This is the #1 mistake. Only use.block()inmain()methods or test code when explicitly creating a runnable example. - NEVER use
Thread.sleep()- UseMono.delay()instead. - NEVER use
ThreadLocal- Use Reactor Context withMono.deferContextual(). - NEVER hardcode API keys - Always use
System.getenv(). - NEVER ignore errors silently - Always log errors and provide fallback values.
- NEVER use wrong import paths - Shared model interfaces are in
io.agentscope.core.model.*; provider models are inio.agentscope.extensions.model.<provider>.*.
✅ ALWAYS DO:
- Use
MonoandFluxfor all asynchronous operations. - Chain operations with
.map(),.flatMap(),.then(). - Use Builder pattern for creating agents, models, and messages.
- Include error handling with
.onErrorResume()or.onErrorReturn(). - Add logging with SLF4J for important operations.
- Use correct imports:
import io.agentscope.extensions.model.dashscope.DashScopeChatModel; - Use correct APIs (many methods don't exist or have changed):
toolkit.registerTool()NOTregisterObject()toolkit.getToolNames()NOTgetTools()event.getToolUse().getName()NOTgetToolName()result.getOutput()NOTgetContent()(ToolResultBlock)event.getToolResult()NOTgetResult()(PostActingEvent)toolUse.getInput()NOTgetArguments()(ToolUseBlock)- Model builder: NO
temperature()method, usedefaultOptions(GenerateOptions.builder()...) - Hook events: NO
getMessages(),getResponse(),getIterationCount(),getThinkingBlock()methods - ToolResultBlock: NO
getToolUseName()method, useevent.getToolUse().getName()instead - ToolResultBlock.getOutput() returns
List<ContentBlock>NOTString, need to convert - @ToolParam format: MUST use
@ToolParam(name = "x", description = "y")NOT@ToolParam(name="x")
WHEN GENERATING CODE
FIRST: Identify the context
- Is this a
main()method or test code? →.block()is allowed (but add a warning comment) - Is this agent logic, service method, or library code? →
.block()is FORBIDDEN
For every code example you provide:
- Check: Does it use
.block()? → If yes in non-main/non-test code, REWRITE IT. - Check: Are all operations non-blocking? → If no, FIX IT.
- Check: Does it have error handling? → If no, ADD IT.
- Check: Are API keys from environment? → If no, CHANGE IT.
- Check: Are imports correct? → If using provider models from
io.agentscope.core.model.*, FIX TOio.agentscope.extensions.model.<provider>.*.
Default code structure for agent logic:
// ✅ CORRECT - Non-blocking, reactive (use this pattern by default)
return model.generate(messages, null, null)
.map(response -> processResponse(response))
.onErrorResume(e -> {
log.error("Operation failed", e);
return Mono.just(fallbackValue);
});
// ❌ WRONG - Never generate this in agent logic
String result = model.generate(messages, null, null).block(); // DON'T DO THIS
Only for main() methods (add warning comment):
public static void main(String[] args) {
// ⚠️ .block() is ONLY allowed here because this is a main() method
Msg response = agent.call(userMsg).block();
System.out.println(response.getTextContent());
}
PROJECT SETUP
When creating a new AgentScope project, use the correct Maven dependencies:
Maven Configuration (pom.xml)
For production use (recommended):
<properties>
<java.version>17</java.version>
</properties>
<dependencies>
<!-- Use the latest stable release from Maven Central -->
<dependency>
<groupId>io.agentscope</groupId>
<artifactId>agentscope</artifactId>
<version>1.0.12</version>
</dependency>
</dependencies>
For local development (if working with source code):
<properties>
<agentscope.version>1.0.12</agentscope.version>
<java.version>17</java.version>
</properties>
<dependencies>
<dependency>
<groupId>io.agentscope</groupId>
<artifactId>agentscope-core</artifactId>
<version>${agentscope.version}</version>
</dependency>
<dependency>
<
よくある質問
AgentScopeとは何ですか?
Javaで、Project Reactorの上に構築された、マルチエージェントシステムのためのフレームワークです。
APIキーはどこに置きますか?
スキルは、キーを環境変数から読み、コードには決して書かないよう定めています。
ツールやフックにも対応していますか?
はい。ツールの統合とフックが説明に挙がっています。
詳細
作者による元の説明
Expert Java developer skill for AgentScope Java framework - a reactive, message-driven multi-agent system built on Project Reactor. Use when working with reactive programming, LLM integration, agent orchestration, multi-agent systems, or when the user mentions AgentScope, ReActAgent, Mono/Flux, Project Reactor, or Java agent development. Specializes in non-blocking code, tool integration, hooks, pipelines, and production-ready agent applications.
人気
- GitHubのスター
- 6.2k
- ランキング
- #14380
- ライセンス
- Apache-2.0
- 更新日
- 2026/11/2
コメント
- …
このリポジトリの他のスキル
data-report
6.2kデータセットを、平均、合計、範囲、傾向を含むレポートに要約し、Markdownファイルとして保存するのを支援します。
data-transform
6.2kCSVやJSONなどのデータファイルを形式間で変換し、他のツールで使えるようにするのを支援します。
git-changelog
6.2kGitの履歴から変更履歴やリリースノートを書き、機能、修正、その他の変更にまとめるのを支援します。
image-resize
6.2kJPEG、PNG、WebPなどの画像をまとめてリサイズしたり圧縮したりするのを支援します。縦横比は保ちます。
似ているスキル
api-connector-builder
280kエージェントが既存のパターンに従って、新しいAPI連携を構築します。新しい方式を作らずに、もう一つ連携を追加したいときに使います。
api-design
280kエージェントがベストプラクティスに沿ってREST APIを設計できるようにします。APIの通信方法、エラーの表示方法、データの整理方法を決めるのに役立ちます。
backend-patterns
280kエージェントのサーバーサイドのアーキテクチャパターンとデータベースの最適化を支援します。サーバー上で動くコードを作成またはレビューするときに役立ちます。