更新 agentInstance

命名空间:microsoft.graph

重要

Microsoft Graph /beta 版本下的 API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。

重要

即将推出的对代理注册表 API 的更改

从 2026 年 5 月开始,Microsoft Graph 中的代理注册表 API 将替换为 由 Microsoft 代理 365 支持的代理注册表 API。 此更改整合了代理管理体验,以便更轻松地观察、管理和保护租户中的所有代理。 我们建议你计划在新的基于 Agent 365 的 API 发布时迁移到它们。 详细了解代理 注册表与 Microsoft Agent 365 的融合。

更新 agentInstance 对象的属性。 您还可以通过在请求正文中包含清单来更新与代理实例关联的 agentCardManifest 。

API 可用性

此 API 可用于以下国家级云部署。

全局服务 美国政府 L4 美国政府 L5 (DOD) 由世纪互联运营的中国
✅ ❌ ❌ ❌

权限

为此 API 选择标记为最低特权的权限。 只有在应用需要它时,才使用更高的特权权限。 有关委派权限和应用程序权限的详细信息,请参阅权限类型。 要了解有关这些权限的详细信息,请参阅 权限参考。

权限类型 最低特权权限 更高特权权限
委派(工作或学校帐户) AgentInstance.ReadWrite.All 不可用。
委派(个人 Microsoft 帐户) 不支持。 不支持。
应用程序 AgentInstance.ReadWrite.All AgentInstance.ReadWrite.ManagedBy

重要

使用委派权限时,必须为经过身份验证的用户分配受支持的 Microsoft Entra 角色 或授予此操作所需权限的自定义角色。

代理注册表管理员是 此操作支持的最低特权角色。

HTTP 请求

PATCH /agentRegistry/agentInstances/{agentInstanceId}

请求标头

名称 说明
Authorization 持有者 {token}。 必填。 详细了解 身份验证和授权。
Content-Type application/json. 必需。

请求正文

在请求正文中, 仅 提供要更新的属性的值。 请求正文中未包含的现有属性会保留其以前的值,或者会根据其他属性值的更改重新计算。

下表指定可更新的属性。

属性 类型 说明
ownerIds 字符串集合 代理实例的所有者标识符列表,可以是用户或服务主体。 必填。
managedBy String 管理此代理的应用程序标识符。 可选。
originatingStore String 代理来源的存储/系统的名称。 可选。
createdBy String 创建代理实例的用户 (只读) 。 可选。
displayName String 代理实例的显示名称。 必填。
sourceAgentId String 源系统中的原始代理标识符。 可选。
agentIdentityBlueprintId String 代理标识蓝图标识符。 可选。
agentIdentityId String Entra 代理标识符。 可选。
agentUserId String 与代理关联的用户标识符。 可选。
createdDateTime DateTimeOffset 创建代理实例 (只读) 的时间戳。 可选。
lastModifiedDateTime DateTimeOffset 上次修改的时间戳 (只读) 。 可选。
url String 代理实例的终结点 URL。 可选。
preferredTransport String 首选传输协议 (JSONRPC、GRPC、HTTP+JSON) 。 可选。
additionalInterfaces agentInterface 集合 代理支持的其他接口/传输 (url、传输) 。 可选。
签名 agentCardSignature 集合 代理实例的数字签名 (受保护、签名、标头) 。 可选。

响应

如果成功,此方法将在响应正文中返回 200 OK 响应代码和更新的 agentInstance 对象。

示例

示例 1:更新 agentInstance 中的 agentCardManifest

请求

以下示例显示了一个请求。 如果 agentCardManifest 尚不存在,则该请求还会创建它。

PATCH https://graph.microsoft.com/beta/agentRegistry/agentInstances/{agentInstanceId}
Content-Type: application/json

{
  "agentCardManifest": {
    "ownerIds": [
      "0ef68a76-e247-41dd-947b-41282760a2ac"
    ],
    "originatingStore": "Copilot Studio",
    "displayName": "Conditional Access Agent Card",
    "description": "Manages organizational conditional access policies",
    "iconUrl": "https://example.com/icon.png",
    "provider": {
      "organization": "Test Organization",
      "url": "https://contoso.com"
    },
    "protocolVersion": "1.0",
    "version": "1.0.0",
    "documentationUrl": "https://example.com/docs",
    "capabilities": {
      "streaming": false,
      "pushNotifications": false,
      "stateTransitionHistory": true,
      "extensions": [
        {
          "uri": "https://contoso.example.com/a2a/capabilities/secureMessaging",
          "description": null,
          "required": false,
          "params": {
            "useHttps": true
          }
        }
      ]
    },
    "defaultInputModes": [
      "application/json"
    ],
    "defaultOutputModes": [
      "application/json",
      "text/html"
    ],
    "supportsAuthenticatedExtendedCard": true,
    "skills": [
      {
        "id": "threat-detection",
        "displayName": "Threat Detection",
        "description": "Detect security threats in real-time",
        "tags": [
          "security",
          "threat",
          "detection"
        ],
        "examples": [
          "Analyze this log for threats",
          "Check for malware"
        ],
        "inputModes": [
          "application/json",
          "text/plain"
        ],
        "outputModes": [
          "application/json",
          "text/html"
        ]
      }
    ]
  }
}

响应

以下示例显示了相应的响应。

HTTP/1.1 204 No Content

示例 2:更新 agentInstance 以引用现有 agentCardManifest

请求

以下示例显示了一个请求。

PATCH https://graph.microsoft.com/beta/agentRegistry/agentInstances/{agentInstanceId}
Content-Type: application/json

{
  "agentCardManifest@odata.bind": "https://graph.microsoft.com/beta/agentRegistry/agentCardManifests('employee-assistant')"
}

响应

以下示例显示了相应的响应。

HTTP/1.1 204 No Content

示例 3:更新 displayName

请求

以下示例显示了一个请求。

PATCH https://graph.microsoft.com/beta/agentRegistry/agentInstances/{agentInstanceId}
Content-Type: application/json

{
  "displayName": "Teams Meeting Scheduler Agent"
}

响应

以下示例显示了相应的响应。

HTTP/1.1 204 No Content