Repository navigation
feat(cli): keep coded agents' workspace files across suspend and resume [PC-5359] - #1976
tudormatei1 wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The unconditional import requires runtime 0.13.7, but pyproject.toml still permits 0.13.5 and uv.lock selects it, so locked installations cannot import the run/debug/eval commands even when managed workspaces are disabled. Raise the runtime minimum to 0.13.7 and regenerate the lockfile.
2 open issues
What changed in this PR
Adds opt-in workspace persistence to the UiPath SDK so coded-agent jobs can retain files across suspension and resumption.
Changes:
- Integrates managed workspaces into run, debug, and evaluation execution.
- Adds upload, opt-in, conversation, and evaluation-isolation tests.
- Bumps the package version to 2.15.1.
| File | Description |
|---|---|
packages/uipath/uv.lock |
Updates the SDK version. |
packages/uipath/tests/cli/utils/workspace_fakes.py |
Adds workspace test doubles. |
packages/uipath/tests/cli/test_managed_workspace.py |
Tests uploads, folder routing, and opt-in conditions. |
packages/uipath/tests/cli/test_managed_workspace_commands.py |
Tests run/debug workspace integration. |
packages/uipath/tests/cli/eval/test_eval_runtime_managed_workspace.py |
Tests per-item persistence and agent metadata. |
packages/uipath/tests/cli/conftest.py |
Adds a shared fake SDK fixture. |
packages/uipath/src/uipath/eval/runtime/runtime.py |
Wraps evaluation runtimes and caches factory settings. |
packages/uipath/src/uipath/_utils/_managed_workspace.py |
Adds conditional workspace wrapping and persistence policies. |
packages/uipath/src/uipath/_cli/cli_run.py |
Integrates workspace management into run. |
packages/uipath/src/uipath/_cli/cli_debug.py |
Integrates workspace management into debug. |
packages/uipath/pyproject.toml |
Bumps the SDK version to 2.15.1. |
Review effort: Balanced
| from uipath.platform.common import UiPathConfig | ||
| from uipath.runtime import ( | ||
| HydrationPolicy, | ||
| ManagedWorkspace, |
There was a problem hiding this comment.
Right that the import needs a runtime with ManagedWorkspace while the lock picked 0.13.5. 0.13.7 wouldn't fix it, though: it was released from main without ManagedWorkspace. The branch now requires uipath-runtime>=0.13.8 (56e9b80). The lock gets regenerated once 0.13.8 (UiPath/uipath-runtime-python#175) is on PyPI, as the description says.
| await _run( | ||
| FileRuntime(write="draft", status=UiPathRuntimeStatus.SUSPENDED), storage | ||
| ) | ||
| await _run(FileRuntime(), storage) |
There was a problem hiding this comment.
Right. With restore turned off, every uipath test still passed. The test now asserts that the resumed run reads the saved file (7ae4f93), and it's the only one that fails with restore off.
Coded agents lose the files they write when a job suspends, because nothing wraps them in HydrationRuntime. A factory can now opt in with UiPathRuntimeFactorySettings.managed_workspace, and run, debug and each eval item then get a workspace folder that is uploaded as job attachments on suspend and restored on resume. Only job runs are wrapped: only jobs resume in a new process, and outside a job there are no credentials to build the attachments client. A conversational run also uploads after a successful exchange, because the next exchange resumes the same job. Hydration sits outside governance, whose dispose does not reach the inner runtime, so the temporary folder is still removed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The resume round trip, the conversation policy and folder removal are already checked by the run/debug command tests or by uipath-runtime's ManagedWorkspace tests. The settings-read count only pinned an optimization. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ManagedWorkspace first ships in uipath-runtime 0.13.8; 0.13.7 was released without it, so run, debug and eval would fail at import. The lock is regenerated once 0.13.8 is on PyPI. Co-Authored-By: Claude Opus 5.5 <[email protected]>
db98042 to
56e9b80
Compare
The folder-key test discarded the resumed run's output, so it passed even when nothing was restored: the first run's upload and link calls already filled both folder-key lists. With restore turned off, every uipath test still passed. It now asserts the resumed run reads the file, which also makes sure the download used the job folder. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🚨 Heads up:
|




Coded agents now keep the files they write to disk when their job suspends and resumes. A runtime factory opts in with
UiPathRuntimeFactorySettings.managed_workspace.uipath run,uipath debugand each eval item then run in a workspace folder that is uploaded as job attachments on suspend and restored on resume. uipath-langchain opts in with UiPath/uipath-langchain-python#1194.Warning
Needs uipath-runtime 0.13.8 (UiPath/uipath-runtime-python#175). The pin already says
uipath-runtime>=0.13.8, <0.14.0, butuv.lockis still main's, because 0.13.8 isn't on PyPI yet. CI fails until it's released. Before merge, relock.Changes
wrap_with_managed_workspace(_utils/_managed_workspace.py) wraps only when the factory opts in, the run is a job (UIPATH_JOB_KEY), and the factory has storage. Outside a job there may be no credentials for the attachments client, and the CLI already gates other job-only behavior on the job key. Local--resumeruns therefore don't get their files back.cli_run.py,cli_debug.pyandeval/runtime/runtime.pymake one call each: outside governance, inside the chat and debug wrappers. Governance'sdisposedoesn't reach the runtime it wraps, so wrapping inside it would leave the temp folder behind.__aenter__instead of once per item.uipath-runtime>=0.13.8, in a separatechore(uipath)commit.Testing
runanddebugcommands and the eval runtime, with fakes only for the attachments and jobs APIs and the storage. They cover: files come back after resume, uploads link to the job, the folder key reaches every attachments call, nothing is wrapped outside a job or without the opt-in, conversational exchanges keep files, and each eval item gets its own workspace.uipath run --resumein a new process reads it back from job attachments. WithoutUIPATH_JOB_KEY, nothing comes back.ManagedWorkspaceuntil runtime 0.13.8 ships. The tests ran in a venv with the local runtime.🤖 Generated with Claude Code