Skip to content

Commit 503867b

Browse files
authored
Merge pull request #45249 from github/repo-sync
Repo sync
2 parents 7b5b3c9 + 3fc31ea commit 503867b

35 files changed

Lines changed: 1308 additions & 217 deletions
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
applyTo: ".github/instructions/**,.github/agents/**"
3+
---
4+
5+
# Editing Copilot content instruction and agent files
6+
7+
This applies when you add, edit, or remove a Copilot instruction or shared agent file that guides how **content** (articles, data files) is written. It does **not** apply to code instructions or agents owned by the engineering team (for example `code.instructions.md`).
8+
9+
When it applies, you **must** first read the instruction-architecture doc in full and follow it:
10+
11+
https://github.com/github/docs-team/blob/main/contributing-to-docs/docs-work/copilot-instruction-architecture.md
12+
13+
Read the current version every time (from a local `github/docs-team` checkout if you have one, otherwise fetch the URL); do not rely on your memory of it, because it changes. If you cannot access it, say so and stop rather than guessing.
6 Bytes
Loading
29 Bytes
Loading
13.7 KB
Loading

content/copilot/how-tos/copilot-sdk/auth/authenticate.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ contentType: how-tos
2323
| [GitHub Signed-in User](#github-signed-in-user) | Interactive apps where users sign in with GitHub | Yes |
2424
| [OAuth GitHub App](#oauth-github-app) | Apps acting on behalf of users via OAuth | Yes |
2525
| [Environment Variables](#environment-variables) | CI/CD, automation, server-to-server | Yes |
26-
| [AUTOTITLE](/copilot/how-tos/copilot-sdk/auth/byok) | Using your own API keys (Azure AI Foundry, OpenAI, etc.) | No |
26+
| [AUTOTITLE](/copilot/how-tos/copilot-sdk/auth/byok) | Using your own API keys (Azure AI Foundry, OpenAI, and more) | No |
2727

2828
## GitHub signed-in user
2929

@@ -216,7 +216,7 @@ client.start().get();
216216

217217
**Supported token types:**
218218
* `gho_` - OAuth user access tokens
219-
* `ghu_` - GitHub App user access tokens
219+
* `ghu_` - GitHub App user access tokens
220220
* `github_pat_` - Fine-grained personal access tokens
221221

222222
**Not supported:**
@@ -269,7 +269,7 @@ await client.start()
269269
{% endcodetabs %}
270270

271271
**When to use:**
272-
* CI/CD pipelines (GitHub Actions, Jenkins, etc.)
272+
* CI/CD pipelines (GitHub Actions, Jenkins, and more)
273273
* Automated testing
274274
* Server-side applications with service accounts
275275
* Development when you don't want to use interactive login

content/copilot/how-tos/copilot-sdk/auth/byok.md

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import os
4141
from copilot import CopilotClient
4242
from copilot.session import PermissionHandler
4343

44-
FOUNDRY_MODEL_URL = "https://your-resource.openai.azure.com/openai/v1/"
44+
FOUNDRY_MODEL_URL = "https://<resource-name>.openai.azure.com/openai/v1/"
4545
# Set FOUNDRY_API_KEY environment variable
4646

4747
async def main():
@@ -79,7 +79,7 @@ asyncio.run(main())
7979
```typescript
8080
import { CopilotClient } from "@github/copilot-sdk";
8181

82-
const FOUNDRY_MODEL_URL = "https://your-resource.openai.azure.com/openai/v1/";
82+
const FOUNDRY_MODEL_URL = "https://<resource-name>.openai.azure.com/openai/v1/";
8383

8484
const client = new CopilotClient();
8585
const session = await client.createSession({
@@ -125,7 +125,7 @@ func main() {
125125
Model: "gpt-5.2-codex", // Your deployment name
126126
Provider: &copilot.ProviderConfig{
127127
Type: "openai",
128-
BaseURL: "https://your-resource.openai.azure.com/openai/v1/",
128+
BaseURL: "https://<resource-name>.openai.azure.com/openai/v1/",
129129
WireAPI: "responses", // Use "completions" for older models
130130
APIKey: os.Getenv("FOUNDRY_API_KEY"),
131131
},
@@ -160,7 +160,7 @@ await using var session = await client.CreateSessionAsync(new SessionConfig
160160
Provider = new ProviderConfig
161161
{
162162
Type = "openai",
163-
BaseUrl = "https://your-resource.openai.azure.com/openai/v1/",
163+
BaseUrl = "https://<resource-name>.openai.azure.com/openai/v1/",
164164
WireApi = "responses", // Use "completions" for older models
165165
ApiKey = Environment.GetEnvironmentVariable("FOUNDRY_API_KEY"),
166166
},
@@ -188,7 +188,7 @@ var session = client.createSession(new SessionConfig()
188188
.setOnPermissionRequest(PermissionHandler.APPROVE_ALL)
189189
.setProvider(new ProviderConfig()
190190
.setType("openai")
191-
.setBaseUrl("https://your-resource.openai.azure.com/openai/v1/")
191+
.setBaseUrl("https://<resource-name>.openai.azure.com/openai/v1/")
192192
.setWireApi("responses") // Use "completions" for older models
193193
.setApiKey(System.getenv("FOUNDRY_API_KEY")))
194194
).get();
@@ -213,6 +213,7 @@ client.stop().get();
213213
| `baseUrl` / `base_url` | string | **Required.** API endpoint URL |
214214
| `apiKey` / `api_key` | string | API key (optional for local providers like Ollama) |
215215
| `bearerToken` / `bearer_token` | string | Bearer token auth (takes precedence over apiKey) |
216+
| `bearerTokenProvider` / `bearer_token_provider` | callback | Returns a bearer token on demand (takes precedence over `apiKey` and `bearerToken`) |
216217
| `wireApi` / `wire_api` | `"completions"` \| `"responses"` | Select `"completions"` for broad model compatibility (the Chat Completions API); select `"responses"` for multi-turn state management, tool namespacing, and reasoning support (the Responses API). Anthropic models always use the Messages API regardless of this setting. |
217218
| `azure.apiVersion` / `azure.api_version` | string | Azure API version (default: `"2024-10-21"`) |
218219

@@ -274,7 +275,7 @@ For Azure AI Foundry deployments with `/openai/v1/` endpoints, use `type: "opena
274275
```typescript
275276
provider: {
276277
type: "openai",
277-
baseUrl: "https://your-resource.openai.azure.com/openai/v1/",
278+
baseUrl: "https://<resource-name>.openai.azure.com/openai/v1/",
278279
apiKey: process.env.FOUNDRY_API_KEY,
279280
wireApi: "responses", // For GPT-5 series models
280281
}
@@ -334,19 +335,37 @@ provider: {
334335

335336
### Bearer token authentication
336337

337-
Some providers require bearer token authentication instead of API keys:
338+
Some providers require bearer token authentication instead of API keys. Supply a static token with `bearerToken`, or supply a `bearerTokenProvider` callback that the GitHub Copilot SDK runtime invokes before outbound provider requests. The callback or identity library it wraps manages token caching and refresh.
339+
340+
Use `bearerToken` when your application already has a token:
338341

339342
```typescript
340343
provider: {
341344
type: "openai",
342-
baseUrl: "https://my-custom-endpoint.example.com/v1",
345+
baseUrl: "https://<resource-name>.openai.azure.com/openai/v1/",
343346
bearerToken: process.env.MY_BEARER_TOKEN, // Sets Authorization header
344347
}
345348
```
346349

347350
> [!NOTE]
348351
> The `bearerToken` option accepts a **static token string** only. The SDK does not refresh this token automatically. If your token expires, requests will fail and you'll need to create a new session with a fresh token.
349352
353+
Use `bearerTokenProvider` to acquire tokens on demand:
354+
355+
<!-- docs-validate: skip -->
356+
357+
```typescript
358+
provider: {
359+
type: "openai",
360+
baseUrl: "https://my-custom-endpoint.example.com/v1",
361+
bearerTokenProvider: async () => {
362+
return await acquireBearerToken();
363+
},
364+
}
365+
```
366+
367+
For more details about acquiring and refreshing Microsoft Entra bearer tokens, see [AUTOTITLE](/copilot/how-tos/copilot-sdk/setup/azure-managed-identity).
368+
350369
## Custom model listing
351370

352371
When using BYOK, the CLI server may not know which models your provider supports. You can supply a custom `onListModels` handler at the client level so that `client.listModels()` returns your provider's models in the standard `ModelInfo` format. This lets downstream consumers discover available models without querying the CLI.
@@ -531,7 +550,7 @@ import { CopilotClient } from "@github/copilot-sdk";
531550

532551
const client = new CopilotClient();
533552
const session = await client.createSession({
534-
model: "gpt-4.1",
553+
model: "gpt-5.4",
535554
provider: {
536555
type: "azure",
537556
baseUrl: "https://my-resource.openai.azure.com",
@@ -564,7 +583,7 @@ import { CopilotClient } from "@github/copilot-sdk";
564583

565584
const client = new CopilotClient();
566585
const session = await client.createSession({
567-
model: "gpt-4.1",
586+
model: "gpt-5.4",
568587
provider: {
569588
type: "openai",
570589
baseUrl: "https://your-resource.openai.azure.com/openai/v1/",

content/copilot/how-tos/copilot-sdk/features/cloud-sessions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ Capture the URL by subscribing to `session.info` and filtering by `infoType: "re
252252
session.on("session.info", (event) => {
253253
if (event.data?.infoType === "remote" && event.data.url) {
254254
console.log("Open from web or mobile:", event.data.url);
255-
// e.g. surface in your UI as a shareable link or QR code.
255+
// For example, surface in your UI as a shareable link or QR code.
256256
}
257257
});
258258
```

content/copilot/how-tos/copilot-sdk/features/custom-agents.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const client = new CopilotClient();
4343
await client.start();
4444

4545
const session = await client.createSession({
46-
model: "gpt-4.1",
46+
model: "gpt-5.4",
4747
customAgents: [
4848
{
4949
name: "researcher",
@@ -75,7 +75,7 @@ await client.start()
7575

7676
session = await client.create_session(
7777
on_permission_request=lambda req, inv: PermissionDecisionApproveOnce(),
78-
model="gpt-4.1",
78+
model="gpt-5.4",
7979
custom_agents=[
8080
{
8181
"name": "researcher",
@@ -113,7 +113,7 @@ func main() {
113113
client.Start(ctx)
114114

115115
session, _ := client.CreateSession(ctx, &copilot.SessionConfig{
116-
Model: "gpt-4.1",
116+
Model: "gpt-5.4",
117117
CustomAgents: []copilot.CustomAgentConfig{
118118
{
119119
Name: "researcher",
@@ -144,7 +144,7 @@ client := copilot.NewClient(nil)
144144
client.Start(ctx)
145145

146146
session, _ := client.CreateSession(ctx, &copilot.SessionConfig{
147-
Model: "gpt-4.1",
147+
Model: "gpt-5.4",
148148
CustomAgents: []copilot.CustomAgentConfig{
149149
{
150150
Name: "researcher",
@@ -177,7 +177,7 @@ using GitHub.Copilot.Rpc;
177177
await using var client = new CopilotClient();
178178
await using var session = await client.CreateSessionAsync(new SessionConfig
179179
{
180-
Model = "gpt-4.1",
180+
Model = "gpt-5.4",
181181
CustomAgents = new List<CustomAgentConfig>
182182
{
183183
new()
@@ -215,7 +215,7 @@ try (var client = new CopilotClient()) {
215215

216216
var session = client.createSession(
217217
new SessionConfig()
218-
.setModel("gpt-4.1")
218+
.setModel("gpt-5.4")
219219
.setCustomAgents(List.of(
220220
new CustomAgentConfig()
221221
.setName("researcher")
@@ -250,10 +250,14 @@ try (var client = new CopilotClient()) {
250250
| `mcpServers` | `object` | | MCP server configurations specific to this agent |
251251
| `infer` | `boolean` | | Whether the runtime can auto-select this agent (default: `true`) |
252252
| `skills` | `string[]` | | Skill names to preload into the agent's context at startup |
253+
| `model` | `string` | | Model identifier to use while this agent runs |
254+
| `reasoningEffort` | `string` | | Reasoning effort to use while this agent runs. When omitted, no override is sent and the backend chooses its default |
253255

254256
> [!TIP]
255257
> A good `description` helps the runtime match user intent to the right agent. Be specific about the agent's expertise and capabilities.
256258
259+
Set `model` and `reasoningEffort` to override the parent session's model settings while a custom agent runs. When `reasoningEffort` is omitted, the SDK sends no per-agent override and the backend chooses its default. The parent session effort is not inherited, and the SDK does not add a per-agent default. Python uses `reasoning_effort`, .NET uses `ReasoningEffort`, Go uses `ReasoningEffort`, Java uses `setReasoningEffort`, and Rust uses `with_reasoning_effort`.
260+
257261
In addition to per-agent configuration above, you can set `agent` on the **session config** itself to pre-select which custom agent is active when the session starts. See [Selecting an Agent at Session Creation](#selecting-an-agent-at-session-creation) below.
258262

259263
| Session Config Property | Type | Description |
@@ -429,6 +433,8 @@ By default, all custom agents are available for automatic selection (`infer: tru
429433

430434
When a sub-agent runs, the parent session emits lifecycle events. Subscribe to these events to build UIs that visualize agent activity.
431435

436+
Sub-agent-originated session events share the parent session stream and include envelope-level `agentId`. Root/main agent events and session-level events omit `agentId`, so renderers can keep the parent response separate from sub-agent traces by checking the event envelope.
437+
432438
### Event types
433439

434440
| Event | Emitted when | Data |
@@ -519,7 +525,7 @@ func main() {
519525
client.Start(ctx)
520526

521527
session, _ := client.CreateSession(ctx, &copilot.SessionConfig{
522-
Model: "gpt-4.1",
528+
Model: "gpt-5.4",
523529
OnPermissionRequest: func(req copilot.PermissionRequest, inv copilot.PermissionInvocation) (rpc.PermissionDecision, error) {
524530
return &rpc.PermissionDecisionApproveOnce{}, nil
525531
},

content/copilot/how-tos/copilot-sdk/features/image-input.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const client = new CopilotClient();
4444
await client.start();
4545

4646
const session = await client.createSession({
47-
model: "gpt-4.1",
47+
model: "gpt-5.4",
4848
onPermissionRequest: async () => ({ kind: "approve-once" }),
4949
});
5050

@@ -70,7 +70,7 @@ await client.start()
7070

7171
session = await client.create_session(
7272
on_permission_request=lambda req, inv: PermissionDecisionApproveOnce(),
73-
model="gpt-4.1",
73+
model="gpt-5.4",
7474
)
7575

7676
await session.send(
@@ -102,7 +102,7 @@ func main() {
102102
client.Start(ctx)
103103

104104
session, _ := client.CreateSession(ctx, &copilot.SessionConfig{
105-
Model: "gpt-4.1",
105+
Model: "gpt-5.4",
106106
OnPermissionRequest: func(req copilot.PermissionRequest, inv copilot.PermissionInvocation) (rpc.PermissionDecision, error) {
107107
return &rpc.PermissionDecisionApproveOnce{}, nil
108108
},
@@ -127,7 +127,7 @@ client := copilot.NewClient(nil)
127127
client.Start(ctx)
128128

129129
session, _ := client.CreateSession(ctx, &copilot.SessionConfig{
130-
Model: "gpt-4.1",
130+
Model: "gpt-5.4",
131131
OnPermissionRequest: func(req copilot.PermissionRequest, inv copilot.PermissionInvocation) (rpc.PermissionDecision, error) {
132132
return &rpc.PermissionDecisionApproveOnce{}, nil
133133
},
@@ -159,7 +159,7 @@ public static class ImageInputExample
159159
await using var client = new CopilotClient();
160160
await using var session = await client.CreateSessionAsync(new SessionConfig
161161
{
162-
Model = "gpt-4.1",
162+
Model = "gpt-5.4",
163163
OnPermissionRequest = (req, inv) =>
164164
Task.FromResult(PermissionDecision.ApproveOnce()),
165165
});
@@ -187,7 +187,7 @@ using GitHub.Copilot.Rpc;
187187
await using var client = new CopilotClient();
188188
await using var session = await client.CreateSessionAsync(new SessionConfig
189189
{
190-
Model = "gpt-4.1",
190+
Model = "gpt-5.4",
191191
OnPermissionRequest = (req, inv) =>
192192
Task.FromResult(PermissionDecision.ApproveOnce()),
193193
});
@@ -219,7 +219,7 @@ try (var client = new CopilotClient()) {
219219

220220
var session = client.createSession(
221221
new SessionConfig()
222-
.setModel("gpt-4.1")
222+
.setModel("gpt-5.4")
223223
.setOnPermissionRequest(PermissionHandler.APPROVE_ALL)
224224
).get();
225225

@@ -249,7 +249,7 @@ const client = new CopilotClient();
249249
await client.start();
250250

251251
const session = await client.createSession({
252-
model: "gpt-4.1",
252+
model: "gpt-5.4",
253253
onPermissionRequest: async () => ({ kind: "approve-once" }),
254254
});
255255

@@ -278,7 +278,7 @@ await client.start()
278278

279279
session = await client.create_session(
280280
on_permission_request=lambda req, inv: PermissionDecisionApproveOnce(),
281-
model="gpt-4.1",
281+
model="gpt-5.4",
282282
)
283283

284284
base64_image_data = "..." # your base64-encoded image
@@ -313,7 +313,7 @@ func main() {
313313
client.Start(ctx)
314314

315315
session, _ := client.CreateSession(ctx, &copilot.SessionConfig{
316-
Model: "gpt-4.1",
316+
Model: "gpt-5.4",
317317
OnPermissionRequest: func(req copilot.PermissionRequest, inv copilot.PermissionInvocation) (rpc.PermissionDecision, error) {
318318
return &rpc.PermissionDecisionApproveOnce{}, nil
319319
},
@@ -364,7 +364,7 @@ public static class BlobAttachmentExample
364364
await using var client = new CopilotClient();
365365
await using var session = await client.CreateSessionAsync(new SessionConfig
366366
{
367-
Model = "gpt-4.1",
367+
Model = "gpt-5.4",
368368
OnPermissionRequest = (req, inv) =>
369369
Task.FromResult(PermissionDecision.ApproveOnce()),
370370
});
@@ -416,7 +416,7 @@ try (var client = new CopilotClient()) {
416416

417417
var session = client.createSession(
418418
new SessionConfig()
419-
.setModel("gpt-4.1")
419+
.setModel("gpt-5.4")
420420
.setOnPermissionRequest(PermissionHandler.APPROVE_ALL)
421421
).get();
422422

0 commit comments

Comments
 (0)