Skip to content

feat: add client side tools to bridge and new cas events#1609

Open
norman-le wants to merge 2 commits into
mainfrom
feat/jar-9629-client-side-tools-cas-urt
Open

feat: add client side tools to bridge and new cas events#1609
norman-le wants to merge 2 commits into
mainfrom
feat/jar-9629-client-side-tools-cas-urt

Conversation

@norman-le
Copy link
Copy Markdown
Contributor

@norman-le norman-le commented May 1, 2026

## uipath-python

- Added ClientSide tool type to agent model so the runtime can distinguish client-side tools from server tools
- Bridge emits executingToolCall event on durable interrupt when is_execution_phase marker is set, enabling the client to know when to execute the tool
- Bridge routes endToolCall from the client back to the agent, completing the interrupt/resume cycle

## uipath-langchain-python

- Client-side tool factory creates StructuredTool instances that use @durable_interrupt to pause the graph and wait for client execution
- @mockable wraps @durable_interrupt (as a separate outer function) so evals can simulate client-side tools without hitting GraphInterrupt
- CLIENT_SIDE_TOOL_MARKER defined in hitl.py as the single source of truth for identifying client-side tools across the codebase
- Error-handling wrapper (RunnableCallableWithTool) now preserves .tool reference for client-side tools, enabling runtime discovery
- Runtime discovers client-side tools from the compiled graph via shared _iter_graph_tools() iterator, used by both confirmation and client-side tool detection
- MessageMapper emits executingToolCall only for server tools without interrupts; client-side and confirmation tools get it from the bridge instead
- MessageMapper suppresses endToolCall for client-side tool results since the client already produced the result
- MessageMapper sets isClientSideTool and outputSchema on startToolCall events so the client knows to show the input form
- 9 new tests covering tool discovery, executingToolCall emission rules, and endToolCall suppression

## uipath-agents-python

- Graph builder strips CLIENT_SIDE_TOOL_MARKER during evals so @durable_interrupt is bypassed and @mockable can intercept

## AgentInterfaces

- CAS tracks is_client_side_tool on tool calls in the database and forwards client-originated endToolCall to the agent
- CAS validates client-side tool declarations against the agent definition and guards against unauthorized endToolCall for non-client-side tools
- React SDK listens for executingToolCall events and renders a form (ClientSideToolWidget) using the tool's output schema for the user to fill in
- ClientSideToolWidget reuses the existing ToolConfirmationFormContent component
- Added type schemas for executingToolCall events and client-side tool declarations

Videos in CAS localhost (Agent Builder changes already published, but this will be the debug experience as well when the sdk is upgraded):

Without tool confirmation for client side tool:

Screen.Recording.2026-05-13.at.9.32.26.PM.mov

With tool confirmation for client side tool:

Screen.Recording.2026-05-13.at.9.27.56.PM.mov

URT Eval:
image

Related to changes in other PRs:
CAS: https://github.com/UiPath/AgentInterfaces/pull/949
uipath-langchain-python (tool definition): UiPath/uipath-langchain-python#819
uipath-python (bridge changes): #1609
uipath-agents-python (skipping for evals, so it can be mocked): https://github.com/UiPath/uipath-agents-python/pull/485
Another Agents PR fixing some issues with debug: https://github.com/UiPath/Agents/pull/5250

Copilot AI review requested due to automatic review settings May 1, 2026 21:15
@github-actions github-actions Bot added test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-runtime test:uipath-integrations labels May 1, 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

Adds support for “client-side tools” in agent resource modeling and extends the chat event protocol/bridge to handle additional tool-call lifecycle events (including an executingToolCall signal and new CAS event handling paths).

Changes:

  • Add ClientSide as a new AgentToolType and introduce AgentClientSideToolResourceConfig, including normalization support.
  • Extend core chat tool-call event models with executingToolCall and additional start-event fields (isClientSideTool, outputSchema).
  • Update the CLI Socket.IO chat bridge to parse endToolCall as a resume signal and add an emitter for executingToolCall.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
packages/uipath/src/uipath/agent/models/agent.py Adds a new agent tool type + resource config union member and normalizes incoming tool type strings for client-side tools.
packages/uipath/src/uipath/_cli/_chat/_bridge.py Adds support for new CAS tool-call event shapes and introduces an executingToolCall emitter based on resume triggers.
packages/uipath-core/src/uipath/core/chat/tool.py Extends the chat protocol models with executingToolCall and new start-event fields to represent client-side tools.
packages/uipath-core/src/uipath/core/chat/init.py Exports the newly added UiPathConversationExecutingToolCallEvent.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +406 to +423
tool_call_id = request.get("tool_call_id")
tool_name = request.get("tool_name")
tool_input = request.get("input")

if not tool_call_id or not tool_name:
logger.info(
f"emit_executing_tool_call_event: missing tool_call_id or tool_name, skipping. tool_call_id={tool_call_id}, tool_name={tool_name}"
)
return

executing_event = UiPathConversationMessageEvent(
message_id=self._current_message_id,
tool_call=UiPathConversationToolCallEvent(
tool_call_id=tool_call_id,
executing=UiPathConversationExecutingToolCallEvent(
tool_name=tool_name,
input=tool_input,
),
Comment thread packages/uipath/src/uipath/_cli/_chat/_bridge.py Outdated
Comment on lines 128 to 133
self._tool_confirmation_event = asyncio.Event()
self._tool_confirmation_value: (
UiPathConversationToolCallConfirmationEvent | None
UiPathConversationToolCallConfirmationEvent
| UiPathConversationToolCallEndEvent
| None
) = None
Comment on lines +893 to +900
class AgentClientSideToolResourceConfig(BaseAgentToolResourceConfig):
"""Resource config for client-side tools executed by the client SDK."""

type: Literal[AgentToolType.CLIENT_SIDE] = AgentToolType.CLIENT_SIDE
properties: BaseResourceProperties = Field(default_factory=BaseResourceProperties)
output_schema: Optional[Dict[str, Any]] = Field(None, alias="outputSchema")
arguments: Optional[Dict[str, Any]] = Field(default_factory=dict)

Comment thread packages/uipath/src/uipath/_cli/_chat/_bridge.py Outdated
class AgentClientSideToolResourceConfig(BaseAgentToolResourceConfig):
"""Resource config for client-side tools executed by the client SDK."""

type: Literal[AgentToolType.CLIENT_SIDE] = AgentToolType.CLIENT_SIDE
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we add an example maybe in agentinterfaces what an example client side tool would look like?

@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 test:uipath-runtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants