Skip to content

Commit c39a129

Browse files
authored
feat: add reasoning_effort support to all SDK clients (github#302)
* feat: add reasoning_effort support to all SDK clients - Add reasoningEffort to SessionConfig and ResumeSessionConfig - Extend ModelCapabilities.supports with reasoningEffort flag - Add supportedReasoningEfforts and defaultReasoningEffort to ModelInfo - Update session create/resume to pass reasoningEffort to server * docs: add reasoningEffort documentation to SDK READMEs Document the new reasoningEffort/reasoning_effort option in SessionConfig for all SDK clients (Node.js, Python, Go, .NET). * trigger CI
1 parent b0448f8 commit c39a129

File tree

16 files changed

+177
-74
lines changed

16 files changed

+177
-74
lines changed

dotnet/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ Create a new conversation session.
9393

9494
- `SessionId` - Custom session ID
9595
- `Model` - Model to use ("gpt-5", "claude-sonnet-4.5", etc.)
96+
- `ReasoningEffort` - Reasoning effort level for models that support it ("low", "medium", "high", "xhigh"). Use `ListModelsAsync()` to check which models support this option.
9697
- `Tools` - Custom tools exposed to the CLI
9798
- `SystemMessage` - System message customization
9899
- `AvailableTools` - List of tool names to allow

dotnet/src/Client.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ public async Task<CopilotSession> CreateSessionAsync(SessionConfig? config = nul
347347
var request = new CreateSessionRequest(
348348
config?.Model,
349349
config?.SessionId,
350+
config?.ReasoningEffort,
350351
config?.Tools?.Select(ToolDefinition.FromAIFunction).ToList(),
351352
config?.SystemMessage,
352353
config?.AvailableTools,
@@ -428,6 +429,7 @@ public async Task<CopilotSession> ResumeSessionAsync(string sessionId, ResumeSes
428429

429430
var request = new ResumeSessionRequest(
430431
sessionId,
432+
config?.ReasoningEffort,
431433
config?.Tools?.Select(ToolDefinition.FromAIFunction).ToList(),
432434
config?.Provider,
433435
config?.OnPermissionRequest != null ? true : null,
@@ -1090,6 +1092,7 @@ public static string Escape(string arg)
10901092
internal record CreateSessionRequest(
10911093
string? Model,
10921094
string? SessionId,
1095+
string? ReasoningEffort,
10931096
List<ToolDefinition>? Tools,
10941097
SystemMessageConfig? SystemMessage,
10951098
List<string>? AvailableTools,
@@ -1122,6 +1125,7 @@ internal record CreateSessionResponse(
11221125

11231126
internal record ResumeSessionRequest(
11241127
string SessionId,
1128+
string? ReasoningEffort,
11251129
List<ToolDefinition>? Tools,
11261130
ProviderConfig? Provider,
11271131
bool? RequestPermission,

dotnet/src/Types.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,13 @@ public class SessionConfig
692692
public string? SessionId { get; set; }
693693
public string? Model { get; set; }
694694

695+
/// <summary>
696+
/// Reasoning effort level for models that support it.
697+
/// Valid values: "low", "medium", "high", "xhigh".
698+
/// Only applies to models where capabilities.supports.reasoningEffort is true.
699+
/// </summary>
700+
public string? ReasoningEffort { get; set; }
701+
695702
/// <summary>
696703
/// Override the default configuration directory location.
697704
/// When specified, the session will use this directory for storing config and state.
@@ -766,6 +773,12 @@ public class ResumeSessionConfig
766773
public ICollection<AIFunction>? Tools { get; set; }
767774
public ProviderConfig? Provider { get; set; }
768775

776+
/// <summary>
777+
/// Reasoning effort level for models that support it.
778+
/// Valid values: "low", "medium", "high", "xhigh".
779+
/// </summary>
780+
public string? ReasoningEffort { get; set; }
781+
769782
/// <summary>
770783
/// Handler for permission requests from the server.
771784
/// When provided, the server will call this handler to request permission for operations.
@@ -930,6 +943,12 @@ public class ModelSupports
930943
{
931944
[JsonPropertyName("vision")]
932945
public bool Vision { get; set; }
946+
947+
/// <summary>
948+
/// Whether this model supports reasoning effort configuration.
949+
/// </summary>
950+
[JsonPropertyName("reasoningEffort")]
951+
public bool ReasoningEffort { get; set; }
933952
}
934953

935954
/// <summary>
@@ -989,6 +1008,14 @@ public class ModelInfo
9891008
/// <summary>Billing information</summary>
9901009
[JsonPropertyName("billing")]
9911010
public ModelBilling? Billing { get; set; }
1011+
1012+
/// <summary>Supported reasoning effort levels (only present if model supports reasoning effort)</summary>
1013+
[JsonPropertyName("supportedReasoningEfforts")]
1014+
public List<string>? SupportedReasoningEfforts { get; set; }
1015+
1016+
/// <summary>Default reasoning effort level (only present if model supports reasoning effort)</summary>
1017+
[JsonPropertyName("defaultReasoningEffort")]
1018+
public string? DefaultReasoningEffort { get; set; }
9921019
}
9931020

9941021
/// <summary>

go/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ func main() {
102102
**SessionConfig:**
103103

104104
- `Model` (string): Model to use ("gpt-5", "claude-sonnet-4.5", etc.). **Required when using custom provider.**
105+
- `ReasoningEffort` (string): Reasoning effort level for models that support it ("low", "medium", "high", "xhigh"). Use `ListModels()` to check which models support this option.
105106
- `SessionID` (string): Custom session ID
106107
- `Tools` ([]Tool): Custom tools exposed to the CLI
107108
- `SystemMessage` (\*SystemMessageConfig): System message configuration
@@ -114,6 +115,7 @@ func main() {
114115
**ResumeSessionConfig:**
115116

116117
- `Tools` ([]Tool): Tools to expose when resuming
118+
- `ReasoningEffort` (string): Reasoning effort level for models that support it
117119
- `Provider` (\*ProviderConfig): Custom API provider configuration (BYOK). See [Custom Providers](#custom-providers) section.
118120
- `Streaming` (bool): Enable streaming delta events
119121

go/client.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,9 @@ func (c *Client) CreateSession(config *SessionConfig) (*Session, error) {
461461
if config.SessionID != "" {
462462
params["sessionId"] = config.SessionID
463463
}
464+
if config.ReasoningEffort != "" {
465+
params["reasoningEffort"] = config.ReasoningEffort
466+
}
464467
if len(config.Tools) > 0 {
465468
toolDefs := make([]map[string]interface{}, 0, len(config.Tools))
466469
for _, tool := range config.Tools {
@@ -670,6 +673,9 @@ func (c *Client) ResumeSessionWithOptions(sessionID string, config *ResumeSessio
670673
}
671674

672675
if config != nil {
676+
if config.ReasoningEffort != "" {
677+
params["reasoningEffort"] = config.ReasoningEffort
678+
}
673679
if len(config.Tools) > 0 {
674680
toolDefs := make([]map[string]interface{}, 0, len(config.Tools))
675681
for _, tool := range config.Tools {

go/types.go

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,10 @@ type SessionConfig struct {
322322
SessionID string
323323
// Model to use for this session
324324
Model string
325+
// ReasoningEffort level for models that support it.
326+
// Valid values: "low", "medium", "high", "xhigh"
327+
// Only applies to models where capabilities.supports.reasoningEffort is true.
328+
ReasoningEffort string
325329
// ConfigDir overrides the default configuration directory location.
326330
// When specified, the session will use this directory for storing config and state.
327331
ConfigDir string
@@ -399,6 +403,9 @@ type ResumeSessionConfig struct {
399403
Tools []Tool
400404
// Provider configures a custom model provider
401405
Provider *ProviderConfig
406+
// ReasoningEffort level for models that support it.
407+
// Valid values: "low", "medium", "high", "xhigh"
408+
ReasoningEffort string
402409
// OnPermissionRequest is a handler for permission requests from the server
403410
OnPermissionRequest PermissionHandler
404411
// OnUserInputRequest is a handler for user input requests from the agent (enables ask_user tool)
@@ -523,7 +530,8 @@ type ModelLimits struct {
523530

524531
// ModelSupports contains model support flags
525532
type ModelSupports struct {
526-
Vision bool `json:"vision"`
533+
Vision bool `json:"vision"`
534+
ReasoningEffort bool `json:"reasoningEffort"`
527535
}
528536

529537
// ModelCapabilities contains model capabilities and limits
@@ -545,11 +553,13 @@ type ModelBilling struct {
545553

546554
// ModelInfo contains information about an available model
547555
type ModelInfo struct {
548-
ID string `json:"id"`
549-
Name string `json:"name"`
550-
Capabilities ModelCapabilities `json:"capabilities"`
551-
Policy *ModelPolicy `json:"policy,omitempty"`
552-
Billing *ModelBilling `json:"billing,omitempty"`
556+
ID string `json:"id"`
557+
Name string `json:"name"`
558+
Capabilities ModelCapabilities `json:"capabilities"`
559+
Policy *ModelPolicy `json:"policy,omitempty"`
560+
Billing *ModelBilling `json:"billing,omitempty"`
561+
SupportedReasoningEfforts []string `json:"supportedReasoningEfforts,omitempty"`
562+
DefaultReasoningEffort string `json:"defaultReasoningEffort,omitempty"`
553563
}
554564

555565
// GetModelsResponse is the response from models.list

nodejs/README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,9 @@ Create a new conversation session.
8686

8787
**Config:**
8888

89-
- `sessionId?: string` - Custom session ID
89+
- `sessionId?: string` - Custom session ID.
9090
- `model?: string` - Model to use ("gpt-5", "claude-sonnet-4.5", etc.). **Required when using custom provider.**
91+
- `reasoningEffort?: "low" | "medium" | "high" | "xhigh"` - Reasoning effort level for models that support it. Use `listModels()` to check which models support this option.
9192
- `tools?: Tool[]` - Custom tools exposed to the CLI
9293
- `systemMessage?: SystemMessageConfig` - System message customization (see below)
9394
- `infiniteSessions?: InfiniteSessionConfig` - Configure automatic context compaction (see below)
@@ -511,12 +512,12 @@ const session = await client.createSession({
511512
// request.question - The question to ask
512513
// request.choices - Optional array of choices for multiple choice
513514
// request.allowFreeform - Whether freeform input is allowed (default: true)
514-
515+
515516
console.log(`Agent asks: ${request.question}`);
516517
if (request.choices) {
517518
console.log(`Choices: ${request.choices.join(", ")}`);
518519
}
519-
520+
520521
// Return the user's response
521522
return {
522523
answer: "User's answer here",
@@ -544,7 +545,7 @@ const session = await client.createSession({
544545
additionalContext: "Extra context for the model",
545546
};
546547
},
547-
548+
548549
// Called after each tool execution
549550
onPostToolUse: async (input, invocation) => {
550551
console.log(`Tool ${input.toolName} completed`);
@@ -553,28 +554,28 @@ const session = await client.createSession({
553554
additionalContext: "Post-execution notes",
554555
};
555556
},
556-
557+
557558
// Called when user submits a prompt
558559
onUserPromptSubmitted: async (input, invocation) => {
559560
console.log(`User prompt: ${input.prompt}`);
560561
return {
561562
modifiedPrompt: input.prompt, // Optionally modify the prompt
562563
};
563564
},
564-
565+
565566
// Called when session starts
566567
onSessionStart: async (input, invocation) => {
567568
console.log(`Session started from: ${input.source}`); // "startup", "resume", "new"
568569
return {
569570
additionalContext: "Session initialization context",
570571
};
571572
},
572-
573+
573574
// Called when session ends
574575
onSessionEnd: async (input, invocation) => {
575576
console.log(`Session ended: ${input.reason}`);
576577
},
577-
578+
578579
// Called when an error occurs
579580
onErrorOccurred: async (input, invocation) => {
580581
console.error(`Error in ${input.errorContext}: ${input.error}`);

nodejs/package-lock.json

Lines changed: 28 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

nodejs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"author": "GitHub",
4141
"license": "MIT",
4242
"dependencies": {
43-
"@github/copilot": "^0.0.399",
43+
"@github/copilot": "^0.0.400",
4444
"vscode-jsonrpc": "^8.2.1",
4545
"zod": "^4.3.5"
4646
},

nodejs/src/client.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,7 @@ export class CopilotClient {
452452
const response = await this.connection!.sendRequest("session.create", {
453453
model: config.model,
454454
sessionId: config.sessionId,
455+
reasoningEffort: config.reasoningEffort,
455456
tools: config.tools?.map((tool) => ({
456457
name: tool.name,
457458
description: tool.description,
@@ -531,6 +532,7 @@ export class CopilotClient {
531532

532533
const response = await this.connection!.sendRequest("session.resume", {
533534
sessionId,
535+
reasoningEffort: config.reasoningEffort,
534536
tools: config.tools?.map((tool) => ({
535537
name: tool.name,
536538
description: tool.description,

0 commit comments

Comments
 (0)