feat(agent): add modelSettings to agent settings [PC-4672] - #1837
feat(agent): add modelSettings to agent settings [PC-4672]#1837tudormatei1 wants to merge 2 commits into
Conversation
3cee6ff to
2ded5a6
Compare
cad9cdf to
be0b0c6
Compare
There was a problem hiding this comment.
Pull request overview
Adds support in the UiPath Python SDK’s agent definition models for a provider-native settings.modelSettings block (a free-form “bag” of model parameters) so agent.json can carry model-specific tuning options without the SDK needing a fixed schema.
Changes:
- Introduce
ModelSettingsand addAgentSettings.model_settings(aliased tomodelSettings) to preserve arbitrary provider parameters. - Add unit tests validating
modelSettingsis optional and round-trips verbatim via alias-based dump. - Bump
uipathpackage version to2.15.0and update the lockfile accordingly.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/uipath/src/uipath/agent/models/agent.py | Adds ModelSettings bag model and wires modelSettings into AgentSettings. |
| packages/uipath/tests/agent/models/test_agent.py | Adds coverage for absent/present modelSettings behavior and verbatim round-trip. |
| packages/uipath/pyproject.toml | Bumps package version to 2.15.0. |
| packages/uipath/uv.lock | Updates locked uipath version entry to 2.15.0. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
be0b0c6 to
91d2fee
Compare
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 4 changed files in this pull request and generated no new comments.
Suppressed comments (3)
packages/uipath/src/uipath/agent/models/agent.py:1427
ModelSettingsis an empty Pydantic model, which makes the public API for a 'native bag' ambiguous: consumers will get aModelSettingsinstance (not adict), and whether arbitrary keys are accepted/preserved depends implicitly onBaseCfg'sextrabehavior. To make the passthrough contract explicit and stable, consider modeling this asOptional[dict[str, Any]](most direct) or as aRootModel[dict[str, Any]]/ explicitly configuringModelSettingsto allow and preserve extra keys (so futureBaseCfgchanges won't break this).
class ModelSettings(BaseCfg):
"""Provider-native model settings bag (``settings.modelSettings``).
Keys are the target model's own parameter names, forwarded verbatim — no fixed
schema; discovery is the source of truth for the shape.
"""
packages/uipath/src/uipath/agent/models/agent.py:1438
ModelSettingsis an empty Pydantic model, which makes the public API for a 'native bag' ambiguous: consumers will get aModelSettingsinstance (not adict), and whether arbitrary keys are accepted/preserved depends implicitly onBaseCfg'sextrabehavior. To make the passthrough contract explicit and stable, consider modeling this asOptional[dict[str, Any]](most direct) or as aRootModel[dict[str, Any]]/ explicitly configuringModelSettingsto allow and preserve extra keys (so futureBaseCfgchanges won't break this).
model_settings: Optional[ModelSettings] = Field(None, alias="modelSettings")
packages/uipath/tests/agent/models/test_agent.py:4780
- The tests cover non-empty passthrough via alias, but they don't cover the edge case of an explicitly empty bag. Adding a case asserting that
modelSettings={}round-trips to{}(and is not coerced toNone/ omitted) would better lock in the 'verbatim bag' behavior.
def test_native_bag_survives_verbatim_by_alias(self):
native = {
"thinking": {"type": "enabled", "budget_tokens": 2048},
"output_config": {"effort": "high"},
}
settings = AgentSettings.model_validate(
self._agent_settings(modelSettings=native)
)
assert settings.model_dump(by_alias=True)["modelSettings"] == native



Add a
modelSettingsblock tosettingsin agent.json, parsed intoAgentSettings.model_settings. It's a native bag (ModelSettings(BaseCfg), no declared fields); keys are the target model's own parameter names and are forwarded verbatim, so discovery stays the source of truth for the shape. AbsentmodelSettingsparses to None, keeping existing agent.json working.