Skip to content

feat(agent): run eligible RPA process tools on the user's local robot (JAR-9786) - #1256

Open
norman-le wants to merge 10 commits into
mainfrom
feat/conversational-agents-local-robot-execution
Open

norman-le wants to merge 10 commits into
mainfrom
feat/conversational-agents-local-robot-execution

Conversation

@norman-le

@norman-le norman-le commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

URT-side support for attended RPA via client-side tools. Pairs with CAS: UiPath/AgentInterfaces#1362. JAR-9786 · Design doc

Changes:

  • local_robot.py: core module — parses job inputs, per-call routing decision, reads client reply/fallback, marks results to prevent duplicate endToolCall
  • process_tool.py: two durable_interrupts for local-then-server-fallback; local_robot_capable requires is_conversational, PROCESS type, and not entry_point_path
  • messages.py: marks eligible tools as isClientSideTool with localExecution metadata on startToolCall; suppresses executingToolCall for local robot tools (deferred to runtime). peek_message_id_for_tool_call added for non-consuming lookup so the tool-call/message mapping survives for final completion.
  • runtime.py: emits executingToolCall after guardrails pass (when graph suspends at wait_for_local_robot); filters CAS list to graph-capable tools; skips local routing when storage is None; resets exchange_local_robot_processes contextvar in execute()/stream() finally blocks
  • tool_node.py: _resolve_tool_from_subgraph recovers LOCAL_ROBOT_CAPABLE metadata from compiled guardrail subgraphs so guarded process tools remain eligible for local execution
  • client_side_tool.py: fixes is_error/isError dual-key handling

Key decisions:

  • executingToolCall deferred to after guardrails (same pattern as confirmation) — client doesn't get the execution signal until the tool is approved
  • isClientSideTool + localExecution metadata set on startToolCall so client can prepare handlers
  • CAS list filtered to LOCAL_ROBOT_CAPABLE tools in this graph (prevents stale entries)
  • No local routing when storage unavailable (prevents interrupt replay mismatch)

Not in this PR: CAS eligibility, widget Robot.js handler

Known limitation: post-execution guardrails on locally-executed tool results — the client already has the original output. Shared with all client-side tools; needs a protocol-level result update event to fix.

🤖 Generated with Claude Code

… (JAR-9786)

When CAS passes local robot job inputs, the process tool sends the call to the
client (same pause as client-side tools) instead of starting a server job. The
client runs the process with Robot.js and replies with output or a fallback, in
which case the tool starts the server job as usual.

- local_robot.py: core module — parses job inputs, decides per-call routing,
  reads client reply/fallback, marks results so the runtime skips a duplicate
  endToolCall
- process_tool.py: integrates with local_robot_request/read_local_robot_reply;
  two durable_interrupts for the local-then-fallback path
- messages.py: marks eligible tools as isClientSideTool per call, attaches
  localExecution metadata on startToolCall, persists/restores local robot
  processes across job resumes via storage
- runtime.py: reads job inputs at start, restores from storage on resume
- client_side_tool.py: fixes is_error/isError dual-key handling

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 30, 2026 15:58

This comment was marked as outdated.

Intersect the CAS-provided local robot process list with the tools that
carry LOCAL_ROBOT_CAPABLE metadata in this graph. Prevents stale or
mismatched entries from being marked as isClientSideTool by the mapper.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 30, 2026 20:15

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

Local process execution is dispatched before per-tool interrupts and argument validation, allowing calls to run out of graph order with inputs the tool wrapper may reject or transform.

4 open issues
2 previously missed issues

In code that hasn't changed since last review

Medium severity Keep tools with configured entry points on the server

src/​uipath_langchain/​agent/​tools/​process_tool.py:84

Tools with an explicit entry_point_path are still marked local-capable, but the local execution payload contains no entry point. The client can therefore run the release's default workflow instead of the configured one. Keep those tools server-side until the local execution contract carries and honors the configured entry point.

Medium severity Preserve local routing decisions when storage is unavailable

src/​uipath_langchain/​runtime/​runtime.py:426

When a runtime created without storage is reconstructed against a suspended checkpoint, its local eligibility list is lost. Replay then skips the local wait and consumes the client reply at the server-job interrupt, causing job.state to fail instead of completing or falling back. Keep these calls on the server when storage is unavailable, or persist their routing decision in checkpointed state.

1 resolved since last review

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings December 1, 2026 18:02
@norman-le
norman-le marked this pull request as ready for review December 1, 2026 18:03

This comment was marked as outdated.

…xtvar reset

- Add peek_message_id_for_tool_call (non-consuming) so _emit_local_robot_executing_events
  doesn't delete the tool-call/message mapping before the tool completes
- Recover LOCAL_ROBOT_CAPABLE metadata from compiled guardrail subgraphs via
  _resolve_tool_from_subgraph, so guarded process tools are still eligible for local execution
- Reset exchange_local_robot_processes contextvar in execute()/stream() finally blocks
  to prevent stale routing lists leaking between exchanges
- Add 12 tests covering all three fixes

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Copilot AI balanced review requested due to automatic review settings December 2, 2026 04:31

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

Local-result routing suppresses guardrail-modified and human-reviewed outputs, while streaming execution signals and fallback behavior across resumes remain unverified.

2 open issues
5 resolved since last review

Review effort: Balanced

Comment thread src/uipath_langchain/runtime/runtime.py Resolved
Copilot AI balanced review requested due to automatic review settings December 2, 2026 15:42

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.

🔵 Needs a closer look

Human assessment is needed because partial resumes can re-signal pending parallel tool calls, potentially executing side-effecting processes twice.

1 open issue
1 resolved since last review

Review effort: Balanced

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

Partial resumes can emit duplicate tool-execution signals and launch the same RPA process twice, while checkpoint-backed coverage of the fallback interrupt sequence is missing.

2 open issues
1 resolved since last review

Review effort: Balanced

Comment thread src/uipath_langchain/runtime/runtime.py Resolved
Copilot AI balanced review requested due to automatic review settings December 3, 2026 20:26

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.

🔵 Needs a closer look

Human assessment is needed because local-routing interactions with non-streaming execution and guardrail-wrapped tools can leave execution suspended or unexpectedly route jobs to the server.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings December 3, 2026 20:33

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.

🔵 Needs a closer look

Human assessment is needed because local routing can stall non-streaming execution without notifying the client, while guarded process tools can lose capability metadata and incorrectly fall back to server execution.

No open issues 🎉

Review effort: Balanced

@sonarqubecloud

sonarqubecloud Bot commented Dec 3, 2026

Copy link
Copy Markdown

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