Skip to content

Commit 339fb03

Browse files
authored
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
1 parent 6e4daa9 commit 339fb03

File tree

12 files changed

+164
-66
lines changed

12 files changed

+164
-66
lines changed

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/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/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,

nodejs/src/types.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,11 @@ export interface InfiniteSessionConfig {
603603
bufferExhaustionThreshold?: number;
604604
}
605605

606+
/**
607+
* Valid reasoning effort levels for models that support it.
608+
*/
609+
export type ReasoningEffort = "low" | "medium" | "high" | "xhigh";
610+
606611
export interface SessionConfig {
607612
/**
608613
* Optional custom session ID
@@ -615,6 +620,13 @@ export interface SessionConfig {
615620
*/
616621
model?: string;
617622

623+
/**
624+
* Reasoning effort level for models that support it.
625+
* Only valid for models where capabilities.supports.reasoningEffort is true.
626+
* Use client.listModels() to check supported values for each model.
627+
*/
628+
reasoningEffort?: ReasoningEffort;
629+
618630
/**
619631
* Override the default configuration directory location.
620632
* When specified, the session will use this directory for storing config and state.
@@ -721,6 +733,7 @@ export type ResumeSessionConfig = Pick<
721733
| "tools"
722734
| "provider"
723735
| "streaming"
736+
| "reasoningEffort"
724737
| "onPermissionRequest"
725738
| "onUserInputRequest"
726739
| "hooks"
@@ -876,6 +889,8 @@ export interface GetAuthStatusResponse {
876889
export interface ModelCapabilities {
877890
supports: {
878891
vision: boolean;
892+
/** Whether this model supports reasoning effort configuration */
893+
reasoningEffort: boolean;
879894
};
880895
limits: {
881896
max_prompt_tokens?: number;
@@ -917,4 +932,8 @@ export interface ModelInfo {
917932
policy?: ModelPolicy;
918933
/** Billing information */
919934
billing?: ModelBilling;
935+
/** Supported reasoning effort levels (only present if model supports reasoning effort) */
936+
supportedReasoningEfforts?: ReasoningEffort[];
937+
/** Default reasoning effort level (only present if model supports reasoning effort) */
938+
defaultReasoningEffort?: ReasoningEffort;
920939
}

python/copilot/client.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,8 @@ async def create_session(self, config: Optional[SessionConfig] = None) -> Copilo
387387
payload["model"] = cfg["model"]
388388
if cfg.get("session_id"):
389389
payload["sessionId"] = cfg["session_id"]
390+
if cfg.get("reasoning_effort"):
391+
payload["reasoningEffort"] = cfg["reasoning_effort"]
390392
if tool_defs:
391393
payload["tools"] = tool_defs
392394

@@ -545,6 +547,8 @@ async def resume_session(
545547
tool_defs.append(definition)
546548

547549
payload: dict[str, Any] = {"sessionId": session_id}
550+
if cfg.get("reasoning_effort"):
551+
payload["reasoningEffort"] = cfg["reasoning_effort"]
548552
if tool_defs:
549553
payload["tools"] = tool_defs
550554

0 commit comments

Comments
 (0)