uipath 2.1.50__py3-none-any.whl → 2.1.52__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- uipath/_cli/__init__.py +1 -0
- uipath/_cli/_evals/progress_reporter.py +36 -44
- uipath/_cli/_utils/_project_files.py +1 -0
- uipath/_cli/cli_init.py +31 -0
- uipath/_resources/AGENTS.md +724 -0
- uipath/_services/context_grounding_service.py +19 -24
- uipath/_services/jobs_service.py +3 -4
- uipath/_services/llm_gateway_service.py +3 -4
- {uipath-2.1.50.dist-info → uipath-2.1.52.dist-info}/METADATA +1 -1
- {uipath-2.1.50.dist-info → uipath-2.1.52.dist-info}/RECORD +13 -12
- {uipath-2.1.50.dist-info → uipath-2.1.52.dist-info}/WHEEL +0 -0
- {uipath-2.1.50.dist-info → uipath-2.1.52.dist-info}/entry_points.txt +0 -0
- {uipath-2.1.50.dist-info → uipath-2.1.52.dist-info}/licenses/LICENSE +0 -0
uipath/_cli/__init__.py
CHANGED
@@ -8,6 +8,7 @@ from .cli_auth import auth as auth
|
|
8
8
|
from .cli_deploy import deploy as deploy # type: ignore
|
9
9
|
from .cli_dev import dev as dev
|
10
10
|
from .cli_eval import eval as eval # type: ignore
|
11
|
+
from .cli_init import generate_agents_md as generate_agents_md # type: ignore
|
11
12
|
from .cli_init import init as init # type: ignore
|
12
13
|
from .cli_invoke import invoke as invoke # type: ignore
|
13
14
|
from .cli_new import new as new # type: ignore
|
@@ -65,7 +65,7 @@ class ProgressReporter:
|
|
65
65
|
method=spec.method,
|
66
66
|
url=spec.endpoint,
|
67
67
|
params=spec.params,
|
68
|
-
|
68
|
+
json=spec.json,
|
69
69
|
headers=spec.headers,
|
70
70
|
)
|
71
71
|
self._eval_set_run_id = json.loads(response.content)["id"]
|
@@ -84,7 +84,7 @@ class ProgressReporter:
|
|
84
84
|
method=spec.method,
|
85
85
|
url=spec.endpoint,
|
86
86
|
params=spec.params,
|
87
|
-
|
87
|
+
json=spec.json,
|
88
88
|
headers=spec.headers,
|
89
89
|
)
|
90
90
|
return json.loads(response.content)["id"]
|
@@ -116,7 +116,7 @@ class ProgressReporter:
|
|
116
116
|
method=spec.method,
|
117
117
|
url=spec.endpoint,
|
118
118
|
params=spec.params,
|
119
|
-
|
119
|
+
json=spec.json,
|
120
120
|
headers=spec.headers,
|
121
121
|
)
|
122
122
|
|
@@ -127,7 +127,7 @@ class ProgressReporter:
|
|
127
127
|
method=spec.method,
|
128
128
|
url=spec.endpoint,
|
129
129
|
params=spec.params,
|
130
|
-
|
130
|
+
json=spec.json,
|
131
131
|
headers=spec.headers,
|
132
132
|
)
|
133
133
|
|
@@ -201,18 +201,16 @@ class ProgressReporter:
|
|
201
201
|
endpoint=Endpoint(
|
202
202
|
f"agentsruntime_/api/execution/agents/{self._project_id}/evalRun"
|
203
203
|
),
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
"
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
}
|
215
|
-
),
|
204
|
+
json={
|
205
|
+
"evalRunId": eval_run_id,
|
206
|
+
"status": EvaluationStatus.COMPLETED.value,
|
207
|
+
"result": {
|
208
|
+
"output": {"content": {**actual_output}},
|
209
|
+
"evaluatorScores": evaluator_scores,
|
210
|
+
},
|
211
|
+
"completionMetrics": {"duration": int(execution_time)},
|
212
|
+
"assertionRuns": assertion_runs,
|
213
|
+
},
|
216
214
|
headers=self._tenant_header(),
|
217
215
|
)
|
218
216
|
|
@@ -222,18 +220,16 @@ class ProgressReporter:
|
|
222
220
|
endpoint=Endpoint(
|
223
221
|
f"agentsruntime_/api/execution/agents/{self._project_id}/evalRun"
|
224
222
|
),
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
"
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
}
|
236
|
-
),
|
223
|
+
json={
|
224
|
+
"evalSetRunId": self._eval_set_run_id,
|
225
|
+
"evalSnapshot": {
|
226
|
+
"id": eval_item["id"],
|
227
|
+
"name": eval_item["name"],
|
228
|
+
"inputs": eval_item.get("inputs"),
|
229
|
+
"expectedOutput": eval_item.get("expectedOutput", {}),
|
230
|
+
},
|
231
|
+
"status": EvaluationStatus.IN_PROGRESS.value,
|
232
|
+
},
|
237
233
|
headers=self._tenant_header(),
|
238
234
|
)
|
239
235
|
|
@@ -247,15 +243,13 @@ class ProgressReporter:
|
|
247
243
|
endpoint=Endpoint(
|
248
244
|
f"agentsruntime_/api/execution/agents/{self._project_id}/evalSetRun"
|
249
245
|
),
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
}
|
258
|
-
),
|
246
|
+
json={
|
247
|
+
"agentId": self._project_id,
|
248
|
+
"evalSetId": self._eval_set_id,
|
249
|
+
"agentSnapshot": agent_snapshot_dict,
|
250
|
+
"status": EvaluationStatus.IN_PROGRESS.value,
|
251
|
+
"numberOfEvalsExecuted": self._no_of_evals,
|
252
|
+
},
|
259
253
|
headers=self._tenant_header(),
|
260
254
|
)
|
261
255
|
|
@@ -293,13 +287,11 @@ class ProgressReporter:
|
|
293
287
|
endpoint=Endpoint(
|
294
288
|
f"agentsruntime_/api/execution/agents/{self._project_id}/evalSetRun"
|
295
289
|
),
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
}
|
302
|
-
),
|
290
|
+
json={
|
291
|
+
"evalSetRunId": self._eval_set_run_id,
|
292
|
+
"status": EvaluationStatus.COMPLETED.value,
|
293
|
+
"evaluatorScores": evaluator_scores,
|
294
|
+
},
|
303
295
|
headers=self._tenant_header(),
|
304
296
|
)
|
305
297
|
|
@@ -69,6 +69,7 @@ def get_project_config(directory: str) -> dict[str, str]:
|
|
69
69
|
"authors": toml_data["authors"],
|
70
70
|
"dependencies": toml_data.get("dependencies", {}),
|
71
71
|
"requires-python": toml_data.get("requires-python", None),
|
72
|
+
"settings": config_data.get("settings", {}),
|
72
73
|
}
|
73
74
|
|
74
75
|
|
uipath/_cli/cli_init.py
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# type: ignore
|
2
|
+
import importlib.resources
|
2
3
|
import json
|
3
4
|
import os
|
5
|
+
import shutil
|
4
6
|
import uuid
|
5
7
|
from pathlib import Path
|
6
8
|
from typing import Any, Dict, Optional
|
@@ -56,6 +58,34 @@ def generate_env_file(target_directory):
|
|
56
58
|
console.success(f" Created '{relative_path}' file.")
|
57
59
|
|
58
60
|
|
61
|
+
def generate_agents_md(target_directory: str) -> None:
|
62
|
+
"""Generate AGENTS.md file from the packaged resource.
|
63
|
+
|
64
|
+
Args:
|
65
|
+
target_directory: The directory where AGENTS.md should be created.
|
66
|
+
"""
|
67
|
+
target_path = os.path.join(target_directory, "AGENTS.md")
|
68
|
+
|
69
|
+
# Skip if file already exists
|
70
|
+
if os.path.exists(target_path):
|
71
|
+
console.info("Skipping 'AGENTS.md' creation as it already exists.")
|
72
|
+
return
|
73
|
+
|
74
|
+
try:
|
75
|
+
# Get the resource path using importlib.resources
|
76
|
+
source_path = importlib.resources.files("uipath._resources").joinpath(
|
77
|
+
"AGENTS.md"
|
78
|
+
)
|
79
|
+
|
80
|
+
# Copy the file to the target directory
|
81
|
+
with importlib.resources.as_file(source_path) as s_path:
|
82
|
+
shutil.copy(s_path, target_path)
|
83
|
+
|
84
|
+
console.success(" Created 'AGENTS.md' file.")
|
85
|
+
except Exception as e:
|
86
|
+
console.warning(f"Could not create AGENTS.md: {e}")
|
87
|
+
|
88
|
+
|
59
89
|
def get_existing_settings(config_path: str) -> Optional[Dict[str, Any]]:
|
60
90
|
"""Read existing settings from uipath.json if it exists.
|
61
91
|
|
@@ -130,6 +160,7 @@ def init(entrypoint: str, infer_bindings: bool) -> None:
|
|
130
160
|
current_directory = os.getcwd()
|
131
161
|
generate_env_file(current_directory)
|
132
162
|
create_telemetry_config_file(current_directory)
|
163
|
+
generate_agents_md(current_directory)
|
133
164
|
|
134
165
|
result = Middlewares.next(
|
135
166
|
"init",
|
@@ -0,0 +1,724 @@
|
|
1
|
+
# AGENTS.md – Unified Guide for UiPath Workflows & Agentic Solutions
|
2
|
+
|
3
|
+
This document provides a comprehensive guide to building, testing, and deploying Python automations and intelligent agents on the UiPath platform using the `uipath-python` and `uipath-langchain-python` SDK, just like the agent present in this folder.
|
4
|
+
|
5
|
+
---
|
6
|
+
|
7
|
+
## 0) Local Environment Setup (with `uv`)
|
8
|
+
|
9
|
+
This project assumes you’re using [`uv`](https://github.com/astral-sh/uv) for fast Python installs, virtualenvs, and command execution.
|
10
|
+
|
11
|
+
### 0.1 Install Python & create a virtualenv
|
12
|
+
|
13
|
+
```bash
|
14
|
+
# Install a modern Python (adjust the version if you need)
|
15
|
+
uv python install 3.12
|
16
|
+
|
17
|
+
# Create a local virtual environment (uses the latest installed Python by default)
|
18
|
+
uv venv
|
19
|
+
```
|
20
|
+
|
21
|
+
> **Tip:** You don’t need to “activate” the venv if you use `uv run ...`, but if you prefer activation:
|
22
|
+
>
|
23
|
+
> - macOS/Linux: `source .venv/bin/activate`
|
24
|
+
> - Windows PowerShell: `.venv\Scripts\Activate.ps1`
|
25
|
+
|
26
|
+
### 0.2 Install dependencies
|
27
|
+
|
28
|
+
```bash
|
29
|
+
uv pip install -e .
|
30
|
+
```
|
31
|
+
|
32
|
+
### 0.3 Run the UiPath CLI via `uv`
|
33
|
+
|
34
|
+
Using `uv run` means you don’t have to activate the venv:
|
35
|
+
|
36
|
+
```bash
|
37
|
+
# Log in and write credentials to .env
|
38
|
+
uv run uipath auth
|
39
|
+
|
40
|
+
# Initialize (scans entrypoints and updates uipath.json)
|
41
|
+
uv run uipath init
|
42
|
+
|
43
|
+
# Interactive dev loop (recommended)
|
44
|
+
uv run uipath dev
|
45
|
+
|
46
|
+
# Non-interactive run of classic entrypoint
|
47
|
+
uv run uipath run main.py '{"message": "Hello from uv"}'
|
48
|
+
|
49
|
+
# If you exposed a compiled graph entrypoint called "agent"
|
50
|
+
# (name exposed in langgraph.json)
|
51
|
+
uv run uipath run agent '{"topic": "Quarterly sales"}'
|
52
|
+
```
|
53
|
+
|
54
|
+
## 1) Core Developer Workflow (CLI)
|
55
|
+
|
56
|
+
The **unified CLI** supports both classic automations and LangGraph agents.
|
57
|
+
|
58
|
+
### 1.1 Authenticate
|
59
|
+
|
60
|
+
```bash
|
61
|
+
uipath auth
|
62
|
+
```
|
63
|
+
|
64
|
+
- Opens a browser login and writes credentials to `.env`.
|
65
|
+
- Required before local runs or publishing.
|
66
|
+
|
67
|
+
### 1.2 Initialize
|
68
|
+
|
69
|
+
```bash
|
70
|
+
uipath init
|
71
|
+
|
72
|
+
```
|
73
|
+
|
74
|
+
- Scans the classic entrypoint (`main.py`) and creates/updates `uipath.json` with **input/output schema** and **resource bindings**.
|
75
|
+
- Re‑run when you change function signatures, add Assets/Queues/Buckets, or new graph entrypoints.
|
76
|
+
|
77
|
+
### 1.3 Local Run & Debug
|
78
|
+
|
79
|
+
```bash
|
80
|
+
# Interactive development mode (recommended)
|
81
|
+
uipath dev
|
82
|
+
|
83
|
+
# Non‑interactive quick runs
|
84
|
+
uipath run main.py '{"message": "Hello from the CLI"}'
|
85
|
+
# For a compiled graph
|
86
|
+
uipath run agent '{"topic": "Quarterly sales"}'
|
87
|
+
```
|
88
|
+
|
89
|
+
- `dev` shows live logs, traces, and chat history.
|
90
|
+
|
91
|
+
### 1.4 Package, Publish, Deploy
|
92
|
+
|
93
|
+
```bash
|
94
|
+
uipath pack
|
95
|
+
uipath publish
|
96
|
+
uipath deploy
|
97
|
+
```
|
98
|
+
|
99
|
+
- `deploy` is a wrapper that packs and publishes to your Orchestrator feed.
|
100
|
+
- Use per‑environment pipelines (Dev → Test → Prod folders/tenants).
|
101
|
+
|
102
|
+
### 1.5 Other Useful Commands
|
103
|
+
|
104
|
+
```bash
|
105
|
+
uipath invoke # Execute a process remotely (when configured)
|
106
|
+
uipath eval # Run evaluation scenarios for agents
|
107
|
+
uipath --help # Discover flags and subcommands
|
108
|
+
```
|
109
|
+
|
110
|
+
---
|
111
|
+
|
112
|
+
## 2) Environment, Credentials & Configuration
|
113
|
+
|
114
|
+
Both SDKs read their configuration from **environment variables** (directly, or via `.env` loaded by `python-dotenv`).
|
115
|
+
|
116
|
+
### 2.1 Minimal local `.env`
|
117
|
+
|
118
|
+
```bash
|
119
|
+
UIPATH_URL="https://cloud.uipath.com/ORG/TENANT"
|
120
|
+
UIPATH_ACCESS_TOKEN="your-token"
|
121
|
+
|
122
|
+
# Common defaults
|
123
|
+
UIPATH_FOLDER_PATH="Shared"
|
124
|
+
```
|
125
|
+
|
126
|
+
> **Best practice:** Commit `.env.example` (documenting required vars) but never commit `.env`.
|
127
|
+
|
128
|
+
### 2.3 Loading configuration in code
|
129
|
+
|
130
|
+
```python
|
131
|
+
from dotenv import load_dotenv
|
132
|
+
from uipath import UiPath
|
133
|
+
from uipath.models.errors import BaseUrlMissingError, SecretMissingError
|
134
|
+
|
135
|
+
load_dotenv()
|
136
|
+
try:
|
137
|
+
sdk = UiPath()
|
138
|
+
except (BaseUrlMissingError, SecretMissingError) as e:
|
139
|
+
raise SystemExit(f"Config error: {e}. Run 'uipath auth' or set env vars.")
|
140
|
+
```
|
141
|
+
|
142
|
+
---
|
143
|
+
|
144
|
+
## 3) Classic Automation Track (Python SDK, `uipath`)
|
145
|
+
|
146
|
+
### 3.1 Entrypoint shape (Pydantic IO strongly recommended)
|
147
|
+
|
148
|
+
```python
|
149
|
+
# src/main.py
|
150
|
+
from pydantic import BaseModel
|
151
|
+
from typing import Optional
|
152
|
+
from dotenv import load_dotenv
|
153
|
+
from uipath import UiPath
|
154
|
+
|
155
|
+
load_dotenv()
|
156
|
+
|
157
|
+
class AutomationInput(BaseModel):
|
158
|
+
customer_id: str
|
159
|
+
message: str
|
160
|
+
|
161
|
+
class AutomationOutput(BaseModel):
|
162
|
+
status: str
|
163
|
+
confirmation_code: Optional[str] = None
|
164
|
+
|
165
|
+
def main(input: AutomationInput) -> AutomationOutput:
|
166
|
+
sdk = UiPath()
|
167
|
+
cfg = sdk.assets.retrieve(name="GlobalConfig")
|
168
|
+
print(f"Using API URL from asset: {cfg.value}")
|
169
|
+
return AutomationOutput(status="Success", confirmation_code="ABC-123")
|
170
|
+
```
|
171
|
+
|
172
|
+
### 3.2 Core recipes
|
173
|
+
|
174
|
+
#### Execute a child process
|
175
|
+
|
176
|
+
```python
|
177
|
+
import time
|
178
|
+
from dotenv import load_dotenv
|
179
|
+
from uipath import UiPath
|
180
|
+
|
181
|
+
load_dotenv()
|
182
|
+
sdk = UiPath()
|
183
|
+
job = sdk.processes.invoke(
|
184
|
+
name="Process_To_Run_In_Finance",
|
185
|
+
input_arguments={"customer_id": 12345},
|
186
|
+
folder_path="Finance",
|
187
|
+
)
|
188
|
+
while job.state in ("Pending", "Running"):
|
189
|
+
time.sleep(5)
|
190
|
+
job = sdk.jobs.retrieve(key=job.key)
|
191
|
+
print("State:", job.state, "Output:", job.output_arguments)
|
192
|
+
```
|
193
|
+
|
194
|
+
#### Assets – configuration & credentials
|
195
|
+
|
196
|
+
```python
|
197
|
+
from uipath import UiPath
|
198
|
+
|
199
|
+
sdk = UiPath()
|
200
|
+
plain = sdk.assets.retrieve(name="My_App_Config")
|
201
|
+
print("Endpoint:", plain.value)
|
202
|
+
|
203
|
+
try:
|
204
|
+
cred = sdk.assets.retrieve_credential(name="My_App_Credential")
|
205
|
+
print("Got credential username:", cred.username)
|
206
|
+
except ValueError as e:
|
207
|
+
print("Credential unavailable in non‑robot context:", e)
|
208
|
+
```
|
209
|
+
|
210
|
+
#### Queues – transactional work
|
211
|
+
|
212
|
+
```python
|
213
|
+
from uipath import UiPath
|
214
|
+
|
215
|
+
sdk = UiPath()
|
216
|
+
QUEUE = "InvoiceProcessing"
|
217
|
+
sdk.queues.create_item(
|
218
|
+
name=QUEUE,
|
219
|
+
specific_content={"invoice_id": "INV-9876", "amount": 450.75, "vendor": "Supplier Inc."},
|
220
|
+
priority="High",
|
221
|
+
)
|
222
|
+
trx = sdk.queues.create_transaction_item(name=QUEUE)
|
223
|
+
if trx:
|
224
|
+
try:
|
225
|
+
# ... process trx.specific_content ...
|
226
|
+
sdk.queues.complete_transaction_item(trx.id, {"status": "Successful", "message": "OK"})
|
227
|
+
except Exception as e:
|
228
|
+
sdk.queues.complete_transaction_item(trx.id, {"status": "Failed", "is_successful": False, "processing_exception": str(e)})
|
229
|
+
```
|
230
|
+
|
231
|
+
#### Buckets – file management
|
232
|
+
|
233
|
+
```python
|
234
|
+
from uipath import UiPath
|
235
|
+
|
236
|
+
sdk = UiPath()
|
237
|
+
with open("report.pdf", "w") as f:
|
238
|
+
f.write("sample report")
|
239
|
+
|
240
|
+
sdk.buckets.upload(name="MonthlyReports", source_path="report.pdf", blob_file_path="2024/July/report.pdf")
|
241
|
+
sdk.buckets.download(name="InputFiles", blob_file_path="data/customers.xlsx", destination_path="local_customers.xlsx")
|
242
|
+
```
|
243
|
+
|
244
|
+
#### Context Grounding – RAG
|
245
|
+
|
246
|
+
```python
|
247
|
+
from uipath import UiPath
|
248
|
+
|
249
|
+
async def main(input: dict):
|
250
|
+
sdk = UiPath()
|
251
|
+
q = input.get("query")
|
252
|
+
hits = sdk.context_grounding.search(name="Internal_Wiki", query=q, number_of_results=3)
|
253
|
+
context = "\n".join([h.content for h in hits])
|
254
|
+
enriched = f"Context:\n{context}\n\nAnswer: {q}"
|
255
|
+
resp = await sdk.llm.chat_completions(model="gpt-4o-mini-2024-07-18", messages=[{"role": "user", "content": enriched}])
|
256
|
+
return {"answer": resp.choices[0].message.content}
|
257
|
+
```
|
258
|
+
|
259
|
+
#### Event triggers – Integration Service
|
260
|
+
|
261
|
+
```python
|
262
|
+
from pydantic import BaseModel
|
263
|
+
from uipath import UiPath
|
264
|
+
from uipath.models import EventArguments
|
265
|
+
|
266
|
+
class Output(BaseModel):
|
267
|
+
status: str
|
268
|
+
summary: str
|
269
|
+
|
270
|
+
def main(input: EventArguments) -> Output:
|
271
|
+
sdk = UiPath()
|
272
|
+
payload = sdk.connections.retrieve_event_payload(input)
|
273
|
+
if "event" in payload and "text" in payload["event"]:
|
274
|
+
txt = payload["event"]["text"]
|
275
|
+
user = payload["event"].get("user", "Unknown")
|
276
|
+
summ = sdk.llm.chat(prompt=f"Summarize from {user}: {txt}", model="gpt-4")
|
277
|
+
return Output(status="Processed", summary=getattr(summ, "content", str(summ)))
|
278
|
+
return Output(status="Skipped", summary="Not a Slack message event")
|
279
|
+
```
|
280
|
+
|
281
|
+
#### Passing files between jobs – attachments
|
282
|
+
|
283
|
+
```python
|
284
|
+
from uipath import UiPath
|
285
|
+
from uipath.models import InvokeProcess
|
286
|
+
|
287
|
+
def main(input_args: dict):
|
288
|
+
sdk = UiPath()
|
289
|
+
csv = "id,name\n1,Alice\n2,Bob"
|
290
|
+
att_key = sdk.jobs.create_attachment(name="processed.csv", content=csv)
|
291
|
+
return InvokeProcess(name="LoadDataToSystem", input_arguments={"dataFileKey": str(att_key)})
|
292
|
+
```
|
293
|
+
|
294
|
+
---
|
295
|
+
|
296
|
+
## 4) Agentic Track (LangGraph/LangChain SDK, `uipath-langchain`)
|
297
|
+
|
298
|
+
### 4.1 Quick start – chat model
|
299
|
+
|
300
|
+
```python
|
301
|
+
from uipath_langchain.chat import UiPathChat
|
302
|
+
from langchain_core.messages import HumanMessage
|
303
|
+
|
304
|
+
chat = UiPathChat(model="gpt-4o-2024-08-06", max_retries=3)
|
305
|
+
print(chat.invoke([HumanMessage(content="Hello")]).content)
|
306
|
+
```
|
307
|
+
|
308
|
+
### 4.2 Simple graph example
|
309
|
+
|
310
|
+
`graph = builder.compile()` is enough for the agent to run with `uipath run agent '{"topic": "Quarterly sales"}`
|
311
|
+
|
312
|
+
```python
|
313
|
+
from langchain_core.messages import HumanMessage, SystemMessage
|
314
|
+
from langgraph.graph import START, StateGraph, END
|
315
|
+
from uipath_langchain.chat import UiPathChat
|
316
|
+
from pydantic import BaseModel
|
317
|
+
import os
|
318
|
+
|
319
|
+
llm = UiPathChat(model="gpt-4o-mini-2024-07-18")
|
320
|
+
|
321
|
+
class GraphState(BaseModel):
|
322
|
+
topic: str
|
323
|
+
|
324
|
+
class GraphOutput(BaseModel):
|
325
|
+
report: str
|
326
|
+
|
327
|
+
async def generate_report(state: GraphState) -> GraphOutput:
|
328
|
+
system_prompt = "You are a report generator. Please provide a brief report based on the given topic."
|
329
|
+
output = await llm.ainvoke([SystemMessage(system_prompt), HumanMessage(state.topic)])
|
330
|
+
return GraphOutput(report=output.content)
|
331
|
+
|
332
|
+
builder = StateGraph(GraphState, output=GraphOutput)
|
333
|
+
|
334
|
+
builder.add_node("generate_report", generate_report)
|
335
|
+
|
336
|
+
builder.add_edge(START, "generate_report")
|
337
|
+
builder.add_edge("generate_report", END)
|
338
|
+
|
339
|
+
graph = builder.compile()
|
340
|
+
```
|
341
|
+
|
342
|
+
### 4.3 ReAct‑style agent with tools
|
343
|
+
|
344
|
+
```python
|
345
|
+
from langgraph.graph import StateGraph, START, END
|
346
|
+
from langgraph.prebuilt import create_react_agent
|
347
|
+
from langchain_tavily import TavilySearch
|
348
|
+
from uipath_langchain.chat import UiPathChat
|
349
|
+
from pydantic import BaseModel
|
350
|
+
|
351
|
+
class GraphState(BaseModel):
|
352
|
+
company_name: str
|
353
|
+
|
354
|
+
tavily = TavilySearch(max_results=5)
|
355
|
+
llm = UiPathChat(model="gpt-4o-2024-08-06")
|
356
|
+
agent = create_react_agent(llm, tools=[tavily], prompt="You are a research assistant.")
|
357
|
+
|
358
|
+
builder = StateGraph(GraphState)
|
359
|
+
builder.add_node("research", agent)
|
360
|
+
builder.add_edge(START, "research")
|
361
|
+
builder.add_edge("research", END)
|
362
|
+
|
363
|
+
graph = builder.compile()
|
364
|
+
```
|
365
|
+
|
366
|
+
### 4.4 RAG – Context Grounding vector store & retriever
|
367
|
+
|
368
|
+
```python
|
369
|
+
from uipath_langchain.vectorstores import ContextGroundingVectorStore
|
370
|
+
from uipath_langchain.chat import UiPathAzureChatOpenAI
|
371
|
+
from langchain_core.prompts import ChatPromptTemplate
|
372
|
+
|
373
|
+
vs = ContextGroundingVectorStore(index_name="my_knowledge_base")
|
374
|
+
retriever = vs.as_retriever(search_kwargs={"k": 3})
|
375
|
+
|
376
|
+
prompt = ChatPromptTemplate.from_template("""Answer from context:
|
377
|
+
{context}
|
378
|
+
Question: {question}
|
379
|
+
""")
|
380
|
+
llm = UiPathAzureChatOpenAI(model="gpt-4o-2024-08-06")
|
381
|
+
|
382
|
+
docs = retriever.invoke("Vacation policy?")
|
383
|
+
print(llm.invoke(prompt.format(context=docs, question="Vacation policy? ")).content)
|
384
|
+
```
|
385
|
+
|
386
|
+
### 4.5 Embeddings & structured outputs
|
387
|
+
|
388
|
+
```python
|
389
|
+
from uipath_langchain.embeddings import UiPathAzureOpenAIEmbeddings
|
390
|
+
from uipath_langchain.chat import UiPathChat
|
391
|
+
from pydantic import BaseModel, Field
|
392
|
+
|
393
|
+
emb = UiPathAzureOpenAIEmbeddings(model="text-embedding-3-large")
|
394
|
+
vec = emb.embed_query("remote work policy")
|
395
|
+
|
396
|
+
class EmailRule(BaseModel):
|
397
|
+
rule_name: str = Field(description="Name of the rule")
|
398
|
+
conditions: dict = Field(description="Rule conditions")
|
399
|
+
target_folder: str = Field(description="Target folder")
|
400
|
+
|
401
|
+
schema_chat = UiPathChat(model="gpt-4o-2024-08-06").with_structured_output(EmailRule)
|
402
|
+
rule = schema_chat.invoke("Create a rule to move emails from noreply@company.com to Archive")
|
403
|
+
```
|
404
|
+
|
405
|
+
### 4.6 Observability – Async tracer
|
406
|
+
|
407
|
+
```python
|
408
|
+
from uipath_langchain.tracers import AsyncUiPathTracer
|
409
|
+
from uipath_langchain.chat import UiPathChat
|
410
|
+
|
411
|
+
tracer = AsyncUiPathTracer(action_name="my_action", action_id="unique_id")
|
412
|
+
chat = UiPathChat(model="gpt-4o-2024-08-06", callbacks=[tracer])
|
413
|
+
```
|
414
|
+
|
415
|
+
---
|
416
|
+
|
417
|
+
## 5) LLM Gateway – Two ways to call models
|
418
|
+
|
419
|
+
### 5.1 OpenAI‑compatible path
|
420
|
+
|
421
|
+
```python
|
422
|
+
from uipath import UiPath
|
423
|
+
sdk = UiPath()
|
424
|
+
resp = sdk.llm_openai.chat.completions.create(
|
425
|
+
model="gpt-4",
|
426
|
+
messages=[{"role": "user", "content": "Summarize this invoice"}],
|
427
|
+
)
|
428
|
+
print(resp.choices[0].message.content)
|
429
|
+
```
|
430
|
+
|
431
|
+
### 5.2 Normalized UiPath LLM path
|
432
|
+
|
433
|
+
```python
|
434
|
+
from uipath import UiPath
|
435
|
+
sdk = UiPath()
|
436
|
+
answer = sdk.llm.chat(prompt="Analyze customer feedback", model="gpt-4")
|
437
|
+
print(answer.content if hasattr(answer, "content") else answer)
|
438
|
+
```
|
439
|
+
|
440
|
+
---
|
441
|
+
|
442
|
+
## 6) Testing, Evaluation & Quality Gates
|
443
|
+
|
444
|
+
- **Unit tests**: Pure functions in `src/` and graph nodes in `graphs/`.
|
445
|
+
- **E2E tests**: Use `uipath run` against local mocks or a Dev folder tenant.
|
446
|
+
- **Evaluations**: For agent behaviors, leverage `uipath eval` scenarios to benchmark prompt/graph changes.
|
447
|
+
- **Static checks**: `ruff`, `pyright`/`mypy` with type‑strict public APIs.
|
448
|
+
|
449
|
+
Minimal sanity check:
|
450
|
+
|
451
|
+
```python
|
452
|
+
import importlib.metadata, sys
|
453
|
+
print("uipath:", importlib.metadata.version("uipath"))
|
454
|
+
print("python:", sys.version)
|
455
|
+
```
|
456
|
+
|
457
|
+
## 8) Security, Secrets & Governance
|
458
|
+
|
459
|
+
- **Never** commit secrets. Use Secret Manager / GitHub Actions secrets.
|
460
|
+
- Scope tokens to least privilege; rotate regularly.
|
461
|
+
- For **credential assets**, prefer Action Center/Robot context retrieval over plain text.
|
462
|
+
- Enable **telemetry** and **tracing** for auditability.
|
463
|
+
|
464
|
+
---
|
465
|
+
|
466
|
+
## 9) Operational Patterns & Pitfalls
|
467
|
+
|
468
|
+
- **Folder context**: Prefer `folder_path`/`folder_key` explicitly in critical calls.
|
469
|
+
- **Idempotency**: For queues and bucket uploads, include natural keys and conflict handling.
|
470
|
+
- **Backpressure**: Poll jobs with exponential backoff; avoid tight loops.
|
471
|
+
- **Timeouts**: Raise `UIPATH_TIMEOUT_SECONDS` for large payloads.
|
472
|
+
- **Version pins**: For LangGraph, stay within `>=0.5,<0.7` range.
|
473
|
+
|
474
|
+
---
|
475
|
+
|
476
|
+
## 10) Merged API Surface
|
477
|
+
|
478
|
+
### 10.1 `uipath` (Python SDK)
|
479
|
+
|
480
|
+
#### Processes
|
481
|
+
|
482
|
+
- **`sdk.processes.invoke(name, input_arguments=None, folder_key=None, folder_path=None) -> Job`**
|
483
|
+
Start a process by **Release name**. Returns a `Job` with attributes like `.key`, `.state`, `.start_time`, `.end_time`, `.output_arguments` (string or JSON), and `.faulted_reason` when applicable.
|
484
|
+
_Common errors_: `httpx.HTTPStatusError 404 /Releases` (bad name or wrong folder), `403 Forbidden` (insufficient RBAC).
|
485
|
+
_Example:_
|
486
|
+
|
487
|
+
```python
|
488
|
+
job = sdk.processes.invoke("ACME_Invoice_Load", {"batch_id": "B-42"}, folder_path="Finance")
|
489
|
+
while job.state in ("Pending", "Running"):
|
490
|
+
await asyncio.sleep(3)
|
491
|
+
job = sdk.jobs.retrieve(job.key, folder_path="Finance")
|
492
|
+
if job.state == "Successful":
|
493
|
+
print("Output:", job.output_arguments)
|
494
|
+
else:
|
495
|
+
print("Failed:", job.faulted_reason)
|
496
|
+
```
|
497
|
+
|
498
|
+
- **`sdk.processes.invoke_async(...) -> Job`** – Fire‑and‑forget; same return as `invoke` but do not block.
|
499
|
+
|
500
|
+
#### Jobs
|
501
|
+
|
502
|
+
- **`sdk.jobs.retrieve(job_key, folder_key=None, folder_path=None) -> Job`** – Refresh job state and metadata.
|
503
|
+
- **`sdk.jobs.resume(inbox_id, job_id, folder_key=None, folder_path=None, payload=None) -> None`** – Resume a suspended job (HITL continuation).
|
504
|
+
- **`sdk.jobs.extract_output(job) -> Optional[str]`** – Convenience helper to get the output string.
|
505
|
+
- **Attachments API**
|
506
|
+
- `sdk.jobs.list_attachments(job_key, folder_key=None, folder_path=None) -> list[str]`
|
507
|
+
- `sdk.jobs.create_attachment(name, content=None, source_path=None, job_key=None, category=None, folder_key=None, folder_path=None) -> uuid.UUID`
|
508
|
+
- `sdk.jobs.link_attachment(attachment_key, job_key, category=None, folder_key=None, folder_path=None) -> None`
|
509
|
+
_Example:_
|
510
|
+
```python
|
511
|
+
key = sdk.jobs.create_attachment("summary.csv", content="id,val\n1,9")
|
512
|
+
sdk.jobs.link_attachment(key, job.key, category="Output")
|
513
|
+
for att in sdk.jobs.list_attachments(job.key):
|
514
|
+
print("Attachment:", att)
|
515
|
+
```
|
516
|
+
|
517
|
+
#### Assets
|
518
|
+
|
519
|
+
- **`sdk.assets.retrieve(name, folder_key=None, folder_path=None) -> Asset | UserAsset`** – Read scalar/JSON assets; access `.value`.
|
520
|
+
- **`sdk.assets.retrieve_credential(name, folder_key=None, folder_path=None)`** – Robot‑only; provides `.username` and `.password`.
|
521
|
+
- **`sdk.assets.update(robot_asset, folder_key=None, folder_path=None) -> Response`** – Update value (admin required).
|
522
|
+
_Tips_: Keep secrets in **Credential** assets. For per‑environment config, store by folder and pass `folder_path` explicitly.
|
523
|
+
|
524
|
+
#### Queues
|
525
|
+
|
526
|
+
- **`sdk.queues.create_item(name, specific_content: dict, priority='Normal', reference=None, due_date=None, ... ) -> Response`** – Enqueue work. Consider setting a **`reference`** to ensure idempotency.
|
527
|
+
- **`sdk.queues.create_transaction_item(name, no_robot: bool = False) -> TransactionItem | None`** – Claim a transaction for processing. Returned item has `.id`, `.specific_content`, `.reference`.
|
528
|
+
- **`sdk.queues.update_progress_of_transaction_item(transaction_key, progress: str) -> Response`** – Heartbeat/progress note.
|
529
|
+
- **`sdk.queues.complete_transaction_item(transaction_key, result: dict) -> Response`** – Mark result and, on failure, include `processing_exception`.
|
530
|
+
- **`sdk.queues.list_items(status=None, reference=None, top=100, ... ) -> Response`** – Filter queue contents.
|
531
|
+
_Example:_
|
532
|
+
```python
|
533
|
+
trx = sdk.queues.create_transaction_item("InvoiceProcessing")
|
534
|
+
if trx:
|
535
|
+
try:
|
536
|
+
# process trx.specific_content...
|
537
|
+
sdk.queues.complete_transaction_item(trx.id, {"status": "Successful", "message": "OK"})
|
538
|
+
except Exception as e:
|
539
|
+
sdk.queues.complete_transaction_item(trx.id, {
|
540
|
+
"status": "Failed", "is_successful": False, "processing_exception": str(e)
|
541
|
+
})
|
542
|
+
```
|
543
|
+
|
544
|
+
#### Buckets (Storage)
|
545
|
+
|
546
|
+
- **`sdk.buckets.upload(name, blob_file_path, source_path=None, content=None, content_type=None, folder_key=None, folder_path=None) -> None`** – Upload from disk or in‑memory `content`.
|
547
|
+
- **`sdk.buckets.download(name, blob_file_path, destination_path, folder_key=None, folder_path=None) -> None`** – Save a blob to local path.
|
548
|
+
- **`sdk.buckets.retrieve(name, key=None, folder_key=None, folder_path=None) -> Bucket`** – Inspect bucket metadata.
|
549
|
+
_Tip_: Use MIME `content_type` for correct downstream handling (e.g., `application/pdf`, `text/csv`).
|
550
|
+
|
551
|
+
#### Actions (Action Center)
|
552
|
+
|
553
|
+
- **`sdk.actions.create(title=None, data=None, app_name=None, app_key=None, app_folder_path=None, app_folder_key=None, app_version=None, assignee=None) -> Action`**
|
554
|
+
- **`sdk.actions.retrieve(action_key, app_folder_path=None, app_folder_key=None) -> Action`**
|
555
|
+
_Async variants available (`create_async`)._
|
556
|
+
_Pattern_: Create → return `WaitAction` from your `main()` → human completes → automation resumes via `jobs.resume` with payload.
|
557
|
+
|
558
|
+
#### Context Grounding (RAG)
|
559
|
+
|
560
|
+
- **`sdk.context_grounding.search(name, query, number_of_results=5, folder_key=None, folder_path=None) -> list[ContextGroundingQueryResponse]`** – Retrieve top‑k chunks (`.content`, `.source`).
|
561
|
+
- **`sdk.context_grounding.add_to_index(name, blob_file_path=None, content_type=None, content=None, source_path=None, ingest_data=True, folder_key=None, folder_path=None) -> None`** – Add docs.
|
562
|
+
- **`sdk.context_grounding.retrieve(name, folder_key=None, folder_path=None) -> ContextGroundingIndex`** – Inspect index.
|
563
|
+
- **`sdk.context_grounding.ingest_data(index, folder_key=None, folder_path=None) -> None`**, **`delete_index(index, ...)`** – Bulk ops.
|
564
|
+
_Example:_
|
565
|
+
```python
|
566
|
+
hits = sdk.context_grounding.search("Internal_Wiki", "vacation policy", 3)
|
567
|
+
ctx = "\n".join(h.content for h in hits)
|
568
|
+
answer = await sdk.llm.chat_completions(model="gpt-4o-mini-2024-07-18",
|
569
|
+
messages=[{"role":"user","content": f"Use this context:\n{ctx}\n\nQ: What is our policy?"}])
|
570
|
+
```
|
571
|
+
|
572
|
+
#### Connections (Integration Service)
|
573
|
+
|
574
|
+
- **`sdk.connections.retrieve(key) -> Connection`** – Connection metadata.
|
575
|
+
- **`sdk.connections.retrieve_token(key) -> ConnectionToken`** – OAuth token passthrough.
|
576
|
+
- **`sdk.connections.retrieve_event_payload(event_args) -> dict`** – Get full trigger payload for event‑driven agents.
|
577
|
+
|
578
|
+
#### Attachments (generic)
|
579
|
+
|
580
|
+
- **`sdk.attachments.upload(name, content=None, source_path=None, folder_key=None, folder_path=None) -> uuid.UUID`**
|
581
|
+
- **`sdk.attachments.download(key, destination_path, folder_key=None, folder_path=None) -> str`**
|
582
|
+
- **`sdk.attachments.delete(key, folder_key=None, folder_path=None) -> None`**
|
583
|
+
|
584
|
+
#### Folders
|
585
|
+
|
586
|
+
- **`sdk.folders.retrieve_key(folder_path) -> str | None`** – Resolve a path to folder key for scoping.
|
587
|
+
|
588
|
+
#### LLM Gateway
|
589
|
+
|
590
|
+
- **Normalized path**:
|
591
|
+
- `sdk.llm.chat_completions(model, messages, max_tokens=None, temperature=None, tools=None, tool_choice=None, ...) -> ChatCompletion`
|
592
|
+
- **OpenAI‑compatible path**:
|
593
|
+
- `sdk.llm_openai.chat.completions.create(model, messages, max_tokens=None, temperature=None, ...) -> ChatCompletion`
|
594
|
+
- `sdk.llm_openai.embeddings.create(input, embedding_model, openai_api_version=None) -> Embeddings`
|
595
|
+
_Tip_: Prefer **normalized** for UiPath‑first features; use **OpenAI‑compatible** to reuse LC/third‑party clients unchanged.
|
596
|
+
|
597
|
+
#### Low‑level HTTP
|
598
|
+
|
599
|
+
- **`sdk.api_client.request(method, url, scoped=True, infer_content_type=True, **kwargs) -> Response`\*\*
|
600
|
+
- **`sdk.api_client.request_async(...) -> Response`**
|
601
|
+
_Use cases_: custom endpoints, preview APIs, or troubleshooting raw requests.
|
602
|
+
|
603
|
+
---
|
604
|
+
|
605
|
+
### 10.2 `uipath-langchain` (LangGraph SDK)
|
606
|
+
|
607
|
+
#### Chat Models
|
608
|
+
|
609
|
+
- **`uipath_langchain.chat.UiPathChat`** (normalized) & **`UiPathAzureChatOpenAI`** (Azure passthrough)
|
610
|
+
**Init (common):** `model='gpt-4o-2024-08-06'`, `temperature`, `max_tokens`, `top_p`, `n`, `streaming=False`, `max_retries=2`, `request_timeout=None`, `callbacks=None`, `verbose=False`
|
611
|
+
**Messages:** `langchain_core.messages` (`SystemMessage`, `HumanMessage`, `AIMessage`) or plain string.
|
612
|
+
**Methods:**
|
613
|
+
|
614
|
+
- `invoke(messages | str) -> AIMessage` (sync)
|
615
|
+
- `ainvoke(messages | str) -> AIMessage` (async)
|
616
|
+
- `astream(messages)` → async generator of chunks (for streaming UIs)
|
617
|
+
- `with_structured_output(pydantic_model)` → parsed/validated output object
|
618
|
+
_Examples:_
|
619
|
+
|
620
|
+
```python
|
621
|
+
chat = UiPathChat(model="gpt-4o-2024-08-06")
|
622
|
+
print(chat.invoke("Say hi").content)
|
623
|
+
|
624
|
+
class Answer(BaseModel):
|
625
|
+
text: str
|
626
|
+
score: float
|
627
|
+
|
628
|
+
tool_chat = chat.with_structured_output(Answer)
|
629
|
+
parsed = tool_chat.invoke("Return a JSON with text and score")
|
630
|
+
```
|
631
|
+
|
632
|
+
#### Embeddings
|
633
|
+
|
634
|
+
- **`uipath_langchain.embeddings.UiPathAzureOpenAIEmbeddings`**
|
635
|
+
- `embed_documents(list[str]) -> list[list[float]]`
|
636
|
+
- `embed_query(str) -> list[float]`
|
637
|
+
_Params:_ `model='text-embedding-3-large'`, `dimensions=None`, `chunk_size=1000`, `max_retries=2`, `request_timeout=None`.
|
638
|
+
|
639
|
+
#### Vector Store (Context Grounding)
|
640
|
+
|
641
|
+
- **`uipath_langchain.vectorstores.ContextGroundingVectorStore(index_name, folder_path=None, uipath_sdk=None)`**
|
642
|
+
- `similarity_search(query, k=4) -> list[Document]`
|
643
|
+
- `similarity_search_with_score(query, k=4) -> list[tuple[Document, float]]`
|
644
|
+
- `similarity_search_with_relevance_scores(query, k=4, score_threshold=None) -> list[tuple[Document, float]]`
|
645
|
+
- `.as_retriever(search_kwargs={'k': 3}) -> BaseRetriever`
|
646
|
+
_Document fields_: `.page_content`, `.metadata` (source, uri, created_at).
|
647
|
+
|
648
|
+
#### Retriever
|
649
|
+
|
650
|
+
- **`uipath_langchain.retrievers.ContextGroundingRetriever(index_name, folder_path=None, folder_key=None, uipath_sdk=None, number_of_results=10)`**
|
651
|
+
- `invoke(query) -> list[Document]` (sync/async)
|
652
|
+
_Tip_: Use retriever in LC chains/graphs for clean separation of concerns.
|
653
|
+
|
654
|
+
#### Tracing / Observability
|
655
|
+
|
656
|
+
- **`uipath_langchain.tracers.AsyncUiPathTracer(action_name=None, action_id=None, context=None)`**
|
657
|
+
Add to `callbacks=[tracer]` on any LC runnable to capture spans/metadata into UiPath.
|
658
|
+
|
659
|
+
#### Agent Building with LangGraph
|
660
|
+
|
661
|
+
- **`langgraph.prebuilt.create_react_agent(llm, tools, prompt=None, **kwargs) -> Runnable`\*\* – Get a practical ReAct agent quickly.
|
662
|
+
- **`langgraph.graph.StateGraph`**
|
663
|
+
- `add_node(name, fn)` – Node is callable (sync/async) receiving/returning your `State` model.
|
664
|
+
- `add_edge(src, dst)` – Connect nodes (`START` and `END` available).
|
665
|
+
- `compile() -> Graph` – Freeze DAG for execution.
|
666
|
+
_Pattern:_ use nodes for **tool‑use**, **HITL interrupt**, **routing**, and **post‑processing**.
|
667
|
+
|
668
|
+
---
|
669
|
+
|
670
|
+
## 11) Troubleshooting
|
671
|
+
|
672
|
+
**Classic**
|
673
|
+
|
674
|
+
- `SecretMissingError` / `BaseUrlMissingError` → run `uipath auth`, verify env.
|
675
|
+
- 404 for Releases/Assets → check object names and folder context.
|
676
|
+
- 403 Forbidden → token scopes; re‑authenticate or create proper OAuth app.
|
677
|
+
- Timeouts → network/proxy; verify `UIPATH_URL`.
|
678
|
+
|
679
|
+
**LangGraph**
|
680
|
+
|
681
|
+
- `ModuleNotFoundError: uipath_langchain` → `pip install uipath-langchain`.
|
682
|
+
- 401 Unauthorized → check `UIPATH_ACCESS_TOKEN` or OAuth pair.
|
683
|
+
- Version mismatch → ensure `langgraph>=0.5,<0.7`.
|
684
|
+
|
685
|
+
---
|
686
|
+
|
687
|
+
## 12) Glossary
|
688
|
+
|
689
|
+
- **Action Center (HITL)**: Human‑in‑the‑loop task approvals.
|
690
|
+
- **Assets**: Centralized config/secret storage.
|
691
|
+
- **Buckets**: Cloud file storage.
|
692
|
+
- **Context Grounding**: UiPath semantic indexing for RAG.
|
693
|
+
- **LLM Gateway**: UiPath’s model broker (normalized and OpenAI‑compatible).
|
694
|
+
- **Queues**: Transactional work management.
|
695
|
+
|
696
|
+
---
|
697
|
+
|
698
|
+
## 13) Checklists
|
699
|
+
|
700
|
+
**Before first run**
|
701
|
+
|
702
|
+
- [ ] `uipath auth`
|
703
|
+
- [ ] Populate `.env` and copy to teammates as `.env.example` template
|
704
|
+
- [ ] `uipath init` after defining `main()` and/or graphs
|
705
|
+
|
706
|
+
**Pre‑publish**
|
707
|
+
|
708
|
+
- [ ] Unit + E2E passing
|
709
|
+
- [ ] `uipath pack` clean
|
710
|
+
- [ ] Secrets in Assets / Connections, not in code
|
711
|
+
|
712
|
+
**Production readiness**
|
713
|
+
|
714
|
+
- [ ] Folder scoping & RBAC verified
|
715
|
+
- [ ] Tracing/Telemetry enabled
|
716
|
+
- [ ] Runbooks for failures, retries, backoff
|
717
|
+
|
718
|
+
---
|
719
|
+
|
720
|
+
## 14) Links
|
721
|
+
|
722
|
+
- Project README: `./README.md`
|
723
|
+
- UiPath Python SDK docs & samples: https://uipath.github.io/uipath-python/
|
724
|
+
- UiPath LangGraph SDK docs & samples: https://uipath.github.io/uipath-python/langchain/quick_start/
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import json
|
2
1
|
from typing import Any, List, Optional, Tuple, Union
|
3
2
|
|
4
3
|
import httpx
|
@@ -353,7 +352,7 @@ class ContextGroundingService(FolderContext, BaseService):
|
|
353
352
|
response = self.request(
|
354
353
|
spec.method,
|
355
354
|
spec.endpoint,
|
356
|
-
|
355
|
+
json=spec.json,
|
357
356
|
)
|
358
357
|
|
359
358
|
return TypeAdapter(List[ContextGroundingQueryResponse]).validate_python(
|
@@ -403,7 +402,7 @@ class ContextGroundingService(FolderContext, BaseService):
|
|
403
402
|
response = await self.request_async(
|
404
403
|
spec.method,
|
405
404
|
spec.endpoint,
|
406
|
-
|
405
|
+
json=spec.json,
|
407
406
|
)
|
408
407
|
|
409
408
|
return TypeAdapter(List[ContextGroundingQueryResponse]).validate_python(
|
@@ -592,21 +591,19 @@ class ContextGroundingService(FolderContext, BaseService):
|
|
592
591
|
return RequestSpec(
|
593
592
|
method="POST",
|
594
593
|
endpoint=Endpoint("/ecs_/v2/indexes/create"),
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
"
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
}
|
609
|
-
),
|
594
|
+
json={
|
595
|
+
"name": name,
|
596
|
+
"description": description,
|
597
|
+
"dataSource": {
|
598
|
+
"@odata.type": ORCHESTRATOR_STORAGE_BUCKET_DATA_SOURCE,
|
599
|
+
"folder": storage_bucket_folder_path,
|
600
|
+
"bucketName": storage_bucket_name,
|
601
|
+
"fileNameGlob": file_name_glob
|
602
|
+
if file_name_glob is not None
|
603
|
+
else "*",
|
604
|
+
"directoryPath": "/",
|
605
|
+
},
|
606
|
+
},
|
610
607
|
headers={
|
611
608
|
**header_folder(folder_key, None),
|
612
609
|
},
|
@@ -657,12 +654,10 @@ class ContextGroundingService(FolderContext, BaseService):
|
|
657
654
|
return RequestSpec(
|
658
655
|
method="POST",
|
659
656
|
endpoint=Endpoint("/ecs_/v1/search"),
|
660
|
-
|
661
|
-
{
|
662
|
-
|
663
|
-
|
664
|
-
}
|
665
|
-
),
|
657
|
+
json={
|
658
|
+
"query": {"query": query, "numberOfResults": number_of_results},
|
659
|
+
"schema": {"name": name},
|
660
|
+
},
|
666
661
|
headers={
|
667
662
|
**header_folder(folder_key, None),
|
668
663
|
},
|
uipath/_services/jobs_service.py
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
import json
|
2
1
|
import os
|
3
2
|
import shutil
|
4
3
|
import tempfile
|
@@ -81,7 +80,7 @@ class JobsService(FolderContext, BaseService):
|
|
81
80
|
spec.method,
|
82
81
|
url=spec.endpoint,
|
83
82
|
headers=spec.headers,
|
84
|
-
|
83
|
+
json=spec.json,
|
85
84
|
)
|
86
85
|
|
87
86
|
async def resume_async(
|
@@ -142,7 +141,7 @@ class JobsService(FolderContext, BaseService):
|
|
142
141
|
spec.method,
|
143
142
|
url=spec.endpoint,
|
144
143
|
headers=spec.headers,
|
145
|
-
|
144
|
+
json=spec.json,
|
146
145
|
)
|
147
146
|
|
148
147
|
@property
|
@@ -412,7 +411,7 @@ class JobsService(FolderContext, BaseService):
|
|
412
411
|
endpoint=Endpoint(
|
413
412
|
f"/orchestrator_/api/JobTriggers/DeliverPayload/{inbox_id}"
|
414
413
|
),
|
415
|
-
|
414
|
+
json={"payload": payload},
|
416
415
|
headers={
|
417
416
|
**header_folder(folder_key, folder_path),
|
418
417
|
},
|
@@ -16,7 +16,6 @@ Classes:
|
|
16
16
|
UiPathLlmChatService: Service using UiPath's normalized API format
|
17
17
|
"""
|
18
18
|
|
19
|
-
import json
|
20
19
|
from typing import Any, Dict, List, Optional, Union
|
21
20
|
|
22
21
|
from pydantic import BaseModel
|
@@ -195,7 +194,7 @@ class UiPathOpenAIService(BaseService):
|
|
195
194
|
response = await self.request_async(
|
196
195
|
"POST",
|
197
196
|
endpoint,
|
198
|
-
|
197
|
+
json={"input": input},
|
199
198
|
params={"api-version": API_VERSION},
|
200
199
|
headers=DEFAULT_LLM_HEADERS,
|
201
200
|
)
|
@@ -322,7 +321,7 @@ class UiPathOpenAIService(BaseService):
|
|
322
321
|
response = await self.request_async(
|
323
322
|
"POST",
|
324
323
|
endpoint,
|
325
|
-
|
324
|
+
json=request_body,
|
326
325
|
params={"api-version": API_VERSION},
|
327
326
|
headers=DEFAULT_LLM_HEADERS,
|
328
327
|
)
|
@@ -534,7 +533,7 @@ class UiPathLlmChatService(BaseService):
|
|
534
533
|
response = await self.request_async(
|
535
534
|
"POST",
|
536
535
|
endpoint,
|
537
|
-
|
536
|
+
json=request_body,
|
538
537
|
params={"api-version": NORMALIZED_API_VERSION},
|
539
538
|
headers=headers,
|
540
539
|
)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: uipath
|
3
|
-
Version: 2.1.
|
3
|
+
Version: 2.1.52
|
4
4
|
Summary: Python SDK and CLI for UiPath Platform, enabling programmatic interaction with automation services, process management, and deployment tools.
|
5
5
|
Project-URL: Homepage, https://uipath.com
|
6
6
|
Project-URL: Repository, https://github.com/UiPath/uipath-python
|
@@ -5,12 +5,12 @@ uipath/_folder_context.py,sha256=D-bgxdwpwJP4b_QdVKcPODYh15kMDrOar2xNonmMSm4,186
|
|
5
5
|
uipath/_uipath.py,sha256=p2ccvWpzBXAGFSSF_YaaSWdEqzMmRt786d0pFWrCEwU,4463
|
6
6
|
uipath/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
7
|
uipath/_cli/README.md,sha256=GLtCfbeIKZKNnGTCsfSVqRQ27V1btT1i2bSAyW_xZl4,474
|
8
|
-
uipath/_cli/__init__.py,sha256=
|
8
|
+
uipath/_cli/__init__.py,sha256=tscKceSouYcEOxUbGjoyHi4qGi74giBFeXG1I-ut1hs,2308
|
9
9
|
uipath/_cli/cli_auth.py,sha256=i3ykLlCg68xgPXHHaa0agHwGFIiLiTLzOiF6Su8XaEo,2436
|
10
10
|
uipath/_cli/cli_deploy.py,sha256=KPCmQ0c_NYD5JofSDao5r6QYxHshVCRxlWDVnQvlp5w,645
|
11
11
|
uipath/_cli/cli_dev.py,sha256=nEfpjw1PZ72O6jmufYWVrueVwihFxDPOeJakdvNHdOA,2146
|
12
12
|
uipath/_cli/cli_eval.py,sha256=fYJWQlyiIc8SpTzY9QPNQWOx40PagMEKdsGZIu9As2A,4402
|
13
|
-
uipath/_cli/cli_init.py,sha256=
|
13
|
+
uipath/_cli/cli_init.py,sha256=Ac3-9tIH3rpikIX1ehWTo7InW5tjVNoz_w6fjvgLK4w,7052
|
14
14
|
uipath/_cli/cli_invoke.py,sha256=4jyhqcy7tPrpxvaUhW-9gut6ddsCGMdJJcpOXXmIe8g,4348
|
15
15
|
uipath/_cli/cli_new.py,sha256=9378NYUBc9j-qKVXV7oja-jahfJhXBg8zKVyaon7ctY,2102
|
16
16
|
uipath/_cli/cli_pack.py,sha256=NmwZTfwZ2fURiHyiX1BM0juAtBOjPB1Jmcpu-rD7p-4,11025
|
@@ -45,7 +45,7 @@ uipath/_cli/_dev/_terminal/_utils/_chat.py,sha256=YUZxYVdmEManwHDuZsczJT1dWIYE1d
|
|
45
45
|
uipath/_cli/_dev/_terminal/_utils/_exporter.py,sha256=oI6D_eMwrh_2aqDYUh4GrJg8VLGrLYhDahR-_o0uJns,4144
|
46
46
|
uipath/_cli/_dev/_terminal/_utils/_logger.py,sha256=jeNShEED27cNIHTe_NNx-2kUiXpSLTmi0onM6tVkqRM,888
|
47
47
|
uipath/_cli/_evals/_runtime.py,sha256=q4h3zp_7Ygkhj1zE_YTKKXRp3BhkHaPj8CWqjkzerTk,4748
|
48
|
-
uipath/_cli/_evals/progress_reporter.py,sha256=
|
48
|
+
uipath/_cli/_evals/progress_reporter.py,sha256=PGt1rs7IH1C6HPw8fWUwb98GB3UBuM6eUiiqGthfCIk,11174
|
49
49
|
uipath/_cli/_evals/_evaluators/__init__.py,sha256=jD7KNLjbsUpsESFXX11eW2MEPXDNuPp2-t-IPB-inlM,734
|
50
50
|
uipath/_cli/_evals/_evaluators/_deterministic_evaluator_base.py,sha256=BTl0puBjp9iCsU3YFfYWqk4TOz4iE19O3q1-dK6qUOI,1723
|
51
51
|
uipath/_cli/_evals/_evaluators/_evaluator_base.py,sha256=knHUwYFt0gMG1uJhq5TGEab6M_YevxX019yT3yYwZsw,3787
|
@@ -79,10 +79,11 @@ uipath/_cli/_utils/_folders.py,sha256=UVJcKPfPAVR5HF4AP6EXdlNVcfEF1v5pwGCpoAgBY3
|
|
79
79
|
uipath/_cli/_utils/_input_args.py,sha256=3LGNqVpJItvof75VGm-ZNTUMUH9-c7-YgleM5b2YgRg,5088
|
80
80
|
uipath/_cli/_utils/_parse_ast.py,sha256=8Iohz58s6bYQ7rgWtOTjrEInLJ-ETikmOMZzZdIY2Co,20072
|
81
81
|
uipath/_cli/_utils/_processes.py,sha256=q7DfEKHISDWf3pngci5za_z0Pbnf_shWiYEcTOTCiyk,1855
|
82
|
-
uipath/_cli/_utils/_project_files.py,sha256=
|
82
|
+
uipath/_cli/_utils/_project_files.py,sha256=sulh3xZhDDw_rBOrn_XSUfVSD6sUu47ZK4n_lF5BKkQ,13197
|
83
83
|
uipath/_cli/_utils/_studio_project.py,sha256=HvzcpIIIA4hUIvMbId1dsAhmFLMuhnS2ZtyNdcpXJ8c,15422
|
84
84
|
uipath/_cli/_utils/_tracing.py,sha256=2igb03j3EHjF_A406UhtCKkPfudVfFPjUq5tXUEG4oo,1541
|
85
85
|
uipath/_cli/_utils/_uv_helpers.py,sha256=6SvoLnZPoKIxW0sjMvD1-ENV_HOXDYzH34GjBqwT138,3450
|
86
|
+
uipath/_resources/AGENTS.md,sha256=YWhWuX9XIbyVhVT3PnPc4Of3_q6bsNJcuzYu3N8f_Ug,25850
|
86
87
|
uipath/_services/__init__.py,sha256=W08UO7ZBQRD8LBHsC6gaM4YBSUl8az0S4d6iZSKsdPE,965
|
87
88
|
uipath/_services/_base_service.py,sha256=x9-9jhPzn9Z16KRdFHhJNvV-FZHvTniMsDfxlS4Cutk,5782
|
88
89
|
uipath/_services/actions_service.py,sha256=2RPMR-hFMsOlqEyjIf3aF7-lrf57jdrSD0pBjj0Kyko,16040
|
@@ -91,11 +92,11 @@ uipath/_services/assets_service.py,sha256=pG0Io--SeiRRQmfUWPQPl1vq3csZlQgx30LBNK
|
|
91
92
|
uipath/_services/attachments_service.py,sha256=NPQYK7CGjfBaNT_1S5vEAfODmOChTbQZforllFM2ofU,26678
|
92
93
|
uipath/_services/buckets_service.py,sha256=5s8tuivd7GUZYj774DDUYTa0axxlUuesc4EBY1V5sdk,18496
|
93
94
|
uipath/_services/connections_service.py,sha256=Rf-DCm43tsDM6Cfp41iwGR4gUk_YCdobGcmbSoKvQ6E,7480
|
94
|
-
uipath/_services/context_grounding_service.py,sha256=
|
95
|
+
uipath/_services/context_grounding_service.py,sha256=kp7h6Hd-VUuTqiDO-G7IanmXhaq0XHjXUk0ISFev-5c,24835
|
95
96
|
uipath/_services/entities_service.py,sha256=QKCLE6wRgq3HZraF-M2mljy-8il4vsNHrQhUgkewVVk,14028
|
96
97
|
uipath/_services/folder_service.py,sha256=9JqgjKhWD-G_KUnfUTP2BADxL6OK9QNZsBsWZHAULdE,2749
|
97
|
-
uipath/_services/jobs_service.py,sha256=
|
98
|
-
uipath/_services/llm_gateway_service.py,sha256=
|
98
|
+
uipath/_services/jobs_service.py,sha256=tTZNsdZKN3uP7bWPQyBCpJeQxTfuOWbKYOR4L-_yJo4,32736
|
99
|
+
uipath/_services/llm_gateway_service.py,sha256=Ka1WCoOBKJfIlm7H9NmbKAPr27UYDYQCTExMbLKMY68,24249
|
99
100
|
uipath/_services/processes_service.py,sha256=O_uHgQ1rnwiV5quG0OQqabAnE6Rf6cWrMENYY2jKWt8,8585
|
100
101
|
uipath/_services/queues_service.py,sha256=VaG3dWL2QK6AJBOLoW2NQTpkPfZjsqsYPl9-kfXPFzA,13534
|
101
102
|
uipath/_utils/__init__.py,sha256=VdcpnENJIa0R6Y26NoxY64-wUVyvb4pKfTh1wXDQeMk,526
|
@@ -147,8 +148,8 @@ uipath/tracing/_traced.py,sha256=qeVDrds2OUnpdUIA0RhtF0kg2dlAZhyC1RRkI-qivTM,185
|
|
147
148
|
uipath/tracing/_utils.py,sha256=wJRELaPu69iY0AhV432Dk5QYf_N_ViRU4kAUG1BI1ew,10384
|
148
149
|
uipath/utils/__init__.py,sha256=VD-KXFpF_oWexFg6zyiWMkxl2HM4hYJMIUDZ1UEtGx0,105
|
149
150
|
uipath/utils/_endpoints_manager.py,sha256=iRTl5Q0XAm_YgcnMcJOXtj-8052sr6jpWuPNz6CgT0Q,8408
|
150
|
-
uipath-2.1.
|
151
|
-
uipath-2.1.
|
152
|
-
uipath-2.1.
|
153
|
-
uipath-2.1.
|
154
|
-
uipath-2.1.
|
151
|
+
uipath-2.1.52.dist-info/METADATA,sha256=zNHWskIn1OPB0hrLbZBoX6qmd-U-52O_LTHBZ06FvdQ,6482
|
152
|
+
uipath-2.1.52.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
153
|
+
uipath-2.1.52.dist-info/entry_points.txt,sha256=9C2_29U6Oq1ExFu7usihR-dnfIVNSKc-0EFbh0rskB4,43
|
154
|
+
uipath-2.1.52.dist-info/licenses/LICENSE,sha256=-KBavWXepyDjimmzH5fVAsi-6jNVpIKFc2kZs0Ri4ng,1058
|
155
|
+
uipath-2.1.52.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|