feat: add stable id to uipath.json for packaging and spans#1695
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a stable agentId stored in uipath.json and wires it through project initialization, packaging (operate.json projectId), and LLMOps span attributes to enable consistent correlation across authoring, packaging, and runtime.
Changes:
- Add
agentIdto theuipath.jsonschema and mint/backfill it duringuipath init(preserving existing values). - Update
uipath packto sourceoperate.json#projectIdfromuipath.json#agentId, with fallback to legacy.uipath/.telemetry.jsonProjectKey. - Update span attribute resolution to prefer cached
uipath.json#agentId, falling back toPROJECT_KEY, and add/adjust tests accordingly.
Reviewed changes
Copilot reviewed 10 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/uipath/src/uipath/_cli/models/uipath_json_schema.py | Adds agentId field to the typed uipath.json configuration model. |
| packages/uipath/src/uipath/_cli/cli_init.py | Mints/backfills agentId into uipath.json during uipath init. |
| packages/uipath/src/uipath/_cli/_utils/_project_files.py | Introduces resolve_existing_project_id() to reuse Studio Web/env or legacy telemetry ProjectKey. |
| packages/uipath/src/uipath/_cli/cli_pack.py | Switches packaging to use agentId as projectId and removes old inline telemetry lookup. |
| packages/uipath/tests/cli/test_init.py | Adds coverage for minting/backfilling/preserving agentId across init scenarios. |
| packages/uipath/tests/cli/test_pack.py | Adds coverage for projectId sourcing from agentId and legacy telemetry fallback. |
| packages/uipath-platform/src/uipath/platform/common/_span_utils.py | Adds cached read of agentId from uipath.json and uses it for span agentId. |
| packages/uipath-platform/tests/services/test_span_utils.py | Adds tests for agentId resolution priority and caching behavior; clears cache between tests. |
| packages/uipath/pyproject.toml | Bumps uipath version. |
| packages/uipath/uv.lock | Updates lockfile metadata / versions. |
| packages/uipath-platform/pyproject.toml | Bumps uipath-platform version. |
| packages/uipath-platform/uv.lock | Updates lockfile metadata / versions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3f97eac to
c5bb52b
Compare
RobinMennens-UiPath
left a comment
There was a problem hiding this comment.
Took a pass focused on the agentId behavior across the coded agent types, regressions, and the spans. Two things I'd like to align on before this goes in:
For plain functions and declarative agents this is end-to-end correct. But langgraph/llamaindex agents build their own operate.json in the plugin repos and won't source projectId from uipath.json#agentId until we mirror this there. Is there a follow-up tracking that, or is the expectation that those plugins start reading uipath.json#agentId?
Separately, on alignment with the vertical-solutions-check-agent-id.yml check: that check looks for a coded agent's ID only in .uipath/.telemetry.json#ProjectKey or .uipath/local-project-id.json#projectId — not in uipath.json#agentId. With telemetry disabled, create_telemetry_config_file doesn't write .telemetry.json, and we don't write local-project-id.json either, so an agent inited by this PR would have its ID only in uipath.json and the CI check would report it as missing. Are we updating that check to read uipath.json#agentId too, or should init also write one of the files it expects? These two need to agree.
This is not true. |
This is not a concern for the coded agents SDK. the changes are backwards compatible, meaning that existing IDs will still be honored. newly created agents will indeed drop |
c5bb52b to
47096b4
Compare
alexandra-c
left a comment
There was a problem hiding this comment.
Could we extend this to cover function project types as well? agentId isn't the right name for a coded function, could we detect the project type and use functionId accordingly, or pick a generic name that works for both?
If you ask me, everything that can run on the UiPath platform should have a unique GUID identifier that never changes. RPA, coded functions, coded agents, low code agents, etc. |
Agreed. the problem is that we already have a ProjectKey (similar to project id, that is the release key from orchestrator). to be consistent with the agentId naming (which is already the established field for low code agents today) I would use functionId for functions. I will also consult with the team regarding this since it would be a spec decision |
IMO every product should define its own GUID (I imagine you'll need this exposed downstream at some point). For Agents we are exposing a concrete AgentIId which must be separate from ProjectId (because of flow) so the generic approach might not work well unless you also include a discriminator, but at that point having separate IDs is probably similar overhead @jepadil23 FYI this is similar to what we are solving for Trace service ID hierarchy |
jepadil23
left a comment
There was a problem hiding this comment.
idea LGTM, only resolve if possible build issues
ffd3ad1 to
f357f13
Compare
f357f13 to
7e0db2a
Compare
d84609f to
ec87297
Compare
ec87297 to
793e5af
Compare
|
Settled on |
30469bd to
0edb08d
Compare
6d4a5dc to
c21b7d5
Compare
0a663e9 to
7d0b509
Compare
🚨 Heads up:
|
1daff88 to
7d80dec
Compare
7d80dec to
5419d77
Compare
|
🚨 Heads up:
|



Summary
uipath initmints a stableid(GUID) intouipath.json, preserved across re-init and backfilled for existing projectsuipath packsources the packageprojectIdfromuipath.json#id, validating it is a GUID (and failing otherwise), falling back to the legacy.telemetry.jsonProjectKey/ SW project iduipath.json#idfirst, then the legacy env vars (UIPATH_AGENT_ID/UIPATH_PROJECT_ID/PROJECT_KEY) for already-deployed agents; a non-GUIDidis ignored so it can never reject span ingestionuipath initno longer writes.uipath/.telemetry.json; an existing one is still honored for the id and telemetry attributionidfield is documented inuipath.schema.json/uipath.spec.mdlangchain-crosstests to run against 'uncompatible' libraries from PR (similar to ci: force local wheels via uv override in cross-tests #1723)Why
a coded agent or function needs one stable identifier that survives authoring, packaging, and runtime so traces and deployed releases correlate back to the same project. anchoring it in
uipath.jsondecouples the id from telemetry being enabled, and routing spans, baggage and telemetry through a single resolver keeps them from diverging.Development Packages
uipath
uipath-platform