AGENT SKILL

Copilot Studio 智能体消息发送

chat-sdk

通过 Copilot Studio Client SDK (M365) 向 Copilot Studio 智能体发送消息。适用于集成了身份验证(Entra ID SSO)的智能体。需要提供应用注册(App Registration)客户端 ID。

适用职业AI 工程师
使用场景智能体开发
License 许可
MIT
最近更新
2026-11-12
Stars
★ 493
Forks
103

01 前言 Front Matter

agent
copilot-studio-test
description
Send a message to a Copilot Studio agent via the Copilot Studio Client SDK (M365). Use for agents with integrated auth (Entra ID SSO). Requires an App Registration Client ID.
allowed-tools
Bash(node *chat-with-agent.bundle.js *), Read, Glob
argument-hint
<utterance>
user-invocable
false

03 SKILL.md 正文

Chat via Copilot Studio SDK

Send a single utterance to a published agent via the Copilot Studio Client SDK. Use this for agents with integrated authentication / Entra ID SSO (authenticationmode 2).

Prerequisites

Requires prior authentication via /copilot-studio:test-auth. Do NOT ask the user for a client ID yourself — the test-auth skill handles app registration setup and authentication.

Instructions

  1. Run the script with --client-id and the utterance from $ARGUMENTS:

    node ${CLAUDE_SKILL_DIR}/../../scripts/chat-with-agent.bundle.js \
      --client-id "<clientId>" "<utterance>" [--agent-dir <path>]
    
  2. Authentication: Requires prior authentication via /copilot-studio:test-auth. The token is cached in the "test-agent" slot and shared with the eval API. If auth fails or the SDK hangs, tell the caller to re-run test-auth.

  3. Parse the JSON output from stdout:

{
  "status": "ok",
  "protocol": "m365",
  "utterance": "hello",
  "conversation_id": "abc123-...",
  "start_activities": [ ... ],
  "activities": [ ... ]
}

Display the agent's response from the activities array:

  • Text: activities where type === "message" — show text
  • Suggested actions: suggestedActions.actions array
  • Adaptive cards: attachments with contentType === "application/vnd.microsoft.card.adaptive"

Save conversation_id for follow-ups.

Multi-turn

Pass --conversation-id from the previous response:

node ${CLAUDE_SKILL_DIR}/../../scripts/chat-with-agent.bundle.js \
  --client-id "<id>" "<follow-up>" --conversation-id "<id>"

SDK sessions do not expire as quickly as DirectLine. Reuse conversation_id automatically for follow-ups.

Error Handling

Error Cause Resolution
Authentication failed Wrong client ID or tenant Verify app registration and permissions
Could not obtain conversation_id Agent not published or wrong config Verify agent is published

04 同仓库更多 Skills

microsoft
microsoft/skills-for-copilot-studio

Copilot Studio YAML 校验

validate

使用 LSP 二进制文件的完整诊断能力(YAML 结构、Power Fx、schema、跨文件引用)校验 Copilot Studio 智能体的 YAML 文件。当用户要求检查、验证或核对 YAML 文件时使用。

AI 工程师智能体开发
★ 493
microsoft
microsoft/skills-for-copilot-studio

Copilot Studio 测试身份验证

test-auth

为 Copilot Studio 评估 API 和 SDK 聊天进行身份验证。缓存一个在 run-eval 和 chat-sdk 技能之间共享的令牌。在任何评估或 SDK 聊天工作流之前运行此技能。要求使用具有 MakerOperations 和 Copilots.Invoke 权限的 App Registration。

AI 工程师智能体开发
★ 493
microsoft
microsoft/skills-for-copilot-studio

Copilot Studio Kit 批量测试

run-tests-kit

通过 Copilot Studio Kit (Dataverse API) 运行批量测试套件。使用 Power CAT Copilot Studio Kit 对已发布的智能体执行测试用例,并生成包含延迟的通过/失败结果。要求环境中已安装 Kit、具有 Dataverse 权限的 App Registration,以及已发布的智能体。

AI 工程师测试与质量保障
★ 493
microsoft
microsoft/skills-for-copilot-studio

Copilot Studio 智能体评估运行

run-eval

通过 Power Platform Evaluation API 对 Copilot Studio 智能体运行评估。适用于草稿(DRAFT)智能体——无需发布步骤。列出测试集、启动运行、轮询直至完成、获取结果,并针对失败提出 YAML 修复建议。当用户希望在不发布的情况下测试智能体更改时使用。

AI 工程师智能体开发
★ 493
microsoft
microsoft/skills-for-copilot-studio

Copilot Studio 主题创建

new-topic

创建一个新的 Copilot Studio 主题(topic)YAML 文件。当用户要求为其智能体创建新主题、对话流程或对话框时使用。

AI 工程师智能体开发
★ 493
microsoft
microsoft/skills-for-copilot-studio

Copilot Studio 智能体管理

manage-agent

通过 VS Code 扩展的 LanguageServerHost LSP 二进制文件推送/拉取 Copilot Studio 智能体内容。处理身份验证(推送/拉取使用交互式浏览器登录,聊天令牌使用设备代码流)、同步推送、同步拉取、克隆和差异比较操作。

AI 工程师智能体开发
★ 493