Skip to content

Commit 75f2c56

Browse files
al3xanndruclaude
andauthored
feat: default agenthub_config to codedagentsplayground at design time (#125)
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent c150738 commit 75f2c56

9 files changed

Lines changed: 89 additions & 19 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes to `uipath_llm_client` (core package) will be documented in this file.
44

5+
## [1.18.0] - 2026-08-13
6+
7+
### Changed
8+
- `PlatformBaseSettings.agenthub_config` now defaults to `codedagentsplayground` for design-time runs (local, Studio Web, or a debug session) instead of `None`, so coded-agent LLM calls draw the `CodedAgents.Playground` licensing pool. A deployed run — a real Orchestrator job that is neither a Studio Web project nor rooted to a debug session — still resolves to `None` (→ `AgentHub.LLM`). Callers that pass an explicit `agenthub_config` (low-code agents, evaluators via `get_chat_model(agenthub_config=...)`) override this default via `model_copy` and are unaffected; an explicit empty string is left as an opt-out. Setting `UIPATH_AGENTHUB_CONFIG` still wins over the computed default.
9+
- The design-time-vs-deployed decision uses the shared `resolve_coded_agenthub_config` helper from `uipath.platform` (bumped floor to `uipath-platform>=0.2.19`) so all coded frameworks (langchain / llamaindex / openai-agents) classify runs identically.
10+
511
## [1.17.2] - 2026-08-13
612

713
### Fixed

packages/uipath_langchain_client/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
All notable changes to `uipath_langchain_client` will be documented in this file.
44

5+
## [1.18.0] - 2026-08-13
6+
7+
### Changed
8+
- Picks up core `uipath-llm-client` 1.18.0: directly-constructed chat/embedding clients now default `client_settings.agenthub_config` to `codedagentsplayground` for design-time runs (local / Studio Web / debug) so coded-agent LLM calls draw the `CodedAgents.Playground` pool; deployed runs stay `None` (→ `AgentHub.LLM`). Explicit `agenthub_config` (e.g. from low-code via `get_chat_model`) and `UIPATH_AGENTHUB_CONFIG` still take precedence. Bumped the `uipath-llm-client` floor to `>=1.18.0`.
9+
510
## [1.17.3] - 2026-08-06
611

712
### Fixed

packages/uipath_langchain_client/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ readme = "README.md"
66
requires-python = ">=3.11"
77
dependencies = [
88
"langchain>=1.2.15,<2.0.0",
9-
"uipath-llm-client>=1.17.1,<2.0.0",
9+
"uipath-llm-client>=1.18.0,<2.0.0",
1010
]
1111

1212
[project.optional-dependencies]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
__title__ = "UiPath LangChain Client"
22
__description__ = "A Python client for interacting with UiPath's LLM services via LangChain."
3-
__version__ = "1.17.3"
3+
__version__ = "1.18.0"

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ dependencies = [
99
"tenacity>=9.1.4,<10.0.0",
1010
"pydantic>=2.12.5,<3.0.0",
1111
"pydantic-settings>=2.14.0,<3.0.0",
12-
"uipath-platform>=0.1.91,<1.0.0",
12+
"uipath-platform>=0.2.19,<1.0.0",
1313
]
1414

1515
authors = [
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
__title__ = "UiPath LLM Client"
22
__description__ = "A Python client for interacting with UiPath's LLM services."
3-
__version__ = "1.17.2"
3+
__version__ = "1.18.0"

src/uipath/llm_client/settings/platform/settings.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77
from pydantic import Field, SecretStr, model_validator
88
from typing_extensions import override
99
from uipath.platform import UiPath
10-
from uipath.platform.common import EndpointManager, resolve_service_url
10+
from uipath.platform.common import (
11+
EndpointManager,
12+
resolve_coded_agenthub_config,
13+
resolve_service_url,
14+
)
1115
from uipath.platform.common._config import UiPathConfig
1216
from uipath.platform.common.constants import (
1317
ENV_BASE_URL,
@@ -91,6 +95,28 @@ def validate_environment(self) -> Self:
9195
self.client_id = parsed_token_data.get("client_id")
9296
return self
9397

98+
@model_validator(mode="after")
99+
def default_agenthub_config_for_design_time(self) -> Self:
100+
"""Default ``agenthub_config`` to the coded-agent playground marker at design time.
101+
102+
When no explicit ``agenthub_config`` was supplied (env ``UIPATH_AGENTHUB_CONFIG``
103+
unset and no caller override), a design-time run — local, Studio Web, or a debug
104+
session — sends ``codedagentsplayground`` so its LLM calls draw the
105+
CodedAgents.Playground licensing pool. A deployed run keeps ``agenthub_config``
106+
None, which the gateway resolves to AgentHub.LLM.
107+
108+
Callers that pass an explicit value — low-code agents and evaluators go through
109+
``get_chat_model(agenthub_config=...)``, which overrides via ``model_copy`` (that
110+
does not re-run this validator) — are unaffected. An explicit empty string is left
111+
as an intentional opt-out.
112+
113+
The design-time-vs-deployed decision is the shared ``resolve_coded_agenthub_config``
114+
helper from ``uipath.platform`` so all coded frameworks classify runs identically.
115+
"""
116+
if self.agenthub_config is None:
117+
self.agenthub_config = resolve_coded_agenthub_config()
118+
return self
119+
94120
@staticmethod
95121
def _format_endpoint(endpoint: str, **kwargs: str | None) -> str:
96122
"""Format an endpoint template, stripping query params with None values."""

tests/core/features/settings/test_platform.py

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,18 +91,50 @@ def test_build_base_url_ignores_unrelated_service_override(
9191
assert "localhost" not in url
9292
assert "agenthub_/llm/api/chat/completions" in url
9393

94-
def test_build_auth_headers_omits_agenthub_config_by_default(
94+
def test_build_auth_headers_omits_agenthub_config_when_deployed(
9595
self, platform_env_vars, mock_platform_auth
9696
):
97-
"""``agenthub_config`` defaults to None and the header is omitted unless
98-
the caller (or ``UIPATH_AGENTHUB_CONFIG``) sets it explicitly."""
97+
"""A deployed run (real job, not a Studio Web project, not a debug session)
98+
keeps ``agenthub_config`` None, so the header is omitted -> AgentHub.LLM."""
99+
env = {**platform_env_vars, "UIPATH_JOB_KEY": "deployed-job"}
100+
with patch.dict(os.environ, env, clear=True):
101+
settings = PlatformSettings()
102+
assert settings.agenthub_config is None
103+
headers = settings.build_auth_headers()
104+
assert "x-uipath-agenthub-config" not in headers
105+
assert headers["x-uipath-jobkey"] == "deployed-job"
106+
107+
def test_agenthub_config_defaults_to_coded_playground_at_design_time(
108+
self, platform_env_vars, mock_platform_auth
109+
):
110+
"""A design-time run (no job key) defaults ``agenthub_config`` to the coded
111+
playground marker so LLM calls draw the CodedAgents.Playground pool."""
99112
with patch.dict(os.environ, platform_env_vars, clear=True):
100113
settings = PlatformSettings()
114+
assert settings.agenthub_config == "codedagentsplayground"
101115
headers = settings.build_auth_headers()
102-
assert headers == {
103-
"x-uipath-internal-accountid": "test-org-id",
104-
"x-uipath-internal-tenantid": "test-tenant-id",
105-
}
116+
assert headers["x-uipath-agenthub-config"] == "codedagentsplayground"
117+
118+
def test_studio_web_run_is_design_time(self, platform_env_vars, mock_platform_auth):
119+
"""A Studio Web run (job key present but a studio project) is design-time,
120+
not deployed -> coded playground marker."""
121+
env = {
122+
**platform_env_vars,
123+
"UIPATH_JOB_KEY": "sw-debug-job",
124+
"UIPATH_PROJECT_ID": "some-project-id",
125+
}
126+
with patch.dict(os.environ, env, clear=True):
127+
settings = PlatformSettings()
128+
assert settings.agenthub_config == "codedagentsplayground"
129+
130+
def test_explicit_agenthub_config_env_overrides_design_time_default(
131+
self, platform_env_vars, mock_platform_auth
132+
):
133+
"""An explicit ``UIPATH_AGENTHUB_CONFIG`` wins over the design-time default."""
134+
env = {**platform_env_vars, "UIPATH_AGENTHUB_CONFIG": "agentsplayground"}
135+
with patch.dict(os.environ, env, clear=True):
136+
settings = PlatformSettings()
137+
assert settings.agenthub_config == "agentsplayground"
106138

107139
def test_build_auth_headers_with_tracing(self, platform_env_vars, mock_platform_auth):
108140
"""Test build_auth_headers includes tracing headers when set."""

uv.lock

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

0 commit comments

Comments
 (0)