copilot-sdk

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

GitHub Copilot SDK

GitHub Copilot SDK

Build applications that programmatically interact with GitHub Copilot. The SDK wraps the Copilot CLI via JSON-RPC, providing session management, custom tools, hooks, MCP server integration, and streaming across Node.js, Python, Go, and .NET.
构建可与GitHub Copilot进行程序化交互的应用程序。该SDK通过JSON-RPC封装Copilot CLI,提供会话管理、自定义工具、钩子、MCP服务器集成功能,并支持在Node.js、Python、Go和.NET中实现流式响应。

Prerequisites

前提条件

  • GitHub Copilot CLI installed and authenticated (
    copilot --version
    to verify)
  • GitHub Copilot subscription (Individual, Business, or Enterprise) — not required for BYOK
  • Runtime: Node.js 18+ / Python 3.8+ / Go 1.21+ / .NET 8.0+
  • 已安装并完成身份验证的GitHub Copilot CLI(运行
    copilot --version
    验证)
  • GitHub Copilot订阅(个人版、商业版或企业版)——使用BYOK时无需订阅
  • 运行环境要求:Node.js 18+ / Python 3.8+ / Go 1.21+ / .NET 8.0+

Installation

安装

LanguagePackageInstall
Node.js
@github/copilot-sdk
npm install @github/copilot-sdk
Python
github-copilot-sdk
pip install github-copilot-sdk
Go
github.com/github/copilot-sdk/go
go get github.com/github/copilot-sdk/go
.NET
GitHub.Copilot.SDK
dotnet add package GitHub.Copilot.SDK

语言安装命令
Node.js
@github/copilot-sdk
npm install @github/copilot-sdk
Python
github-copilot-sdk
pip install github-copilot-sdk
Go
github.com/github/copilot-sdk/go
go get github.com/github/copilot-sdk/go
.NET
GitHub.Copilot.SDK
dotnet add package GitHub.Copilot.SDK

Core Pattern: Client → Session → Message

核心模式:客户端 → 会话 → 消息

All SDK usage follows this pattern: create a client, create a session, send messages.
所有SDK的使用都遵循此模式:创建客户端、创建会话、发送消息。

Node.js / TypeScript

Node.js / TypeScript

typescript
import { CopilotClient } from "@github/copilot-sdk";

const client = new CopilotClient();
const session = await client.createSession({ model: "gpt-4.1" });

const response = await session.sendAndWait({ prompt: "What is 2 + 2?" });
console.log(response?.data.content);

await client.stop();
typescript
import { CopilotClient } from "@github/copilot-sdk";

const client = new CopilotClient();
const session = await client.createSession({ model: "gpt-4.1" });

const response = await session.sendAndWait({ prompt: "What is 2 + 2?" });
console.log(response?.data.content);

await client.stop();

Python

Python

python
import asyncio
from copilot import CopilotClient

async def main():
    client = CopilotClient()
    await client.start()
    session = await client.create_session({"model": "gpt-4.1"})
    response = await session.send_and_wait({"prompt": "What is 2 + 2?"})
    print(response.data.content)
    await client.stop()

asyncio.run(main())
python
import asyncio
from copilot import CopilotClient

async def main():
    client = CopilotClient()
    await client.start()
    session = await client.create_session({"model": "gpt-4.1"})
    response = await session.send_and_wait({"prompt": "What is 2 + 2?"})
    print(response.data.content)
    await client.stop()

asyncio.run(main())

Go

Go

go
client := copilot.NewClient(nil)
if err := client.Start(ctx); err != nil { log.Fatal(err) }
defer client.Stop()

session, _ := client.CreateSession(ctx, &copilot.SessionConfig{Model: "gpt-4.1"})
response, _ := session.SendAndWait(ctx, copilot.MessageOptions{Prompt: "What is 2 + 2?"})
fmt.Println(*response.Data.Content)
go
client := copilot.NewClient(nil)
if err := client.Start(ctx); err != nil { log.Fatal(err) }
defer client.Stop()

session, _ := client.CreateSession(ctx, &copilot.SessionConfig{Model: "gpt-4.1"})
response, _ := session.SendAndWait(ctx, copilot.MessageOptions{Prompt: "What is 2 + 2?"})
fmt.Println(*response.Data.Content)

.NET

.NET

csharp
await using var client = new CopilotClient();
await using var session = await client.CreateSessionAsync(new SessionConfig { Model = "gpt-4.1" });
var response = await session.SendAndWaitAsync(new MessageOptions { Prompt = "What is 2 + 2?" });
Console.WriteLine(response?.Data.Content);

csharp
await using var client = new CopilotClient();
await using var session = await client.CreateSessionAsync(new SessionConfig { Model = "gpt-4.1" });
var response = await session.SendAndWaitAsync(new MessageOptions { Prompt = "What is 2 + 2?" });
Console.WriteLine(response?.Data.Content);

Streaming Responses

流式响应

Enable real-time output by setting
streaming: true
and subscribing to delta events.
typescript
const session = await client.createSession({ model: "gpt-4.1", streaming: true });

session.on("assistant.message_delta", (event) => {
    process.stdout.write(event.data.deltaContent);
});
session.on("session.idle", () => console.log());

await session.sendAndWait({ prompt: "Tell me a joke" });
Python equivalent:
python
from copilot.generated.session_events import SessionEventType

session = await client.create_session({"model": "gpt-4.1", "streaming": True})

def handle_event(event):
    if event.type == SessionEventType.ASSISTANT_MESSAGE_DELTA:
        sys.stdout.write(event.data.delta_content)
        sys.stdout.flush()

session.on(handle_event)
await session.send_and_wait({"prompt": "Tell me a joke"})
通过设置
streaming: true
并订阅delta事件,实现实时输出。
typescript
const session = await client.createSession({ model: "gpt-4.1", streaming: true });

session.on("assistant.message_delta", (event) => {
    process.stdout.write(event.data.deltaContent);
});
session.on("session.idle", () => console.log());

await session.sendAndWait({ prompt: "Tell me a joke" });
Python 等效实现:
python
from copilot.generated.session_events import SessionEventType

session = await client.create_session({"model": "gpt-4.1", "streaming": True})

def handle_event(event):
    if event.type == SessionEventType.ASSISTANT_MESSAGE_DELTA:
        sys.stdout.write(event.data.delta_content)
        sys.stdout.flush()

session.on(handle_event)
await session.send_and_wait({"prompt": "Tell me a joke"})

Event Subscription

事件订阅

MethodDescription
on(handler)
Subscribe to all events; returns unsubscribe function
on(eventType, handler)
Subscribe to specific event type (Node.js only)

方法描述
on(handler)
订阅所有事件;返回取消订阅函数
on(eventType, handler)
订阅特定事件类型(仅Node.js支持)

Custom Tools

自定义工具

Define tools that Copilot can call to extend its capabilities.
定义Copilot可调用的工具以扩展其功能。

Node.js

Node.js

typescript
import { CopilotClient, defineTool } from "@github/copilot-sdk";

const getWeather = defineTool("get_weather", {
    description: "Get the current weather for a city",
    parameters: {
        type: "object",
        properties: { city: { type: "string", description: "The city name" } },
        required: ["city"],
    },
    handler: async ({ city }) => ({ city, temperature: "72°F", condition: "sunny" }),
});

const session = await client.createSession({
    model: "gpt-4.1",
    tools: [getWeather],
});
typescript
import { CopilotClient, defineTool } from "@github/copilot-sdk";

const getWeather = defineTool("get_weather", {
    description: "Get the current weather for a city",
    parameters: {
        type: "object",
        properties: { city: { type: "string", description: "The city name" } },
        required: ["city"],
    },
    handler: async ({ city }) => ({ city, temperature: "72°F", condition: "sunny" }),
});

const session = await client.createSession({
    model: "gpt-4.1",
    tools: [getWeather],
});

Python

Python

python
from copilot.tools import define_tool
from pydantic import BaseModel, Field

class GetWeatherParams(BaseModel):
    city: str = Field(description="The city name")

@define_tool(description="Get the current weather for a city")
async def get_weather(params: GetWeatherParams) -> dict:
    return {"city": params.city, "temperature": "72°F", "condition": "sunny"}

session = await client.create_session({"model": "gpt-4.1", "tools": [get_weather]})
python
from copilot.tools import define_tool
from pydantic import BaseModel, Field

class GetWeatherParams(BaseModel):
    city: str = Field(description="The city name")

@define_tool(description="Get the current weather for a city")
async def get_weather(params: GetWeatherParams) -> dict:
    return {"city": params.city, "temperature": "72°F", "condition": "sunny"}

session = await client.create_session({"model": "gpt-4.1", "tools": [get_weather]})

Go

Go

go
type WeatherParams struct {
    City string `json:"city" jsonschema:"The city name"`
}

getWeather := copilot.DefineTool("get_weather", "Get weather for a city",
    func(params WeatherParams, inv copilot.ToolInvocation) (WeatherResult, error) {
        return WeatherResult{City: params.City, Temperature: "72°F"}, nil
    },
)

session, _ := client.CreateSession(ctx, &copilot.SessionConfig{
    Model: "gpt-4.1",
    Tools: []copilot.Tool{getWeather},
})
go
type WeatherParams struct {
    City string `json:"city" jsonschema:"The city name"`
}

getWeather := copilot.DefineTool("get_weather", "Get weather for a city",
    func(params WeatherParams, inv copilot.ToolInvocation) (WeatherResult, error) {
        return WeatherResult{City: params.City, Temperature: "72°F"}, nil
    },
)

session, _ := client.CreateSession(ctx, &copilot.SessionConfig{
    Model: "gpt-4.1",
    Tools: []copilot.Tool{getWeather},
})

.NET

.NET

csharp
var getWeather = AIFunctionFactory.Create(
    ([Description("The city name")] string city) => new { city, temperature = "72°F" },
    "get_weather", "Get the current weather for a city");

await using var session = await client.CreateSessionAsync(new SessionConfig {
    Model = "gpt-4.1", Tools = [getWeather],
});

csharp
var getWeather = AIFunctionFactory.Create(
    ([Description("The city name")] string city) => new { city, temperature = "72°F" },
    "get_weather", "Get the current weather for a city");

await using var session = await client.CreateSessionAsync(new SessionConfig {
    Model = "gpt-4.1", Tools = [getWeather],
});

Hooks

钩子

Intercept and customize session behavior at key lifecycle points.
HookTriggerUse Case
onPreToolUse
Before tool executesPermission control, argument modification
onPostToolUse
After tool executesResult transformation, logging
onUserPromptSubmitted
User sends messagePrompt modification, filtering
onSessionStart
Session beginsAdd context, configure session
onSessionEnd
Session endsCleanup, analytics
onErrorOccurred
Error happensCustom error handling, retry logic
在关键生命周期节点拦截并自定义会话行为。
钩子触发时机适用场景
onPreToolUse
工具执行前权限控制、参数修改
onPostToolUse
工具执行后结果转换、日志记录
onUserPromptSubmitted
用户发送消息时提示词修改、内容过滤
onSessionStart
会话开始时添加上下文、配置会话
onSessionEnd
会话结束时清理资源、数据分析
onErrorOccurred
发生错误时自定义错误处理、重试逻辑

Example: Tool Permission Control

示例:工具权限控制

typescript
const session = await client.createSession({
    hooks: {
        onPreToolUse: async (input) => {
            if (["shell", "bash"].includes(input.toolName)) {
                return { permissionDecision: "deny", permissionDecisionReason: "Shell access not permitted" };
            }
            return { permissionDecision: "allow" };
        },
    },
});
typescript
const session = await client.createSession({
    hooks: {
        onPreToolUse: async (input) => {
            if (["shell", "bash"].includes(input.toolName)) {
                return { permissionDecision: "deny", permissionDecisionReason: "Shell access not permitted" };
            }
            return { permissionDecision: "allow" };
        },
    },
});

Pre-Tool Use Output

工具执行前输出字段

FieldTypeDescription
permissionDecision
"allow"
|
"deny"
|
"ask"
Whether to allow the tool call
permissionDecisionReason
stringExplanation for deny/ask
modifiedArgs
objectModified arguments to pass
additionalContext
stringExtra context for conversation
suppressOutput
booleanHide tool output from conversation

字段类型描述
permissionDecision
"allow"
|
"deny"
|
"ask"
是否允许工具调用
permissionDecisionReason
string拒绝/询问的原因说明
modifiedArgs
object要传递的修改后参数
additionalContext
string对话的额外上下文
suppressOutput
boolean隐藏工具输出不显示在对话中

MCP Server Integration

MCP服务器集成

Connect to MCP servers for pre-built tool capabilities.
连接到MCP服务器以使用预构建的工具功能。

Remote HTTP Server

远程HTTP服务器

typescript
const session = await client.createSession({
    mcpServers: {
        github: { type: "http", url: "https://api.githubcopilot.com/mcp/" },
    },
});
typescript
const session = await client.createSession({
    mcpServers: {
        github: { type: "http", url: "https://api.githubcopilot.com/mcp/" },
    },
});

Local Stdio Server

本地标准输入输出服务器

typescript
const session = await client.createSession({
    mcpServers: {
        filesystem: {
            type: "local",
            command: "npx",
            args: ["-y", "@modelcontextprotocol/server-filesystem", "/allowed/path"],
            tools: ["*"],
        },
    },
});
typescript
const session = await client.createSession({
    mcpServers: {
        filesystem: {
            type: "local",
            command: "npx",
            args: ["-y", "@modelcontextprotocol/server-filesystem", "/allowed/path"],
            tools: ["*"],
        },
    },
});

MCP Config Fields

MCP配置字段

FieldTypeDescription
type
"local"
|
"http"
Server transport type
command
stringExecutable path (local)
args
string[]Command arguments (local)
url
stringServer URL (http)
tools
string[]
["*"]
or specific tool names
env
objectEnvironment variables
cwd
stringWorking directory (local)
timeout
numberTimeout in milliseconds

字段类型描述
type
"local"
|
"http"
服务器传输类型
command
string可执行文件路径(本地服务器)
args
string[]命令参数(本地服务器)
url
string服务器URL(HTTP服务器)
tools
string[]
["*"]
或特定工具名称
env
object环境变量
cwd
string工作目录(本地服务器)
timeout
number超时时间(毫秒)

Authentication

身份验证

Methods (Priority Order)

验证方式(优先级顺序)

  1. Explicit token
    githubToken
    in constructor
  2. Environment variables
    COPILOT_GITHUB_TOKEN
    GH_TOKEN
    GITHUB_TOKEN
  3. Stored OAuth — From
    copilot auth login
  4. GitHub CLI
    gh auth
    credentials
  1. 显式令牌 — 构造函数中的
    githubToken
    参数
  2. 环境变量
    COPILOT_GITHUB_TOKEN
    GH_TOKEN
    GITHUB_TOKEN
  3. 存储的OAuth凭证 — 来自
    copilot auth login
    命令
  4. GitHub CLI凭证
    gh auth
    命令保存的凭证

Programmatic Token

程序化令牌设置

typescript
const client = new CopilotClient({ githubToken: process.env.GITHUB_TOKEN });
typescript
const client = new CopilotClient({ githubToken: process.env.GITHUB_TOKEN });

BYOK (Bring Your Own Key)

BYOK(自带密钥)

Use your own API keys — no Copilot subscription required.
typescript
const session = await client.createSession({
    model: "gpt-5.2-codex",
    provider: {
        type: "openai",
        baseUrl: "https://your-resource.openai.azure.com/openai/v1/",
        wireApi: "responses",
        apiKey: process.env.FOUNDRY_API_KEY,
    },
});
ProviderTypeNotes
OpenAI
"openai"
OpenAI API and compatible endpoints
Azure OpenAI
"azure"
Native Azure endpoints (don't include
/openai/v1
)
Azure AI Foundry
"openai"
OpenAI-compatible Foundry endpoints
Anthropic
"anthropic"
Claude models
Ollama
"openai"
Local models, no API key needed
Wire API: Use
"responses"
for GPT-5 series,
"completions"
(default) for others.

使用您自己的API密钥——无需Copilot订阅。
typescript
const session = await client.createSession({
    model: "gpt-5.2-codex",
    provider: {
        type: "openai",
        baseUrl: "https://your-resource.openai.azure.com/openai/v1/",
        wireApi: "responses",
        apiKey: process.env.FOUNDRY_API_KEY,
    },
});
提供商类型说明
OpenAI
"openai"
OpenAI API及兼容端点
Azure OpenAI
"azure"
原生Azure端点(请勿包含
/openai/v1
Azure AI Foundry
"openai"
兼容OpenAI的Foundry端点
Anthropic
"anthropic"
Claude系列模型
Ollama
"openai"
本地模型,无需API密钥
Wire API: GPT-5系列使用
"responses"
,其他模型使用默认值
"completions"

Session Persistence

会话持久化

Resume sessions across restarts by providing your own session ID.
typescript
// Create with explicit ID
const session = await client.createSession({
    sessionId: "user-123-task-456",
    model: "gpt-4.1",
});

// Resume later
const resumed = await client.resumeSession("user-123-task-456");
await resumed.sendAndWait({ prompt: "What did we discuss?" });
Session management:
typescript
const sessions = await client.listSessions();          // List all
await client.deleteSession("user-123-task-456");       // Delete
await session.destroy();                                // Destroy active
BYOK sessions: Must re-provide
provider
config on resume (keys are not persisted).
通过提供自定义会话ID,可在重启后恢复会话。
typescript
// 使用显式ID创建会话
const session = await client.createSession({
    sessionId: "user-123-task-456",
    model: "gpt-4.1",
});

// 后续恢复会话
const resumed = await client.resumeSession("user-123-task-456");
await resumed.sendAndWait({ prompt: "What did we discuss?" });
会话管理:
typescript
const sessions = await client.listSessions();          // 列出所有会话
await client.deleteSession("user-123-task-456");       // 删除会话
await session.destroy();                                // 销毁活跃会话
BYOK会话注意事项: 恢复时必须重新提供
provider
配置(密钥不会被持久化)。

Infinite Sessions

无限会话

For long-running workflows that may exceed context limits:
typescript
const session = await client.createSession({
    infiniteSessions: {
        enabled: true,
        backgroundCompactionThreshold: 0.80,
        bufferExhaustionThreshold: 0.95,
    },
});

适用于可能超出上下文限制的长期运行工作流:
typescript
const session = await client.createSession({
    infiniteSessions: {
        enabled: true,
        backgroundCompactionThreshold: 0.80,
        bufferExhaustionThreshold: 0.95,
    },
});

Custom Agents

自定义Agent

Define specialized AI personas:
typescript
const session = await client.createSession({
    customAgents: [{
        name: "pr-reviewer",
        displayName: "PR Reviewer",
        description: "Reviews pull requests for best practices",
        prompt: "You are an expert code reviewer. Focus on security, performance, and maintainability.",
    }],
});

定义专用的AI角色:
typescript
const session = await client.createSession({
    customAgents: [{
        name: "pr-reviewer",
        displayName: "PR Reviewer",
        description: "Reviews pull requests for best practices",
        prompt: "You are an expert code reviewer. Focus on security, performance, and maintainability.",
    }],
});

System Message

系统消息

Control AI behavior and personality:
typescript
const session = await client.createSession({
    systemMessage: { content: "You are a helpful assistant. Always be concise." },
});

控制AI的行为和个性:
typescript
const session = await client.createSession({
    systemMessage: { content: "You are a helpful assistant. Always be concise." },
});

Skills Integration

技能集成

Load skill directories to extend Copilot's capabilities:
typescript
const session = await client.createSession({
    skillDirectories: ["./skills/code-review", "./skills/documentation"],
    disabledSkills: ["experimental-feature"],
});

加载技能目录以扩展Copilot的功能:
typescript
const session = await client.createSession({
    skillDirectories: ["./skills/code-review", "./skills/documentation"],
    disabledSkills: ["experimental-feature"],
});

Permission & Input Handlers

权限与输入处理器

Handle tool permissions and user input requests programmatically:
typescript
const session = await client.createSession({
    onPermissionRequest: async (request) => {
        // Auto-approve git commands only
        if (request.kind === "shell") {
            return { approved: request.command.startsWith("git") };
        }
        return { approved: true };
    },
    onUserInputRequest: async (request) => {
        // Handle ask_user tool calls
        return { response: "yes" };
    },
});

程序化处理工具权限和用户输入请求:
typescript
const session = await client.createSession({
    onPermissionRequest: async (request) => {
        // 仅自动批准Git命令
        if (request.kind === "shell") {
            return { approved: request.command.startsWith("git") };
        }
        return { approved: true };
    },
    onUserInputRequest: async (request) => {
        // 处理ask_user工具调用
        return { response: "yes" };
    },
});

External CLI Server

外部CLI服务器

Connect to a separately running CLI instead of auto-managing the process:
bash
copilot --headless --port 4321
typescript
const client = new CopilotClient({ cliUrl: "localhost:4321" });

连接到独立运行的CLI,而非自动管理进程:
bash
copilot --headless --port 4321
typescript
const client = new CopilotClient({ cliUrl: "localhost:4321" });

Client Configuration

客户端配置

OptionTypeDescription
cliPath
stringPath to Copilot CLI executable
cliUrl
stringURL of external CLI server
githubToken
stringGitHub token for auth
useLoggedInUser
booleanUse stored CLI credentials (default: true)
logLevel
string
"none"
|
"error"
|
"warning"
|
"info"
|
"debug"
autoRestart
booleanAuto-restart CLI on crash (default: true)
useStdio
booleanUse stdio transport (default: true)
选项类型描述
cliPath
stringCopilot CLI可执行文件的路径
cliUrl
string外部CLI服务器的URL
githubToken
string用于身份验证的GitHub令牌
useLoggedInUser
boolean使用存储的CLI凭证(默认值:true)
logLevel
string
"none"
|
"error"
|
"warning"
|
"info"
|
"debug"
autoRestart
booleanCLI崩溃时自动重启(默认值:true)
useStdio
boolean使用标准输入输出传输(默认值:true)

Session Configuration

会话配置

OptionTypeDescription
model
stringModel to use (e.g.,
"gpt-4.1"
)
sessionId
stringCustom ID for resumable sessions
streaming
booleanEnable streaming responses
tools
Tool[]Custom tools
mcpServers
objectMCP server configurations
hooks
objectSession hooks
provider
objectBYOK provider config
customAgents
object[]Custom agent definitions
systemMessage
objectSystem message override
skillDirectories
string[]Directories to load skills from
disabledSkills
string[]Skills to disable
reasoningEffort
stringReasoning effort level
availableTools
string[]Restrict available tools
excludedTools
string[]Exclude specific tools
infiniteSessions
objectAuto-compaction config
workingDirectory
stringWorking directory

选项类型描述
model
string使用的模型(例如:
"gpt-4.1"
sessionId
string用于恢复会话的自定义ID
streaming
boolean启用流式响应
tools
Tool[]自定义工具
mcpServers
objectMCP服务器配置
hooks
object会话钩子
provider
objectBYOK提供商配置
customAgents
object[]自定义Agent定义
systemMessage
object系统消息覆盖配置
skillDirectories
string[]加载技能的目录路径
disabledSkills
string[]要禁用的技能
reasoningEffort
string推理力度级别
availableTools
string[]限制可用工具范围
excludedTools
string[]排除特定工具
infiniteSessions
object自动压缩配置
workingDirectory
string工作目录

Debugging

调试

Enable debug logging to troubleshoot issues:
typescript
const client = new CopilotClient({ logLevel: "debug" });
Common issues:
  • CLI not found
    → Install CLI or set
    cliPath
  • Not authenticated
    → Run
    copilot auth login
    or provide
    githubToken
  • Session not found
    → Don't use session after
    destroy()
  • Connection refused
    → Check CLI process, enable
    autoRestart

启用调试日志以排查问题:
typescript
const client = new CopilotClient({ logLevel: "debug" });
常见问题:
  • CLI not found
    → 安装CLI或设置
    cliPath
    参数
  • Not authenticated
    → 运行
    copilot auth login
    或提供
    githubToken
  • Session not found
    → 会话调用
    destroy()
    后请勿再使用
  • Connection refused
    → 检查CLI进程状态,启用
    autoRestart

Key API Summary

核心API汇总

LanguageClientSession CreateSendStop
Node.js
new CopilotClient()
client.createSession()
session.sendAndWait()
client.stop()
Python
CopilotClient()
client.create_session()
session.send_and_wait()
client.stop()
Go
copilot.NewClient(nil)
client.CreateSession()
session.SendAndWait()
client.Stop()
.NET
new CopilotClient()
client.CreateSessionAsync()
session.SendAndWaitAsync()
client.DisposeAsync()
语言客户端创建会话创建消息发送停止客户端
Node.js
new CopilotClient()
client.createSession()
session.sendAndWait()
client.stop()
Python
CopilotClient()
client.create_session()
session.send_and_wait()
client.stop()
Go
copilot.NewClient(nil)
client.CreateSession()
session.SendAndWait()
client.Stop()
.NET
new CopilotClient()
client.CreateSessionAsync()
session.SendAndWaitAsync()
client.DisposeAsync()

References

参考资料

When to Use

适用场景

This skill is applicable to execute the workflow or actions described in the overview.
本技能适用于执行概述中描述的工作流或操作。