Skip to content

feat(agent-builder): エージェント定義を JSON で共有できるようにする - #1689

Open
takke1986 wants to merge 1 commit into
aws-samples:mainfrom
takke1986:feat/agent-definition-share
Open

takke1986 wants to merge 1 commit into
aws-samples:mainfrom
takke1986:feat/agent-definition-share

Conversation

@takke1986

Copy link
Copy Markdown
Contributor

概要

ユースケースビルダーには JSON でユースケースを書き出す・読み込む機能がありますが、エージェントビルダーにはありません。エージェント定義も同じくらい作り込むものなので、同じ2つの操作を追加します。

変更内容

  • エクスポート — 一覧のメニューに追加(クローンの隣)
  • インポート — 編集画面のヘッダーに追加。読み込むとフォームに反映されます

書き出すのはエージェントを説明する項目だけです。

{
  "name": "...",
  "description": "...",
  "systemPrompt": "...",
  "modelId": "...",
  "mcpServers": ["..."],
  "codeExecutionEnabled": false
}

agentId・作成者・お気に入り数は含めていません。元のコピーに属する値で、持ち回ると取り込んだ人について何かを主張することになるためです。ユースケース側の実装も同じ考え方です。

読み込むファイルは外部から来るため、各フィールドを型ごとに検証しています。特に codeExecutionEnabled はコード実行の可否を決めるので、真偽値の true 以外は false として扱います(手で編集した JSON の "true" で有効になってはいけないため)。読めなかった場合はフォームを中途半端に埋めず、画面上にエラーを表示します。

補足

agent_builder の翻訳は ja と en にのみ存在するため、その2言語に追加しました。

テスト

packages/web/tests/hooks/agentDefinitionFile.test.ts に11件追加しています。

npm run test -w packages/web
→ Test Files 14 passed, Tests 289 passed

The use case builder can write a use case out and read one back, so a
colleague's work travels as a file. An agent, which takes as much thought
to write, could only be described over someone's shoulder.

Give it the same two actions. What travels is what describes the agent —
the prompt, the model, the servers, whether it may run code. The id, the
owner and the star count stay behind: they belong to the copy it was read
from, and carrying them would claim something about whoever imports it.

A file read back comes from outside, so each field is checked rather than
trusted, and an unreadable one says so where the eye already is instead of
half-filling the form. codeExecutionEnabled decides whether an agent may
run code, so nothing short of a literal true turns it on — a string
"true" from a hand-edited file does not.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant