feat(super-agent): make modelService/modelName fields optional#93
Merged
Conversation
Backend now allows modelServiceName / modelName to be absent from create and invoke JSON. SDK omits unset scalar / empty-list fields from forwardedProps on create and invoke paths while preserving null-as-clear semantics on update. - Add _prune_forwarded_props helper in api/control.py. - Plumb prune_props flag through _build_protocol_settings_config and _build_protocol_configuration; to_create_input opts in, to_update_input stays default-False so update(model_name=None) still clears. - Prune forwarded_extras inside SuperAgentDataAPI._build_invoke_body before injecting SDK-managed metadata / conversationId; drop any leaked conversationId when caller passes conversation_id=None. - Sync agentrun/super_agent/api/__data_async_template.py and agentrun/super_agent/__agent_async_template.py so codegen cannot revert the change; clarify _forwarded_business_fields docstring to point at the downstream pruning step. - Tests: 6 unit tests for the helper, 4 new tests for create / invoke pruning behavior, 2 regression tests locking in update null preservation, 1 test for the defensive conversationId pop. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Signed-off-by: Sodawyx <sodawyx@126.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the SuperAgent SDK request payload shaping so modelServiceName / modelName (and other unset fields) can be omitted on create/invoke, matching backend support, while preserving null-as-clear semantics on update.
Changes:
- Add
_prune_forwarded_propsand thread aprune_propsflag through protocol configuration building so create prunes unset/empty fields while update retainsNone/[]. - Prune
forwarded_extrasinSuperAgentDataAPI._build_invoke_body, ensuring SDK-managed fields (metadata,conversationId) are not overridden and leakedconversationIdis defensively removed whenconversation_id=None. - Add/extend unit tests covering pruning behavior for create/invoke and regression coverage for update null preservation.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
agentrun/super_agent/api/control.py |
Introduces _prune_forwarded_props and enables pruning for create payload construction via prune_props=True. |
agentrun/super_agent/api/data.py |
Prunes forwarded_extras before injecting SDK-managed metadata/conversationId; drops leaked conversationId when appropriate. |
agentrun/super_agent/api/__data_async_template.py |
Mirrors data.py pruning logic so codegen won’t revert behavior. |
agentrun/super_agent/agent.py |
Updates _forwarded_business_fields docstring to reflect downstream pruning behavior. |
agentrun/super_agent/__agent_async_template.py |
Mirrors agent.py docstring update to keep codegen consistent. |
tests/unittests/super_agent/test_control.py |
Adds focused unit tests for _prune_forwarded_props and create/update pruning/null-preservation behaviors. |
tests/unittests/super_agent/test_data_api.py |
Adds invoke payload pruning tests, metadata preservation, and defensive conversationId drop regression test. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
OhYee
approved these changes
Apr 25, 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.
Backend now allows modelServiceName / modelName to be absent from create and invoke JSON. SDK omits unset scalar / empty-list fields from forwardedProps on create and invoke paths while preserving null-as-clear semantics on update.
Fix bugs
Bug detail
Pull request tasks
Update docs
Reason for update
Pull request tasks
Add contributor
Contributed content
Content detail
Others
Reason for update