Skip to content

feat(advanced): keep coded agents' workspace files across suspend and resume [PC-5359] - #1194

Open
tudormatei1 wants to merge 3 commits into
mainfrom
feat/PC-5359-coded-workspace-persistence
Open

tudormatei1 wants to merge 3 commits into
mainfrom
feat/PC-5359-coded-workspace-persistence

Conversation

@tudormatei1

@tudormatei1 tudormatei1 commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Coded LangGraph and deepagents agents now keep the files they write across suspend and resume. The factory opts in to the CLI-managed workspace from UiPath/uipath-python#1976, and UiPathWorkspaceBackend gives deepagents a file backend rooted in that workspace.

Changes

  • UiPathWorkspaceBackend (agent/advanced/workspace_backend.py) is a deepagents FilesystemBackend that looks up its root with get_workspace_path() on every file operation. Coded graphs are built once at import, before any run, so a root fixed when the graph is built would never be the run's folder. Outside a managed run (local runs, uipath dev, older CLIs) it uses one temp folder and logs a warning naming it. It never falls back to the project folder, so an agent can't edit the project's files.
  • get_settings() returns managed_workspace=True. Older CLIs ignore the flag.
  • Docs: a "Keeping files across suspend and resume" section in docs/human_in_the_loop.md, for the backend and for plain tools that call get_workspace_path().
  • Sample: samples/deepagent-workspace-files, a deepagents agent that writes /report.md, suspends on interrupt() for a review, and edits the same file after resume. Its review tool reads the draft from disk with plain Python, which is the case for real files over DeepAgents' default StateBackend.
  • Version 0.21.10, with uipath>=2.15.16: older CLIs ignore the flag, and the backend would then fall back to a temp folder in jobs. uv.lock is still main's until uipath 2.15.16 is on PyPI; relock before merge.

Note

This works with the released uipath-runtime. The docs describe CLI behavior from UiPath/uipath-python#1976, so release that first or together. uipath-agents overrides get_settings with the flag off, so low-code agents aren't wrapped twice.

Testing

  • New tests: the backend reads, writes, lists, globs and greps inside the managed folder; a file written in one run is back after resume; traversal outside the folder is blocked; the fallback folder is created once. The factory test checks the flag.
  • Full suite in this repo's own venv: 4247 passed.
  • Live on alpha with the four PR branches installed together: a coded LangGraph job writes through UiPathWorkspaceBackend, suspends on interrupt(), and uipath run --resume in a new process reads the file back from job attachments.
  • The sample, live on alpha with an existing job key: run 1 wrote /report.md and suspended in request_review. uipath run --resume in a new process ran edit_file on the restored file, and the final report included the feedback. Without a job key, the resume finds no draft, as its README says.
  • Not run: a real serverless job.

🤖 Generated with Claude Code

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The sample’s uipath>=2.15.1 requirement conflicts with the release’s uipath<2.15.0 constraint, preventing the documented uv sync from installing it.

1 open issue
What changed in this PR

Adds managed workspace support so coded LangGraph and DeepAgents agents can retain files across job suspension and resumption.

Changes:

  • Enables CLI-managed workspaces and exports a workspace-aware file backend.
  • Adds workspace isolation, fallback, and persistence tests.
  • Documents usage, adds a review-and-resume sample, and bumps the version to 0.18.57.
File Description
uv.lock Updates package version.
tests/​runtime/​test_factory_managed_workspace.py Tests workspace opt-in.
tests/​agent/​advanced/​test_workspace_backend.py Tests workspace operations and persistence.
src/​uipath_langchain/​runtime/​factory.py Requests managed workspaces.
src/​uipath_langchain/​agent/​advanced/​workspace_backend.py Adds dynamically rooted file backend.
src/​uipath_langchain/​agent/​advanced/​__init__.py Exports the backend.
samples/​README.md Lists the new sample.
samples/​deepagent-workspace-files/​uipath.json Configures sample runtime.
samples/​deepagent-workspace-files/​README.md Explains sample setup and persistence.
samples/​deepagent-workspace-files/​pyproject.toml Defines sample dependencies.
samples/​deepagent-workspace-files/​langgraph.json Registers the sample graph.
samples/​deepagent-workspace-files/​graph.py Demonstrates file editing across human review.
samples/​deepagent-workspace-files/​agent.mermaid Shows sample graph flow.
samples/​deepagent-workspace-files/​.env.example Provides connection placeholders.
pyproject.toml Bumps release version.
docs/​human_in_the_loop.md Documents managed workspace usage.

Review effort: Balanced

dependencies = [
"deepagents>=0.7.11, <0.8.0",
"langgraph>=1.0.10",
"uipath>=2.15.1",
tudormatei1 and others added 3 commits December 3, 2026 13:10
… resume

Files a coded LangGraph or deepagents agent writes are lost when its
job suspends and resumes on another machine. The factory now opts in
to the host-managed workspace, so the uipath CLI persists the run's
workspace folder as job attachments.

UiPathWorkspaceBackend is a deepagents FilesystemBackend that looks up
the current run's folder on every file operation. Coded graphs are
built once at import time, before any run, so a root fixed at build
time would point at the wrong folder. Outside a managed run it uses
one temporary folder and logs a warning, and never the project folder.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Shows UiPathWorkspaceBackend in a job: the agent writes a report,
suspends for a human review, and edits the same file after it
resumes. Its review tool opens the draft from disk with plain Python,
which is the reason to keep files on disk instead of in DeepAgents'
default StateBackend.

The tool tolerates a missing draft, because LangGraph re-runs an
interrupted tool from the top on resume, and a local run without a
job starts the resume in a new, empty folder.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The factory now asks for a managed workspace, and only the uipath CLI
from 2.15.16 acts on that. With an older CLI the backend falls back to
a temporary folder and job files are lost on resume.

The lock is regenerated once uipath 2.15.16 is on PyPI.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@tudormatei1
tudormatei1 force-pushed the feat/PC-5359-coded-workspace-persistence branch from 4f3e1ae to b31df88 Compare December 3, 2026 11:15
@sonarqubecloud

sonarqubecloud Bot commented Dec 3, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 90%)

See analysis details on SonarQube Cloud

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants