chore(deps): migrate to deepagents 0.7.11 - #1054
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Updates this SDK to work with deepagents==0.7.11 (and the newer LangChain/LangGraph floors it requires), while preserving advanced-agent behavior and making “run-suspending” tools discoverable via tool metadata.
Changes:
- Bump dependency floors (deepagents/langchain/langchain-core/langgraph) and update lockfile.
- Keep
write_todosavailable by explicitly prependingTodoListMiddlewareand allow caller-supplied middleware on advanced graph builders. - Introduce
SUSPENDS_RUNmetadata + a source-scanning test to ensure suspending tool factories stamp the flag; apply the stamp across relevant tools.
File summaries
| File | Description |
|---|---|
| uv.lock | Locks updated dependency graph for deepagents 0.7.11 + new LangChain/LangGraph floors. |
| pyproject.toml | Updates package version and runtime dependency minimums. |
| tests/agent/tools/test_suspends_run_metadata.py | New test enforcing SUSPENDS_RUN metadata stamping for suspending tools. |
| tests/agent/advanced/test_create_advanced_agent_graph.py | Makes middleware assertions robust to prepended/appended middleware. |
| tests/agent/advanced/test_conversational_advanced_agent_graph.py | Same as above for conversational wrapper graph tests. |
| src/uipath_langchain/agent/tools/process_tool.py | Stamps SUSPENDS_RUN: True in metadata for suspending tool. |
| src/uipath_langchain/agent/tools/ixp_escalation_tool.py | Stamps SUSPENDS_RUN: True in metadata for suspending tool. |
| src/uipath_langchain/agent/tools/internal_tools/deeprag_tool.py | Stamps SUSPENDS_RUN: True in metadata for suspending tool. |
| src/uipath_langchain/agent/tools/internal_tools/batch_transform_tool.py | Stamps SUSPENDS_RUN: True in metadata for suspending tool. |
| src/uipath_langchain/agent/tools/extraction_tool.py | Stamps SUSPENDS_RUN: True in metadata for suspending tool. |
| src/uipath_langchain/agent/tools/escalation_tool.py | Stamps SUSPENDS_RUN: True in metadata for suspending tool. |
| src/uipath_langchain/agent/tools/context_tool.py | Stamps SUSPENDS_RUN: True in metadata for suspending tools/variants. |
| src/uipath_langchain/agent/tools/client_side_tool.py | Stamps SUSPENDS_RUN: True in metadata for suspending tool. |
| src/uipath_langchain/agent/advanced/utils.py | Drops BackendFactory typing from backend parameter to match deepagents changes. |
| src/uipath_langchain/agent/advanced/agent.py | Prepends TodoListMiddleware; accepts/threads caller middleware in advanced graph builders; narrows backend typing. |
| src/uipath_langchain/agent/advanced/init.py | Removes BackendFactory from exports to match deepagents changes. |
| src/uipath_langchain/_utils/durable_interrupt/decorator.py | Adds SUSPENDS_RUN constant + suspends_run() helper. |
| src/uipath_langchain/_utils/durable_interrupt/init.py | Re-exports SUSPENDS_RUN and suspends_run. |
| samples/simple-deepagent/pyproject.toml | Updates sample dependency constraint to deepagents 0.7.11. |
| samples/deepagent-storage-buckets/pyproject.toml | Updates sample dependency constraint to deepagents 0.7.11. |
| samples/deepagent-storage-buckets/src/deepagent_storage_buckets/buckets_backend.py | Updates backend protocol surface/types and read/grep/glob return shapes for deepagents 0.7.x. |
Review details
- Files reviewed: 20/21 changed files
- Comments generated: 4
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
731f71c to
514e3ad
Compare
f2716bf to
df0b0f3
Compare
| # context and returns a single text report, so an attachment it uploads is real but | ||
| # its reference never reaches the main agent -- the only agent that fills the typed | ||
| # output. Observed result: two orphan attachments and a faulted job. | ||
| MAIN_AGENT_ONLY_TOOLS: frozenset[str] = frozenset({OUTPUT_FILE_TOOL_NAME}) |
There was a problem hiding this comment.
note: this implementation will change. subagents will have access to the generate_attachment tool (since they can pass a file as input to other tools). will be done in a subsequent PR
1928eca to
9e1c62b
Compare
…eter BREAKING CHANGE: `BackendFactory` is gone from `uipath_langchain.agent.advanced` and the `backend` parameters no longer accept a factory. deepagents 0.7.0 deleted the type, so there is nothing to alias it to. Pass a `BackendProtocol` instance. Advanced agents also no longer expose `write_todos`. deepagents 0.5.9 was two minor versions behind and 0.7.x is the floor `langchain-quickjs` requires, so the code interpreter was unreachable before this. Code interpreter, behind the optional `code-interpreter` extra: `build_code_interpreter_middleware(tools)` gives the agent one `eval` tool, a JavaScript REPL in a WASM guest, with eligible tools callable from inside it. The dependency is an extra because wasmtime and the guest are ~27 MB on disk, and the import is deferred into the factory so the package still imports without it. The PTC allowlist is derived, never hand-written. It drops tools that suspend the run, since a replayed node re-runs every bridged call made before the interrupt and such bridges do not reach approval hooks; names that cannot be JavaScript identifiers, which upstream rejects mid-turn; and camelCase collisions, which upstream does not dedupe. `SUSPENDS_RUN` marks the first class at the point where the suspension happens, so a new suspending factory cannot silently become reachable from the sandbox. `mode` is a parameter. `"thread"` snapshots the REPL into the checkpoint, a fixed ~1.25 MB per thread written even when the agent never calls `eval`, which only pays off where a later run reads it back. write_todos is dropped rather than restored: deepagents removed `TodoListMiddleware` from its defaults after benchmarking three models and finding no significant accuracy gain and higher token use on two (langchain-ai/deepagents#4929). Subagents no longer inherit the main agent's full tool list, so a tool that only the main agent may hold stays there. deepagents hands a subagent the parent list unless its spec declares its own, so each spec now pins `tools`. Also: `write_file` now replaces an existing file rather than erroring, a recursive `delete` appears whenever the backend supports it and is deliberately not withheld, and 0.7.0 empties `BASE_AGENT_PROMPT`, so agents run on the lean prompt.
9e1c62b to
bf0085f
Compare
|



Summary
code-interpreterextrawrite_todostool, following the benchmark deepagents 0.7.0 based its own removal onCode interpreter
build_code_interpreter_middleware(tools)returns middleware giving the agent oneevaltool: a persistent JavaScript REPL in a WASM guest, with eligible tools callable from inside it astools.<camelCaseName>(...). Pass it viamiddleware=on either advanced graph builder.It is opt-in twice over. The dependency is an extra (
uipath-langchain[code-interpreter]), because wasmtime and the QuickJS guest are ~27 MB on disk and no consumer should carry that unless it asks. The middleware import is deferred into the factory, so importing the package without the extra keeps working and only the factory raises, with install guidance.The allowlist governing what the sandbox can reach is derived, never hand-written. Three exclusions: tools that suspend the run (a replayed node re-runs every bridged call made before the interrupt, and PTC bypasses approval hooks), names that cannot be JavaScript identifiers (upstream raises mid-turn for those), and camelCase collisions (upstream dedupes by tool name, so binding either would call the wrong tool).
modeis a parameter rather than a constant."thread"snapshots the REPL into the checkpoint, so state survives a suspend and resume, at a fixed ~1.25 MB per checkpoint thread written even when the agent never callseval. That only pays off where a later run reads it back, so a caller whose runs each get their own thread should pass"turn", which writes nothing. Upstream renders the tool description from the mode, so the model is told the correct semantics either way.write_todosremoveddeepagents 0.7.0 dropped
TodoListMiddlewarefrom its defaults after benchmarking across three models: no statistically significant accuracy gain on any of them, and higher token use on two (langchain-ai/deepagents#4929). This follows that rather than restoring it, and pins the absence with a test so a future change has to be deliberate.Kept as its own commit, so it can be reverted without touching the version bump.
Breaking
BackendFactoryis gone fromuipath_langchain.agent.advanced, and thebackendparameters no longer accept a factory. deepagents 0.7.0 deleted the type, so there is nothing left to alias it to and a factory would be rejected downstream regardless. Pass aBackendProtocolinstance instead.Advanced agents no longer expose
write_todos. A caller that wants it can passmiddleware=[TodoListMiddleware()]; the middleware injects its own usage prompt, so no caller prompt needs to describe the tool.Two behaviour changes come from deepagents itself and are worth knowing before upgrading:
write_filenow replaces an existing file rather than erroring, and a recursivedeletetool appears whenever the backend supports it.deleteis deliberately not withheld: an agent can already replace a file withwrite_file, and letting it clean up scratch files reduces orphan job attachments.Why
deepagents 0.5.9 is two minor versions behind, and 0.7.x is the floor
langchain-quickjsrequires, so the code interpreter was not reachable before this.the base prompt goes with it: 0.7.0 empties
BASE_AGENT_PROMPT, which is where its input-token reduction comes from, so this adopts the lean prompt rather than passing the deprecated constant back in.