查询智能体调用说明¶
读取 Agent Card,确认目标智能体支持的 A2A 协议版本、输入输出类型和能力。
GET https://api.moi.matrixorigin.cn/v5/workspaces/{workspace_id}/agents/{agent_id}/.well-known/agent-card.json
调用前准备¶
先查询智能体列表,选择活动智能体并记录其所属工作区。
请求参数¶
curl --get "https://api.moi.matrixorigin.cn/v5/workspaces/$WORKSPACE_ID/agents/$AGENT_ID/.well-known/agent-card.json" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H "Accept: application/json" \
--data-urlencode "agent_workspace_id=$AGENT_WORKSPACE_ID"
$AGENT_ID 与 $AGENT_WORKSPACE_ID 分别来自智能体列表中同一项的 id 和 workspace_id。$WORKSPACE_ID 是本次调用所在工作区,$AI_STUDIO_API_KEY 是调用凭据。
参数 |
类型 |
是否必填 |
说明 |
|---|---|---|---|
|
string |
是 |
本次调用所在工作区 ID,须与工作区请求头一致。 |
|
string |
是 |
智能体列表返回的目标智能体 ID。 |
查询参数
当前工作区未找到定义时会回退系统目录,显式指定当前工作区也相同。系统定义的 Card 技能还可能叠加当前工作区的绑定配置。读取 Card 不代表已获准执行智能体。
参数 |
类型 |
是否必填 |
说明 |
|---|---|---|---|
|
string |
否 |
智能体所属工作区。只能指定当前工作区或 |
选择系统助手时,将 system 填入查询参数,路径仍使用实际目标工作区。
通用入口 GET /v5/agents/card?agent_id=...&agent_workspace_id=... 也可用于读取 Card。本文示例使用工作区级入口。通用入口返回错误时,可按本页路径核对同一智能体的能力。
成功响应¶
{
"name": "Matrixflow 工作流助手",
"description": "根据自然语言和已注册工作项创建 Matrixflow 工作流。",
"version": "1",
"protocolVersion": "0.3.0",
"capabilities": {
"streaming": true,
"stateTransitionHistory": true
},
"defaultInputModes": [
"text/plain",
"application/octet-stream"
],
"defaultOutputModes": [
"text/plain"
],
"url": "https://api.moi.matrixorigin.cn/v5/workspaces/ws_01/agents/agent_01/a2a",
"metadata": {
"moi": {
"version": 1,
"dataParts": [
{
"type": "moi.feedback.submit",
"version": 1,
"direction": "client_to_runtime",
"methods": [
"message/send"
],
"metadata": {
"intent": [
"record_only"
],
"targetRequired": [
"messageId"
]
}
},
{
"type": "moi.feedback.received",
"version": 1,
"direction": "runtime_to_client",
"methods": [
"message/send"
]
},
{
"type": "moi.tool.call",
"version": 1,
"direction": "runtime_to_client",
"methods": [
"message/send",
"message/stream",
"tasks/resubscribe",
"tasks/get"
]
},
{
"type": "moi.tool.result",
"version": 1,
"direction": "runtime_to_client",
"methods": [
"message/send",
"message/stream",
"tasks/resubscribe",
"tasks/get"
]
},
{
"type": "moi.progress",
"version": 1,
"direction": "runtime_to_client",
"methods": [
"message/send",
"message/stream",
"tasks/resubscribe",
"tasks/get"
]
},
{
"type": "moi.run.control",
"version": 1,
"direction": "client_to_runtime",
"methods": [
"message/send"
],
"metadata": {
"rerunMode": [
"same_manifest"
],
"conversationMode": [
"replace_view"
]
}
},
{
"type": "moi.run.control.result",
"version": 1,
"direction": "runtime_to_client",
"methods": [
"message/send"
]
}
]
}
}
}
字段 |
类型 |
说明 |
|---|---|---|
|
string |
智能体显示名称。 |
|
string |
智能体说明。 |
|
string |
Card 声明的 A2A 地址,根据服务配置的公开基础地址生成。 |
|
string |
智能体版本。 |
|
string |
A2A 协议版本。 |
|
object |
能力声明。 |
|
boolean |
是否支持流式调用。 |
|
boolean |
是否支持推送通知。有值时返回。 |
|
boolean |
是否支持状态变更历史。 |
|
string(字符串数组) |
默认输入媒体类型。 |
|
string(字符串数组) |
默认输出媒体类型。 |
|
object(对象数组) |
智能体声明的技能。有值时返回。 |
|
object |
数据分段协议元数据。moi.version 和 moi.dataParts。 |
|
object |
MOI 数据分段协议声明。 |
|
integer |
协议版本。当前为 1。 |
|
object(对象数组) |
支持的数据分段类型及方向。七种分段声明。 |
|
string |
分段类型。取值见响应示例,发送分段时使用对应类型。 |
|
integer |
此类型的数据分段版本。当前为 1。 |
|
string |
|
|
string(字符串数组) |
能够承载该分段的 JSON-RPC 方法。 |
|
object |
按分段类型返回的约束。没有额外约束时省略。 |
|
string(字符串数组) |
反馈提交支持的意图。当前为 record_only。 |
|
string(字符串数组) |
反馈提交所需的目标字段。当前为 messageId。 |
|
string(字符串数组) |
重跑控制支持的模式。当前为 same_manifest。 |
|
string(字符串数组) |
会话视图控制支持的模式。当前为 replace_view。 |
只调用 Card 声明的能力,并兼容未知扩展字段。发送凭据前确认 url 属于预期服务。工作区级调用方式参阅通过 A2A 调用智能体。
根据 capabilities,使用工作区级公开路径通过 A2A 调用智能体。仅在 Card 声明支持时使用流式调用或其他扩展能力。
错误响应¶
工作区 Card 入口的参数、权限、缺失及构造错误使用 JSON-RPC 错误信封,分别可能返回 400、403、404、500。身份认证层仍有独立的 code / msg 错误。
{
"jsonrpc": "2.0",
"id": null,
"error": {
"code": -32008,
"message": "agent not found"
}
}
HTTP 状态码 |
JSON-RPC 错误代码 |
常见原因。 |
|---|---|---|
|
|
请求或工作区参数无效。 |
|
|
当前身份无访问权限。 |
|
|
智能体未找到。 |
|
|
Card 地址或内容构造失败。 |