Skip to content

feat: add stable agentId to uipath.json for packaging and spans#1695

Open
radu-mocanu wants to merge 1 commit into
mainfrom
feat/agent-id
Open

feat: add stable agentId to uipath.json for packaging and spans#1695
radu-mocanu wants to merge 1 commit into
mainfrom
feat/agent-id

Conversation

@radu-mocanu
Copy link
Copy Markdown
Collaborator

Summary

  • uipath init mints a stable agentId into uipath.json, preserved across re-init and backfilled for existing projects
  • uipath pack sources the package projectId from uipath.json#agentId, falling back to the legacy .telemetry.json ProjectKey
  • llmops spans now carry agentId read from uipath.json (cached), falling back to the PROJECT_KEY env var
  • span path caches only the agentId string, not the whole uipath.json (immutable value, no shared-mutable-cache footgun)

Why

a coded agent needs one stable identifier that survives authoring, packaging, and runtime so traces and deployed releases correlate back to the same agent. anchoring it in uipath.json also decouples the id from telemetry being enabled.

Copilot AI review requested due to automatic review settings May 29, 2026 16:00
@github-actions github-actions Bot added test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-integrations labels May 29, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 agentId to the uipath.json schema and mint/backfill it during uipath init (preserving existing values).
  • Update uipath pack to source operate.json#projectId from uipath.json#agentId, with fallback to legacy .uipath/.telemetry.json ProjectKey.
  • Update span attribute resolution to prefer cached uipath.json#agentId, falling back to PROJECT_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.

Comment on lines +59 to 62
# prefer agentId from uipath.json; fall back to the legacy
# .telemetry.json or SW project id.
project_id = config.agent_id or resolve_existing_project_id() or str(uuid.uuid4())

operate_file = generate_operate_file(
entrypoints, config_data.runtime_options, dependencies
)
operate_file = generate_operate_file(entrypoints, config_data, dependencies)
@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:uipath-integrations test:uipath-langchain Triggers tests in the uipath-langchain-python repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants