Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 14 additions & 18 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,38 @@
# UiPath LLM Client Configuration
# =============================================================================
# Copy this file to .env and fill in your values.
# The client supports two backends: AgentHub (default) and LLMGateway.
# The client supports three backends: AgentHub (default), Orchestrator, and LLMGateway.

# -----------------------------------------------------------------------------
# Backend Selection
# -----------------------------------------------------------------------------
# Choose which backend to use: "agenthub" (default) or "llmgateway"
UIPATH_LLM_BACKEND="agenthub"
# Choose which backend to use: "agenthub" (default), "orchestrator", or "llmgateway"
UIPATH_LLM_SERVICE="agenthub"

# =============================================================================
# AGENTHUB BACKEND SETTINGS
# PLATFORM BACKEND SETTINGS (AgentHub / Orchestrator)
# =============================================================================
# AgentHub uses the UiPath CLI for authentication by default.
# Run `uv run uipath auth login` to authenticate interactively.
# Alternatively, set the environment variables below.

# Environment selection: "cloud", "staging", or "alpha" (default: None)
UIPATH_ENVIRONMENT=""
# Both "agenthub" and "orchestrator" use PlatformSettings with the same
# authentication. The EndpointManager selects the correct URL paths.
# Run `uv run uipath auth login` to populate these automatically.

# Core settings (populated automatically by CLI auth, or set manually)
UIPATH_URL=""
UIPATH_ORGANIZATION_ID=""
UIPATH_TENANT_ID=""

# Access token (short-lived, populated by CLI auth)
# If not using CLI auth, provide this directly or use S2S credentials below
UIPATH_ACCESS_TOKEN=""

# S2S Authentication for AgentHub (alternative to CLI/access token)
UIPATH_CLIENT_ID=""
UIPATH_CLIENT_SECRET=""
UIPATH_CLIENT_SCOPE="" # Optional: custom OAuth scope
# Optional: AgentHub discovery configuration (only used when backend is "agenthub")
UIPATH_AGENTHUB_CONFIG="agentsruntime"

# Optional: tracing
UIPATH_PROCESS_KEY=""
UIPATH_JOB_KEY=""

# =============================================================================
# LLMGATEWAY BACKEND SETTINGS
# =============================================================================
# To use LLMGateway, set UIPATH_LLM_BACKEND="llmgateway" above.
# To use LLMGateway, set UIPATH_LLM_SERVICE="llmgateway" above.

# Required settings
LLMGW_URL=""
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
needs: type_check
environment: LLMGW_SETTINGS
env:
UIPATH_LLM_BACKEND: ${{ vars.UIPATH_LLM_BACKEND }}
UIPATH_LLM_SERVICE: ${{ vars.UIPATH_LLM_SERVICE }}
LLMGW_URL: ${{ vars.LLMGW_URL }}
LLMGW_SEMANTIC_ORG_ID: ${{ secrets.LLMGW_SEMANTIC_ORG_ID }}
LLMGW_SEMANTIC_USER_ID: ${{ secrets.LLMGW_SEMANTIC_USER_ID }}
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

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

## [1.5.0] - 2026-03-16

### Stable Version 1.5.0
- added also backend for orchestrator and renamed AgentHubSettings to PlatformSetting (contains both agenthub and orchestrator)
- removed dependencies from 'uipath', now the repo depends on uipath.platform
- renamed var UIPATH_LLM_BACKEND with UIPATH_LLM_SERVICE in order to match uipath.platform
- More test fixes and documentation update

## [1.4.0] - 2026-03-13

### New client
Expand Down
126 changes: 87 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,25 +70,22 @@ uv add "uipath-langchain-client[all]"

## Configuration

### AgentHub Backend (Default)
### Platform Backend (AgentHub / Orchestrator)

The AgentHub backend uses the UiPath CLI for authentication. On first use, it will prompt you to log in via browser.
The Platform backend uses the UiPath CLI for authentication. Both `"agenthub"` (default) and `"orchestrator"` share the same settings — the `EndpointManager` selects the correct URL paths automatically.

```bash
# Optional: Pre-authenticate via CLI
# Authenticate via CLI (populates .uipath/.auth.json)
uv run uipath auth login

# Or set environment variables directly
export UIPATH_ENVIRONMENT="cloud" # Environment: "cloud", "staging", or "alpha" (default: "cloud")
export UIPATH_URL="https://cloud.uipath.com"
export UIPATH_URL="https://cloud.uipath.com/org/tenant"
export UIPATH_ORGANIZATION_ID="your-org-id"
export UIPATH_TENANT_ID="your-tenant-id"
export UIPATH_ACCESS_TOKEN="your-access-token" # Optional if using CLI auth
export UIPATH_ACCESS_TOKEN="your-access-token"

# For S2S authentication (alternative to CLI)
export UIPATH_CLIENT_ID="your-client-id"
export UIPATH_CLIENT_SECRET="your-client-secret"
export UIPATH_CLIENT_SCOPE="your-scope" # Optional: custom OAuth scope
# Optional: select backend (default: "agenthub")
export UIPATH_LLM_SERVICE="agenthub" # or "orchestrator"
```

### LLMGateway Backend
Expand All @@ -97,7 +94,7 @@ To use the LLMGateway backend, set the following environment variables:

```bash
# Select the backend
export UIPATH_LLM_BACKEND="llmgateway"
export UIPATH_LLM_SERVICE="llmgateway"

# Required configuration
export LLMGW_URL="https://your-llmgw-url.com"
Expand All @@ -118,40 +115,91 @@ export LLMGW_SEMANTIC_USER_ID="your-user-id"

## Settings Reference

### AgentHubSettings
### PlatformSettings

Configuration settings for UiPath AgentHub client requests. These settings control routing, authentication, and tracking for requests to AgentHub.
Configuration settings for UiPath Platform client requests. `PlatformSettings` is a unified settings class that serves both **AgentHub** and **Orchestrator** backends — the `EndpointManager` transparently selects the correct endpoints based on service availability.

You choose between them via the `UIPATH_LLM_SERVICE` environment variable (or the `backend` parameter in `get_default_client_settings()`):

| Value | Description |
|-------|-------------|
| `"agenthub"` (default) | Routes requests through AgentHub endpoints |
| `"orchestrator"` | Routes requests through Orchestrator endpoints |

Both values create a `PlatformSettings` instance — the difference is in how `EndpointManager` resolves the URL paths.

```python
from uipath.llm_client.settings import AgentHubSettings

settings = AgentHubSettings(
environment="cloud", # UiPath environment
access_token="...", # Optional: pre-set access token
base_url="...", # Optional: custom base URL
tenant_id="...", # Optional: tenant ID
organization_id="...", # Optional: organization ID
)
from uipath.llm_client.settings import get_default_client_settings, PlatformSettings

# Option 1: Factory (reads UIPATH_LLM_SERVICE, defaults to "agenthub")
settings = get_default_client_settings()

# Option 2: Explicit backend
settings = get_default_client_settings(backend="agenthub")
settings = get_default_client_settings(backend="orchestrator")

# Option 3: Direct instantiation
settings = PlatformSettings()
```

#### AgentHub

AgentHub is the default backend. It routes LLM requests through UiPath's AgentHub service, which provides model discovery, routing, and tracing capabilities.

```bash
# Select the backend (default, can be omitted)
export UIPATH_LLM_SERVICE="agenthub"

# Core settings (populated automatically by `uipath auth login`)
export UIPATH_URL="https://cloud.uipath.com/org/tenant"
export UIPATH_ORGANIZATION_ID="your-org-id"
export UIPATH_TENANT_ID="your-tenant-id"
export UIPATH_ACCESS_TOKEN="your-access-token"

# Optional: AgentHub configuration for discovery (default: "agentsruntime")
export UIPATH_AGENTHUB_CONFIG="agentsruntime"

# Optional: tracing
export UIPATH_PROCESS_KEY="your-process-key"
export UIPATH_JOB_KEY="your-job-key"
```

#### Orchestrator

Orchestrator uses the same `PlatformSettings` and authentication as AgentHub, but routes requests through Orchestrator endpoints instead.

```bash
# Select the backend
export UIPATH_LLM_SERVICE="orchestrator"

# Core settings (same as AgentHub)
export UIPATH_URL="https://cloud.uipath.com/org/tenant"
export UIPATH_ORGANIZATION_ID="your-org-id"
export UIPATH_TENANT_ID="your-tenant-id"
export UIPATH_ACCESS_TOKEN="your-access-token"

# Optional: tracing
export UIPATH_PROCESS_KEY="your-process-key"
export UIPATH_JOB_KEY="your-job-key"
```

#### PlatformSettings Attributes

| Attribute | Environment Variable | Type | Default | Description |
|-----------|---------------------|------|---------|-------------|
| `environment` | `UIPATH_ENVIRONMENT` | `"cloud"` \| `"staging"` \| `"alpha"` | `"cloud"` | The UiPath environment to connect to |
| `access_token` | `UIPATH_ACCESS_TOKEN` | `SecretStr \| None` | `None` | Access token for authentication (auto-populated via CLI if not set) |
| `base_url` | `UIPATH_URL` | `str \| None` | `None` | Base URL of the AgentHub API (auto-populated via CLI if not set) |
| `tenant_id` | `UIPATH_TENANT_ID` | `str \| None` | `None` | Tenant ID for request routing (auto-populated via CLI if not set) |
| `organization_id` | `UIPATH_ORGANIZATION_ID` | `str \| None` | `None` | Organization ID for request routing (auto-populated via CLI if not set) |
| `client_id` | `UIPATH_CLIENT_ID` | `SecretStr \| None` | `None` | Client ID for OAuth/S2S authentication |
| `client_secret` | `UIPATH_CLIENT_SECRET` | `SecretStr \| None` | `None` | Client secret for OAuth/S2S authentication |
| `client_scope` | `UIPATH_CLIENT_SCOPE` | `str \| None` | `None` | Custom OAuth scope for authentication |
| `agenthub_config` | `UIPATH_AGENTHUB_CONFIG` | `str` | `"agentsruntime"` | AgentHub configuration for tracing |
| `access_token` | `UIPATH_ACCESS_TOKEN` | `SecretStr \| None` | `None` | Access token for authentication (populated by `uipath auth login`) |
| `base_url` | `UIPATH_URL` | `str \| None` | `None` | Base URL of the UiPath Platform API |
| `tenant_id` | `UIPATH_TENANT_ID` | `str \| None` | `None` | Tenant ID for request routing |
| `organization_id` | `UIPATH_ORGANIZATION_ID` | `str \| None` | `None` | Organization ID for request routing |
| `agenthub_config` | `UIPATH_AGENTHUB_CONFIG` | `str \| None` | `"agentsruntime"` | AgentHub configuration for discovery |
| `process_key` | `UIPATH_PROCESS_KEY` | `str \| None` | `None` | Process key for tracing |
| `job_key` | `UIPATH_JOB_KEY` | `str \| None` | `None` | Job key for tracing |

**Authentication behavior:**
- If `access_token`, `base_url`, `tenant_id`, and `organization_id` are all provided, they are used directly
- Otherwise, the client uses the UiPath CLI (`uipath auth`) to authenticate automatically
- For S2S authentication, provide `client_id` and `client_secret`
- All four core fields (`access_token`, `base_url`, `tenant_id`, `organization_id`) are required
- Run `uipath auth login` to populate them automatically via the UiPath CLI
- The access token is validated against the local `.uipath/.auth.json` file
- Token refresh is handled automatically using the refresh token from the auth file

### LLMGatewaySettings

Expand Down Expand Up @@ -463,11 +511,11 @@ Pass custom settings when you need more control:

```python
from uipath_langchain_client.clients.openai.chat_models import UiPathAzureChatOpenAI
from uipath.llm_client.settings import AgentHubSettings
from uipath.llm_client.settings import PlatformSettings
from uipath.llm_client.utils.retry import RetryConfig

# Custom settings for AgentHub
settings = AgentHubSettings(environment="cloud") # or "staging", "alpha"
# Custom settings for Platform (AgentHub/Orchestrator)
settings = PlatformSettings()

# With retry configuration
retry_config: RetryConfig = {
Expand Down Expand Up @@ -498,7 +546,7 @@ llmgw_settings = get_default_client_settings(backend="llmgateway")
chat = UiPathAzureChatOpenAI(model="gpt-4o-2024-11-20", client_settings=llmgw_settings)

# Or use environment variable (no code changes needed)
# export UIPATH_LLM_BACKEND="llmgateway"
# export UIPATH_LLM_SERVICE="llmgateway"
```

### Using LLMGatewaySettings Directly
Expand Down Expand Up @@ -810,7 +858,7 @@ uipath-llm-client/
│ │ └── google/ # UiPathGoogle
│ ├── settings/ # Backend-specific settings & auth
│ │ ├── base.py # UiPathBaseSettings, UiPathAPIConfig
│ │ ├── agenthub/ # AgentHubSettings, AgentHubAuth
│ │ ├── platform/ # PlatformSettings, PlatformAuth
│ │ └── llmgateway/ # LLMGatewaySettings, LLMGatewayS2SAuth
│ └── utils/ # Exceptions, retry, logging, SSL
│ ├── exceptions.py # UiPathAPIError hierarchy (12 classes)
Expand Down
5 changes: 5 additions & 0 deletions packages/uipath_langchain_client/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

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

## [1.5.0] - 2026-03-16

### Stable Version 1.5.0
- Updated package to include the changes in core

## [1.4.0] - 2026-03-13

### New client
Expand Down
2 changes: 1 addition & 1 deletion packages/uipath_langchain_client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ The factory functions automatically detect the model vendor and return the appro
from uipath_langchain_client import get_chat_model, get_embedding_model
from uipath_langchain_client.settings import get_default_client_settings

# Get default settings (uses UIPATH_LLM_BACKEND env var or defaults to AgentHub)
# Get default settings (uses UIPATH_LLM_SERVICE env var or defaults to AgentHub)
settings = get_default_client_settings()

# Chat model - vendor auto-detected from model name
Expand Down
6 changes: 3 additions & 3 deletions packages/uipath_langchain_client/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ readme = "README.md"
requires-python = ">=3.11"
dependencies = [
"langchain>=1.2.12",
"uipath-llm-client>=1.4.0",
"uipath-llm-client>=1.5.0",
]

[project.optional-dependencies]
Expand All @@ -17,8 +17,8 @@ google = [
"langchain-google-genai>=4.2.1",
]
anthropic = [
"langchain-anthropic>=1.3.4",
"anthropic[bedrock,vertex]>=0.84.0",
"langchain-anthropic>=1.3.5",
"anthropic[bedrock,vertex]>=0.85.0",
]
aws = [
"langchain-aws[anthropic]>=1.4.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

Settings:
- get_default_client_settings(): Auto-detect backend from environment
- AgentHubSettings: UiPath AgentHub backend (CLI-based auth)
- PlatformSettings: UiPath Platform backend (AgentHub/Orchestrator, CLI-based auth)
- LLMGatewaySettings: UiPath LLM Gateway backend (S2S auth)

Factory Functions:
Expand All @@ -36,8 +36,8 @@
from uipath_langchain_client.clients import UiPathChat, UiPathEmbeddings
from uipath_langchain_client.factory import get_chat_model, get_embedding_model
from uipath_langchain_client.settings import (
AgentHubSettings,
LLMGatewaySettings,
PlatformSettings,
get_default_client_settings,
)

Expand All @@ -49,5 +49,5 @@
"UiPathEmbeddings",
"get_default_client_settings",
"LLMGatewaySettings",
"AgentHubSettings",
"PlatformSettings",
]
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__title__ = "UiPath LangChain Client"
__description__ = "A Python client for interacting with UiPath's LLM services via LangChain."
__version__ = "1.4.0"
__version__ = "1.5.0"
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class UiPathBaseLLMClient(BaseModel, ABC):
client_settings: UiPathBaseSettings = Field(
alias="settings",
default_factory=get_default_client_settings,
description="Settings for the UiPath client (defaults based on UIPATH_LLM_BACKEND env var)",
description="Settings for the UiPath client (defaults based on UIPATH_LLM_SERVICE env var)",
)

default_headers: Mapping[str, str] | None = Field(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"""

from uipath.llm_client.settings import (
AgentHubSettings,
LLMGatewaySettings,
PlatformSettings,
UiPathAPIConfig,
UiPathBaseSettings,
get_default_client_settings,
Expand All @@ -27,7 +27,7 @@
__all__ = [
"get_default_client_settings",
"LLMGatewaySettings",
"AgentHubSettings",
"PlatformSettings",
"UiPathAPIConfig",
"UiPathBaseSettings",
"ApiType",
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies = [
"tenacity>=9.1.4",
"pydantic>=2.12.5",
"pydantic-settings>=2.13.1",
"uipath>=2.10.13",
"uipath-platform>=0.0.25",
]

authors = [
Expand All @@ -19,13 +19,13 @@ authors = [

[project.optional-dependencies]
openai = [
"openai>=2.26.0",
"openai>=2.28.0",
]
google = [
"google-genai>=1.67.0",
]
anthropic = [
"anthropic>=0.84.0",
"anthropic>=0.85.0",
]
all = [
"uipath-llm-client[openai,google,anthropic]",
Expand Down
Loading