feat: add model field to CustomAgentConfig across all SDKs#1309
Merged
Conversation
Add optional `model` property to the Node/TypeScript CustomAgentConfig interface. When set, the runtime will attempt to use the specified model for the agent, falling back to the parent session model if unavailable. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add optional `model` key to the Python CustomAgentConfig TypedDict and wire it through `_convert_custom_agent_to_wire_format` so the runtime receives it in the session.create / session.resume payloads. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add optional `Model` field to the Go CustomAgentConfig struct. The field serializes as `"model"` and is omitted when empty. When set, the runtime will attempt to use the specified model for the agent. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add optional `Model` property to the .NET CustomAgentConfig class. The property serializes as `"model"` and is omitted when null. When set, the runtime will attempt to use the specified model for the agent. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add optional `model` field to the Rust CustomAgentConfig struct with a `with_model` builder method. Serializes as `"model"` (camelCase rename is a no-op for single-word fields) and is skipped when None. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for per-custom-agent model selection across all SDKs by exposing an optional model field on CustomAgentConfig and ensuring Python maps it into the wire payload.
Changes:
- Added
modelto custom agent config types in Node/TS, Python, Go, .NET, and Rust. - Added Python wire-format forwarding for
model. - Added a Rust
with_model()builder method.
Show a summary per file
| File | Description |
|---|---|
rust/src/types.rs |
Adds optional serialized model field and builder method. |
python/copilot/session.py |
Adds model to the CustomAgentConfig TypedDict. |
python/copilot/client.py |
Forwards model into custom agent wire format. |
nodejs/src/types.ts |
Adds model to the TypeScript custom agent interface. |
go/types.go |
Adds JSON-serialized Model field to Go custom agent config. |
dotnet/src/Types.cs |
Adds JSON-serialized nullable Model property to .NET custom agent config. |
Copilot's findings
- Files reviewed: 6/6 changed files
- Comments generated: 0
Add a test case that creates a custom agent with a model property and asserts it appears in the session.create RPC payload. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add unit tests asserting that the model key is correctly forwarded to the camelCase wire payload, and omitted when not set. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
Add tests asserting that the model field round-trips through JSON when set and is omitted from the payload when empty. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Update the SessionConfig clone test to set Model on a CustomAgentConfig and assert it survives the clone operation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
Add unit tests for the with_model() builder, JSON serialization with model set, and confirming model is omitted from wire when None. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
223ee24 to
a2f563f
Compare
Contributor
✅ Cross-SDK Consistency ReviewThis PR adds the
Documentation is uniform across all SDKs describing the runtime fallback behavior. Tests cover both "field present" and "field absent/omitted" cases in every SDK. No inconsistencies found. 🎉
|
stephentoub
reviewed
May 15, 2026
stephentoub
approved these changes
May 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add an optional
modelproperty toCustomAgentConfigin all five SDKs (Node/TS, Python, Go, .NET, Rust). This closes the gap between the runtime'sSweCustomAgent.modelsupport and the SDK's public API.Motivation
The runtime already supports per-subagent model selection via YAML frontmatter in
.github/agents/*.mdfiles, but the programmatic SDK API (customAgentsarray in session config) did not expose this capability. Users who define agents programmatically could not specify which model an agent should use.Changes
Each SDK gets its own commit for easy review:
nodejs/src/types.ts):model?: stringonCustomAgentConfiginterface — passed through directly to wire formatpython/copilot/session.py+client.py):model: NotRequired[str]onCustomAgentConfigTypedDict + wire format conversiongo/types.go):Model stringfield withjson:"model,omitempty"tagdotnet/src/Types.cs):string? Modelproperty with[JsonPropertyName("model")]rust/src/types.rs):model: Option<String>field +with_model()builder methodBehavior
When set, the runtime will attempt to use the specified model for the agent, falling back to the parent session model if unavailable. When omitted/null, the agent inherits the session's model (existing behavior, no breaking change).
Validation
All five SDKs compile successfully:
npx tsc --noEmit,python3 -c "import copilot",go build ./...,dotnet build,cargo check --all-features.