uipath-langchain 0.0.101__py3-none-any.whl → 0.0.103__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.

Potentially problematic release.


This version of uipath-langchain might be problematic. Click here for more details.

@@ -80,9 +80,6 @@ class LangGraphRuntime(UiPathBaseRuntime):
80
80
 
81
81
  if self.context.job_id and self.context.tracing_enabled:
82
82
  tracer = AsyncUiPathTracer(context=self.context.trace_context)
83
- await tracer.init_trace(
84
- self.context.entrypoint, self.context.job_id
85
- )
86
83
  callbacks = [tracer]
87
84
 
88
85
  graph_config: RunnableConfig = {
@@ -59,9 +59,10 @@ def langgraph_new_middleware(name: str) -> MiddlewareResult:
59
59
  init_cmd = ctx.parent.command.get_command(ctx, "init") # type: ignore
60
60
  ctx.invoke(init_cmd)
61
61
  console.config(
62
- " Please ensure to define either ANTHROPIC_API_KEY or OPENAI_API_KEY in your .env file."
62
+ f""" Please ensure to define either {click.style("ANTHROPIC_API_KEY", fg="bright_yellow")} or {click.style("OPENAI_API_KEY", fg="bright_yellow")} in your .env file. """
63
63
  )
64
- console.hint(""" Run agent: uipath run agent '{"topic": "UiPath"}'""")
64
+ run_command = """uipath run agent '{"topic": "UiPath"}'"""
65
+ console.hint(f""" Run agent: {click.style(run_command, fg="cyan")}""")
65
66
  return MiddlewareResult(should_continue=False)
66
67
  except Exception as e:
67
68
  console.error(f"Error creating demo agent {str(e)}")
@@ -2,7 +2,6 @@ import asyncio
2
2
  import json
3
3
  import logging
4
4
  import queue
5
- import re
6
5
  import uuid
7
6
  import warnings
8
7
  from os import environ as env
@@ -43,9 +42,7 @@ class AsyncUiPathTracer(AsyncBaseTracer):
43
42
 
44
43
  self.context = context or UiPathTraceContext()
45
44
 
46
- llm_ops_pattern = self._get_base_url() + "{orgId}/llmops_"
47
-
48
- self.url = llm_ops_pattern.format(orgId=self.context.org_id).rstrip("/")
45
+ self.base_url = self._get_base_url()
49
46
 
50
47
  auth_token = env.get("UNATTENDED_USER_ACCESS_TOKEN") or env.get(
51
48
  "UIPATH_ACCESS_TOKEN"
@@ -103,44 +100,6 @@ class AsyncUiPathTracer(AsyncBaseTracer):
103
100
  )
104
101
  self._send_span(previous_run)
105
102
 
106
- async def init_trace(self, run_name, trace_id=None) -> None:
107
- if self.context.trace_id:
108
- # trace id already set no need to do anything
109
- return
110
-
111
- # no trace id, start a new trace
112
- await self.start_trace(run_name, trace_id)
113
-
114
- async def start_trace(self, run_name, trace_id=None) -> None:
115
- self.context.trace_id = str(uuid.uuid4())
116
-
117
- run_name = run_name or f"Job Run: {self.context.trace_id}"
118
- trace_data = {
119
- "id": self.context.trace_id,
120
- "name": re.sub(
121
- r"[!@#$<>\.]", "", run_name
122
- ), # if we use these characters the Agents UI throws some error (but llmops backend seems fine)
123
- "referenceId": self.context.reference_id,
124
- "attributes": "{}",
125
- "organizationId": self.context.org_id,
126
- "tenantId": self.context.tenant_id,
127
- }
128
-
129
- for attempt in range(self.retries):
130
- response = await self.client.post(
131
- f"{self.url}/api/Agent/trace/", headers=self.headers, json=trace_data
132
- )
133
-
134
- if response.is_success:
135
- break
136
-
137
- await asyncio.sleep(0.5 * (2**attempt)) # Exponential backoff
138
-
139
- if 400 <= response.status_code < 600:
140
- logger.warning(
141
- f"Error when sending trace: {response}. Body is: {response.text}"
142
- )
143
-
144
103
  async def wait_for_all_tracers(self) -> None:
145
104
  """
146
105
  Wait for all pending log requests to complete
@@ -159,11 +118,13 @@ class AsyncUiPathTracer(AsyncBaseTracer):
159
118
 
160
119
  span_data = self.log_queue.get_nowait()
161
120
 
121
+ url = self._build_url(self.context.trace_id)
122
+
162
123
  for attempt in range(self.retries):
163
124
  response = await self.client.post(
164
- f"{self.url}/api/Agent/span/",
125
+ url,
165
126
  headers=self.headers,
166
- json=span_data,
127
+ json=[span_data], # api expects a list of spans
167
128
  timeout=10,
168
129
  )
169
130
 
@@ -189,11 +150,12 @@ class AsyncUiPathTracer(AsyncBaseTracer):
189
150
  break
190
151
 
191
152
  span_data = self.log_queue.get_nowait()
153
+ url = self._build_url(self.context.trace_id)
192
154
 
193
155
  response = await self.client.post(
194
- f"{self.url}/api/Agent/span/",
156
+ url,
195
157
  headers=self.headers,
196
- json=span_data,
158
+ json=[span_data], # api expects a list of spans
197
159
  timeout=10,
198
160
  )
199
161
  except Exception as e:
@@ -239,6 +201,7 @@ class AsyncUiPathTracer(AsyncBaseTracer):
239
201
  "jobKey": self.context.job_id,
240
202
  "folderKey": self.context.folder_key,
241
203
  "processKey": self.context.folder_key,
204
+ "expiryTimeUtc": None,
242
205
  }
243
206
 
244
207
  self.log_queue.put(span_data)
@@ -293,16 +256,11 @@ class AsyncUiPathTracer(AsyncBaseTracer):
293
256
  uipath_url = (
294
257
  env.get("UIPATH_URL") or "https://cloud.uipath.com/dummyOrg/dummyTennant/"
295
258
  )
296
- uipath_url = uipath_url.rstrip("/")
297
259
 
298
- # split by "//" to get ['', 'https:', 'alpha.uipath.com/ada/byoa']
299
- parts = uipath_url.split("//")
300
-
301
- # after splitting by //, the base URL will be at index 1 along with the rest,
302
- # hence split it again using "/" to get ['https:', 'alpha.uipath.com', 'ada', 'byoa']
303
- base_url_parts = parts[1].split("/")
260
+ uipath_url = uipath_url.rstrip("/")
304
261
 
305
- # combine scheme and netloc to get the base URL
306
- base_url = parts[0] + "//" + base_url_parts[0] + "/"
262
+ return uipath_url
307
263
 
308
- return base_url
264
+ def _build_url(self, trace_id: Optional[str]) -> str:
265
+ """Construct the URL for the API request."""
266
+ return f"{self.base_url}/llmopstenant_/api/Traces/spans?traceId={trace_id}&source=Robots"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: uipath-langchain
3
- Version: 0.0.101
3
+ Version: 0.0.103
4
4
  Summary: UiPath Langchain
5
5
  Project-URL: Homepage, https://uipath.com
6
6
  Project-URL: Repository, https://github.com/UiPath/uipath-langchain-python
@@ -25,7 +25,7 @@ Requires-Dist: pydantic-settings>=2.6.0
25
25
  Requires-Dist: python-dotenv>=1.0.1
26
26
  Requires-Dist: requests>=2.23.3
27
27
  Requires-Dist: types-requests>=2.32.0.20241016
28
- Requires-Dist: uipath<2.1.0,>=2.0.31
28
+ Requires-Dist: uipath<2.1.0,>=2.0.33
29
29
  Provides-Extra: langchain
30
30
  Description-Content-Type: text/markdown
31
31
 
@@ -34,16 +34,18 @@ Description-Content-Type: text/markdown
34
34
  [![PyPI downloads](https://img.shields.io/pypi/dm/uipath-langchain.svg)](https://pypi.org/project/uipath-langchain/)
35
35
  [![Python versions](https://img.shields.io/pypi/pyversions/uipath-langchain.svg)](https://pypi.org/project/uipath-langchain/)
36
36
 
37
- A Python SDK that enables developers to build and deploy LangGraph agents to the UiPath Platform. This package provides programmatic interaction with UiPath Platform services and human-in-the-loop (HITL) semantics through Action Center integration.
37
+ A Python SDK that enables developers to build and deploy LangGraph agents to the UiPath Cloud Platform. This package provides programmatic interaction with UiPath Cloud Platform services and human-in-the-loop (HITL) semantics through Action Center integration.
38
38
 
39
39
  This package is an extension to the [UiPath Python SDK](https://github.com/UiPath/uipath-python).
40
40
 
41
- This [quickstart guide](docs/quick_start.md) walks you through deploying your first agent to UiPath Cloud Platform.
41
+ This [quickstart guide](https://uipath.github.io/uipath-python/) walks you through deploying your first agent to UiPath Cloud Platform.
42
+
43
+ Check out these [sample projects](https://github.com/UiPath/uipath-langchain-python/tree/main/samples) to see the SDK in action.
42
44
 
43
45
  ## Requirements
44
46
 
45
- - Python 3.10 or higher
46
- - UiPath Automation Cloud account
47
+ - Python 3.10 or higher
48
+ - UiPath Automation Cloud account
47
49
 
48
50
  ## Installation
49
51
 
@@ -105,10 +107,12 @@ uipath pack
105
107
  Packages your project into a `.nupkg` file that can be deployed to UiPath.
106
108
 
107
109
  **Note:** Your `pyproject.toml` must include:
108
- - A description field (avoid characters: &, <, >, ", ', ;)
109
- - Author information
110
+
111
+ - A description field (avoid characters: &, <, >, ", ', ;)
112
+ - Author information
110
113
 
111
114
  Example:
115
+
112
116
  ```toml
113
117
  description = "Your package description"
114
118
  authors = [{name = "Your Name", email = "your.email@example.com"}]
@@ -125,14 +129,14 @@ Publishes the most recently created package to your UiPath Orchestrator.
125
129
  ## Project Structure
126
130
 
127
131
  To properly use the CLI for packaging and publishing, your project should include:
128
- - A `pyproject.toml` file with project metadata
129
- - A `langgraph.json` file
130
- - A `uipath.json` file (generated by `uipath init`)
131
- - Any Python files needed for your automation
132
+
133
+ - A `pyproject.toml` file with project metadata
134
+ - A `langgraph.json` file
135
+ - A `uipath.json` file (generated by `uipath init`)
136
+ - Any Python files needed for your automation
132
137
 
133
138
  ## Development
134
139
 
135
140
  ### Setting Up a Development Environment
136
141
 
137
- Please read our [contribution guidelines](CONTRIBUTING.md) before submitting a pull request.
138
-
142
+ Please read our [contribution guidelines](https://github.com/UiPath/uipath-langchain-python/blob/main/CONTRIBUTING.md) before submitting a pull request.
@@ -2,14 +2,14 @@ uipath_langchain/__init__.py,sha256=VBrvQn7d3nuOdN7zEnV2_S-uhmkjgEIlXiFVeZxZakQ,
2
2
  uipath_langchain/middlewares.py,sha256=tre7o9DFMgWk1DJiEEUmT6_wiP-PPkWtKmG0iOyvr9c,509
3
3
  uipath_langchain/_cli/__init__.py,sha256=juqd9PbXs4yg45zMJ7BHAOPQjb7sgEbWE9InBtGZhfo,24
4
4
  uipath_langchain/_cli/cli_init.py,sha256=B5BVUA7pDvKyRRGEx5mgmeE5SJvLPM3cnLGt6a9iixY,7417
5
- uipath_langchain/_cli/cli_new.py,sha256=WwuHFPvKxUolf2tJFZD6PitZJaR-5EU9T-WTqpDuhOw,2438
5
+ uipath_langchain/_cli/cli_new.py,sha256=R-41FqPBg5dLSgWLYqqT1d95fl-2_jWrr1RzVBkUs3M,2589
6
6
  uipath_langchain/_cli/cli_run.py,sha256=8-7NBguH3ACwN3bHEtyj2d3N-FFLJQLaiHDNI_3hnQE,2863
7
7
  uipath_langchain/_cli/_runtime/_context.py,sha256=wr4aNn06ReIXmetEZ6b6AnpAt64p13anQ2trZ5Bzgio,807
8
8
  uipath_langchain/_cli/_runtime/_escalation.py,sha256=oA5NvZvCo8ngELFJRyhZNM69DxVHrshhMY6CUk_cukQ,8055
9
9
  uipath_langchain/_cli/_runtime/_exception.py,sha256=USKkLYkG-dzjX3fEiMMOHnVUpiXJs_xF0OQXCCOvbYM,546
10
10
  uipath_langchain/_cli/_runtime/_input.py,sha256=gKzPaGW-EzgeAskWJjbCWnfZRLu_BM7lCXkq0XkVGLU,5614
11
11
  uipath_langchain/_cli/_runtime/_output.py,sha256=WQSrsvGaaclZ6GLWEh6Nk1Mz1iGaIB45PgIX3DS3AN4,16130
12
- uipath_langchain/_cli/_runtime/_runtime.py,sha256=wj6e6tQdP2GjuSM-6G6Ug-FMqwOHwfUq-DGbd1gMfIg,11825
12
+ uipath_langchain/_cli/_runtime/_runtime.py,sha256=ai3qxNmdPACxowq7WcNBn9m8-KXe4vFwvpBn0lh6kmQ,11689
13
13
  uipath_langchain/_cli/_templates/langgraph.json.template,sha256=eeh391Gta_hoRgaNaZ58nW1LNvCVXA7hlAH6l7Veous,107
14
14
  uipath_langchain/_cli/_templates/main.py.template,sha256=9JEyPxwc4Ce8Dfd2UAgHgpwkkjuXwWXOQZ-65P53QuM,1195
15
15
  uipath_langchain/_cli/_utils/_graph.py,sha256=WLBSJfPc3_C07SqJhePRe17JIc5wcBvEqLviMcNOdTA,6950
@@ -25,7 +25,7 @@ uipath_langchain/embeddings/__init__.py,sha256=QICtYB58ZyqFfDQrEaO8lTEgAU5NuEKlR
25
25
  uipath_langchain/embeddings/embeddings.py,sha256=gntzTfwO1pHbgnXiPdfETJaaurvQWqxVUCH75VMah54,4274
26
26
  uipath_langchain/retrievers/__init__.py,sha256=rOn7PyyHgZ4pMnXWPkGqmuBmx8eGuo-Oyndo7Wm9IUU,108
27
27
  uipath_langchain/retrievers/context_grounding_retriever.py,sha256=CeVSMEz5xTQIladkzDLeQXGC1_ycW72gb0RB41JZeYA,2000
28
- uipath_langchain/tracers/AsyncUiPathTracer.py,sha256=gheNa679YnM9HrP0VFr-oYfWmpS5-dKOIG8ItzU4AEQ,10477
28
+ uipath_langchain/tracers/AsyncUiPathTracer.py,sha256=VLqoegxa8J3VwMCkGicO626nSzyCQv-Zj14lZrWXA2Y,8900
29
29
  uipath_langchain/tracers/UiPathTracer.py,sha256=V5g1nlB0TI1wYvUIkfCEcAdhy4thqeMBmjflWtxc-_M,5601
30
30
  uipath_langchain/tracers/__init__.py,sha256=MwrQh6iuPXMS72S5EX0JdCAX0TKe-l7fIPGV3EG0Ssk,256
31
31
  uipath_langchain/tracers/_events.py,sha256=CJri76SSdu7rGJIkXurJ2C5sQahfSK4E5UWwWYdEAtE,922
@@ -36,8 +36,8 @@ uipath_langchain/utils/_request_mixin.py,sha256=WFyTDyAthSci1DRwUwS21I3hLntD7HdV
36
36
  uipath_langchain/utils/_settings.py,sha256=MhwEVj4gVRSar0RBf2w2hTjO-5Qm-HpCuufqN3gSWjA,3390
37
37
  uipath_langchain/utils/_sleep_policy.py,sha256=e9pHdjmcCj4CVoFM1jMyZFelH11YatsgWfpyrfXzKBQ,1251
38
38
  uipath_langchain/vectorstores/context_grounding_vectorstore.py,sha256=eTa5sX43-ydB1pj9VNHUPbB-hC36fZK_CGrNe5U2Nrw,9393
39
- uipath_langchain-0.0.101.dist-info/METADATA,sha256=_DMJPrVOEPDT_0kJm6aLPYMzME2NfuQYx55jAd3qeT8,3937
40
- uipath_langchain-0.0.101.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
41
- uipath_langchain-0.0.101.dist-info/entry_points.txt,sha256=FUtzqGOEntlJKMJIXhQUfT7ZTbQmGhke1iCmDWZaQZI,81
42
- uipath_langchain-0.0.101.dist-info/licenses/LICENSE,sha256=JDpt-uotAkHFmxpwxi6gwx6HQ25e-lG4U_Gzcvgp7JY,1063
43
- uipath_langchain-0.0.101.dist-info/RECORD,,
39
+ uipath_langchain-0.0.103.dist-info/METADATA,sha256=APsivdYkuoM0ek-as3rboX81hQmseePmqz0Tp-OrD-s,4177
40
+ uipath_langchain-0.0.103.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
41
+ uipath_langchain-0.0.103.dist-info/entry_points.txt,sha256=FUtzqGOEntlJKMJIXhQUfT7ZTbQmGhke1iCmDWZaQZI,81
42
+ uipath_langchain-0.0.103.dist-info/licenses/LICENSE,sha256=JDpt-uotAkHFmxpwxi6gwx6HQ25e-lG4U_Gzcvgp7JY,1063
43
+ uipath_langchain-0.0.103.dist-info/RECORD,,