A2A統合
Agent-to-Agentプロトコルを使用して、他のエージェントに委任したり、他のエージェントにサービスを提供したりできます。
A2A連携
JamJetはAgent-to-Agent (A2A) プロトコルを実装しています。これは、エージェントがフレームワークや組織を越えて相互に発見、呼び出し、協調するためのオープン標準です。
A2Aとは?
A2Aは、エージェントが以下を行う方法を定義します:
- 機能を公開する(Agent Card —
.well-known/agent.jsonファイル経由) - 他のエージェントからタスクを受け取る(構造化されたリクエスト/レスポンス形式)
- 進捗をストリーミングする(SSEベースのイベントストリーム)
- アーティファクトを交換する(ファイル、構造化データ、テキスト)
JamJetエージェントはA2Aネイティブです。すべてのエージェントは自動的にAgent Cardを取得し、他のフレームワーク(LangChain、CrewAI、AutoGenなど)からのA2Aタスクを受け入れることができます。
Agent Card
Agent Cardは、エージェントを機械可読な形式で記述したものです:
{
"id": "research-agent",
"name": "Research Agent",
"description": "Searches the web and synthesizes research reports.",
"version": "0.2.0",
"url": "https://agents.example.com/research-agent",
"capabilities": {
"streaming": true,
"push_notifications": false
},
"input_schema": {
"type": "object",
"properties": {
"query": { "type": "string" }
},
"required": ["query"]
},
"output_schema": {
"type": "object",
"properties": {
"answer": { "type": "string" },
"sources": { "type": "array" }
}
}
}JamJetはワークフロースキーマから自動的にこれを生成します。jamjet.tomlでカスタマイズできます:
[agent]
name = "Research Agent"
description = "Searches the web and synthesizes research reports."
url = "https://agents.example.com/research-agent"他のエージェントを呼び出す
a2a_taskノードを使用して、他のエージェントに作業を委譲します:
YAML
nodes:
delegate-research:
type: a2a_task
agent_url: "https://agents.example.com/research-agent"
input:
query: "{{ state.query }}"
output_key: research_result
next: synthesizePython SDK
@node
async def delegate_research(self, state: State) -> State:
result = await self.a2a(
agent_url="https://agents.example.com/research-agent",
input={"query": state["query"]},
)
return {"research_result": result.state}エージェントの検出
エージェントがURLを公開している場合、Agent Cardを取得することで検出できます:
jamjet agents inspect https://agents.example.com/research-agentAgent: Research Agent (research-agent v0.2.0)
URL: https://agents.example.com/research-agent
Streaming: yes
Input schema:
query: string (required)
Output schema:
answer: string
sources: arrayエージェントをA2Aとして公開
JamJetのワークフローは、自動的にA2Aエージェントとして公開可能です。A2Aサーバーを有効化:
[a2a.server]
enabled = true
port = 7702
expose = ["research-agent", "summarizer"]jamjet dev --with-a2a-serverエージェントカードは以下で利用可能になります:
http://localhost:7702/.well-known/agent.json他のエージェント(どのフレームワークでも)から、ワークフローをA2Aタスクとして呼び出せます。
A2Aレスポンスのストリーミング
JamJetはA2AタスクのSSEベースストリーミングをサポートしています。a2a_taskノードでストリーミングを有効化:
delegate-research:
type: a2a_task
agent_url: "https://agents.example.com/research-agent"
input:
query: "{{ state.query }}"
stream: true # イベントをリアルタイムで受信
output_key: research_result
next: synthesize
# Python SDK
async for event in self.a2a_stream(
agent_url="https://agents.example.com/research-agent",
input={"query": state["query"]},
):
print(event.type, event.data)フレームワーク間の互換性
JamJetのA2A実装は以下と互換性があります:
| フレームワーク | A2Aサポート |
|---|---|
| JamJet | ネイティブ(クライアント + サーバー) |
| LangChain | langchain-a2a経由 |
| CrewAI | A2Aアダプター経由 |
| AutoGen | A2Aアダプター経由 |
| Vertex AI | ネイティブ |
| 任意のHTTPクライアント | 直接REST呼び出し |
note: A2Aは設計上フレームワーク非依存です。JamJetエージェントとLangChainエージェントは直接連携可能 — どちらも相手が使用するフレームワークを知る必要はありません。
セキュリティ
本番環境では、A2Aタスクエンドポイントを保護する必要があります。JamJetは以下をサポートしています:
[a2a.server]
enabled = true
auth = "api_key" # または mtls、jwt
api_keys = ["${AGENT_API_KEY}"]ゼロトラスト環境でのmTLSの場合:
[a2a.server]
auth = "mtls"
ca_cert = "/path/to/ca.crt"
server_cert = "/path/to/server.crt"
server_key = "/path/to/server.key"自律モード
JamJetエージェントには、人間の監視がどの程度必要かを制御する設定可能な自律レベルがあります:
| モード | 説明 |
|---|---|
guided(デフォルト) | 重要な意思決定ポイントで人間の承認を待機 |
supervised | 自律的に実行するが、すべての決定をレビュー用に記録 |
autonomous | 完全自律 — 人間の介入なし |
[agent]
autonomy = "guided" # guided | supervised | autonomousguidedエージェントの場合、承認ポイントで一時停止するにはwaitノードを使用します:
nodes:
propose-action:
type: model
model: claude-sonnet-4-6
prompt: "Propose a plan for: {{ state.task }}"
output_key: plan
next: await-approval
await-approval:
type: wait
event: human_approved
timeout_hours: 24
on_timeout: escalate
next: execute