diff --git a/CHANGELOG.md b/CHANGELOG.md index b9f0c0f8..edb06165 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to `uipath_llm_client` (core package) will be documented in this file. +## [1.18.0] - 2026-08-13 + +### Changed +- `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. +- The design-time-vs-deployed decision uses the shared `resolve_coded_agenthub_config` helper from `uipath.platform` (bumped floor to `uipath-platform>=0.2.18`) so all coded frameworks (langchain / llamaindex / openai-agents) classify runs identically. + ## [1.17.1] - 2026-07-17 ### Added diff --git a/packages/uipath_langchain_client/CHANGELOG.md b/packages/uipath_langchain_client/CHANGELOG.md index 0e31b821..c4f2d2eb 100644 --- a/packages/uipath_langchain_client/CHANGELOG.md +++ b/packages/uipath_langchain_client/CHANGELOG.md @@ -2,6 +2,11 @@ All notable changes to `uipath_langchain_client` will be documented in this file. +## [1.18.0] - 2026-08-13 + +### Changed +- 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`. + ## [1.17.1] - 2026-07-17 ### Changed diff --git a/packages/uipath_langchain_client/pyproject.toml b/packages/uipath_langchain_client/pyproject.toml index b5b2cf28..4d5eadf8 100644 --- a/packages/uipath_langchain_client/pyproject.toml +++ b/packages/uipath_langchain_client/pyproject.toml @@ -6,7 +6,7 @@ readme = "README.md" requires-python = ">=3.11" dependencies = [ "langchain>=1.2.15,<2.0.0", - "uipath-llm-client>=1.17.1,<2.0.0", + "uipath-llm-client>=1.18.0,<2.0.0", ] [project.optional-dependencies] diff --git a/packages/uipath_langchain_client/src/uipath_langchain_client/__version__.py b/packages/uipath_langchain_client/src/uipath_langchain_client/__version__.py index 618fd904..66e880d1 100644 --- a/packages/uipath_langchain_client/src/uipath_langchain_client/__version__.py +++ b/packages/uipath_langchain_client/src/uipath_langchain_client/__version__.py @@ -1,3 +1,3 @@ __title__ = "UiPath LangChain Client" __description__ = "A Python client for interacting with UiPath's LLM services via LangChain." -__version__ = "1.17.1" +__version__ = "1.18.0" diff --git a/pyproject.toml b/pyproject.toml index 43511630..973df583 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ dependencies = [ "tenacity>=9.1.4,<10.0.0", "pydantic>=2.12.5,<3.0.0", "pydantic-settings>=2.14.0,<3.0.0", - "uipath-platform>=0.1.91,<1.0.0", + "uipath-platform>=0.2.18,<1.0.0", ] authors = [ diff --git a/src/uipath/llm_client/__version__.py b/src/uipath/llm_client/__version__.py index ca1169f8..d908879a 100644 --- a/src/uipath/llm_client/__version__.py +++ b/src/uipath/llm_client/__version__.py @@ -1,3 +1,3 @@ __title__ = "UiPath LLM Client" __description__ = "A Python client for interacting with UiPath's LLM services." -__version__ = "1.17.1" +__version__ = "1.18.0" diff --git a/src/uipath/llm_client/settings/platform/settings.py b/src/uipath/llm_client/settings/platform/settings.py index 278dc810..d30bdf87 100644 --- a/src/uipath/llm_client/settings/platform/settings.py +++ b/src/uipath/llm_client/settings/platform/settings.py @@ -7,7 +7,11 @@ from pydantic import Field, SecretStr, model_validator from typing_extensions import override from uipath.platform import UiPath -from uipath.platform.common import EndpointManager, resolve_service_url +from uipath.platform.common import ( + EndpointManager, + resolve_coded_agenthub_config, + resolve_service_url, +) from uipath.platform.common._config import UiPathConfig from uipath.platform.common.constants import ( ENV_BASE_URL, @@ -91,6 +95,28 @@ def validate_environment(self) -> Self: self.client_id = parsed_token_data.get("client_id") return self + @model_validator(mode="after") + def default_agenthub_config_for_design_time(self) -> Self: + """Default ``agenthub_config`` to the coded-agent playground marker at design time. + + When no explicit ``agenthub_config`` was supplied (env ``UIPATH_AGENTHUB_CONFIG`` + unset and no caller override), a design-time run — local, Studio Web, or a debug + session — sends ``codedagentsplayground`` so its LLM calls draw the + CodedAgents.Playground licensing pool. A deployed run keeps ``agenthub_config`` + None, which the gateway resolves to AgentHub.LLM. + + Callers that pass an explicit value — low-code agents and evaluators go through + ``get_chat_model(agenthub_config=...)``, which overrides via ``model_copy`` (that + does not re-run this validator) — are unaffected. An explicit empty string is left + as an intentional opt-out. + + The design-time-vs-deployed decision is the shared ``resolve_coded_agenthub_config`` + helper from ``uipath.platform`` so all coded frameworks classify runs identically. + """ + if self.agenthub_config is None: + self.agenthub_config = resolve_coded_agenthub_config() + return self + @staticmethod def _format_endpoint(endpoint: str, **kwargs: str | None) -> str: """Format an endpoint template, stripping query params with None values.""" diff --git a/tests/core/features/settings/test_platform.py b/tests/core/features/settings/test_platform.py index e64cfbc9..48dae77b 100644 --- a/tests/core/features/settings/test_platform.py +++ b/tests/core/features/settings/test_platform.py @@ -91,18 +91,50 @@ def test_build_base_url_ignores_unrelated_service_override( assert "localhost" not in url assert "agenthub_/llm/api/chat/completions" in url - def test_build_auth_headers_omits_agenthub_config_by_default( + def test_build_auth_headers_omits_agenthub_config_when_deployed( self, platform_env_vars, mock_platform_auth ): - """``agenthub_config`` defaults to None and the header is omitted unless - the caller (or ``UIPATH_AGENTHUB_CONFIG``) sets it explicitly.""" + """A deployed run (real job, not a Studio Web project, not a debug session) + keeps ``agenthub_config`` None, so the header is omitted -> AgentHub.LLM.""" + env = {**platform_env_vars, "UIPATH_JOB_KEY": "deployed-job"} + with patch.dict(os.environ, env, clear=True): + settings = PlatformSettings() + assert settings.agenthub_config is None + headers = settings.build_auth_headers() + assert "x-uipath-agenthub-config" not in headers + assert headers["x-uipath-jobkey"] == "deployed-job" + + def test_agenthub_config_defaults_to_coded_playground_at_design_time( + self, platform_env_vars, mock_platform_auth + ): + """A design-time run (no job key) defaults ``agenthub_config`` to the coded + playground marker so LLM calls draw the CodedAgents.Playground pool.""" with patch.dict(os.environ, platform_env_vars, clear=True): settings = PlatformSettings() + assert settings.agenthub_config == "codedagentsplayground" headers = settings.build_auth_headers() - assert headers == { - "x-uipath-internal-accountid": "test-org-id", - "x-uipath-internal-tenantid": "test-tenant-id", - } + assert headers["x-uipath-agenthub-config"] == "codedagentsplayground" + + def test_studio_web_run_is_design_time(self, platform_env_vars, mock_platform_auth): + """A Studio Web run (job key present but a studio project) is design-time, + not deployed -> coded playground marker.""" + env = { + **platform_env_vars, + "UIPATH_JOB_KEY": "sw-debug-job", + "UIPATH_PROJECT_ID": "some-project-id", + } + with patch.dict(os.environ, env, clear=True): + settings = PlatformSettings() + assert settings.agenthub_config == "codedagentsplayground" + + def test_explicit_agenthub_config_env_overrides_design_time_default( + self, platform_env_vars, mock_platform_auth + ): + """An explicit ``UIPATH_AGENTHUB_CONFIG`` wins over the design-time default.""" + env = {**platform_env_vars, "UIPATH_AGENTHUB_CONFIG": "agentsplayground"} + with patch.dict(os.environ, env, clear=True): + settings = PlatformSettings() + assert settings.agenthub_config == "agentsplayground" def test_build_auth_headers_with_tracing(self, platform_env_vars, mock_platform_auth): """Test build_auth_headers includes tracing headers when set."""