Skip to content

Commit bfe2c1a

Browse files
RunnanJiaclaude
andcommitted
feat(platform): include jobKey in LLM Gateway trace baggage
build_trace_context_headers emits folderKey/agentId/processKey but omits jobKey, even though UiPathConfig.job_key is available. LLM Gateway now builds the model-call span from this baggage, so without jobKey the span cannot be attributed to the originating job. Callers currently work around this by hand-injecting jobKey via extra_baggage; emitting it natively fixes it once for every caller. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent e1eac9c commit bfe2c1a

3 files changed

Lines changed: 5 additions & 1 deletion

File tree

packages/uipath-platform/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "uipath-platform"
3-
version = "0.2.6"
3+
version = "0.2.7"
44
description = "HTTP client library for programmatic access to UiPath Platform"
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.11"

packages/uipath-platform/src/uipath/platform/chat/llm_trace_context.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ def build_trace_context_headers(
4444
baggage_parts.append(f"agentId={agent_id}")
4545
if process_uuid := UiPathConfig.process_uuid:
4646
baggage_parts.append(f"processKey={process_uuid}")
47+
if job_key := UiPathConfig.job_key:
48+
baggage_parts.append(f"jobKey={job_key}")
4749
if baggage_parts:
4850
headers["x-uipath-tracebaggage"] = ",".join(baggage_parts)
4951

packages/uipath-platform/tests/services/test_llm_trace_context.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ def test_all_env_vars_present(self) -> None:
122122
"UIPATH_FOLDER_KEY": "folder-abc",
123123
ENV_PROJECT_KEY: "agent-123",
124124
"UIPATH_PROCESS_UUID": "process-789",
125+
"UIPATH_JOB_KEY": "job-456",
125126
}
126127
with patch.dict(os.environ, env, clear=True):
127128
headers = build_trace_context_headers()
@@ -130,6 +131,7 @@ def test_all_env_vars_present(self) -> None:
130131
assert "folderKey=folder-abc" in baggage
131132
assert "agentId=agent-123" in baggage
132133
assert "processKey=process-789" in baggage
134+
assert "jobKey=job-456" in baggage
133135

134136
def test_partial_env_vars(self) -> None:
135137
env = {"UIPATH_FOLDER_KEY": "folder-only"}

0 commit comments

Comments
 (0)