Skip to content

feat: add client side tools to mapper and runtime#819

Open
norman-le wants to merge 1 commit intomainfrom
feat/jar-9629-client-side-tools-cas-urt
Open

feat: add client side tools to mapper and runtime#819
norman-le wants to merge 1 commit intomainfrom
feat/jar-9629-client-side-tools-cas-urt

Conversation

@norman-le
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings May 1, 2026 21:16
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 first-class support for “client-side tools” (tools executed by the client SDK) so the runtime can advertise them in tool-call start events and adjust tool-call lifecycle events accordingly.

Changes:

  • Introduces a new client_side_tool factory that suspends execution via @durable_interrupt and resumes with client-provided results.
  • Extends tool creation to support AgentClientSideToolResourceConfig.
  • Enhances runtime + message mapping to (a) discover client-side tools/output schemas from the compiled graph, (b) include client-side metadata in tool-call start events, (c) emit executingToolCall for server-side tools without confirmation, and (d) suppress endToolCall events for client-side tools.

Reviewed changes

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

Show a summary per file
File Description
src/uipath_langchain/runtime/runtime.py Discovers client-side tools from compiled graph nodes and passes them into the message mapper.
src/uipath_langchain/runtime/messages.py Adds client-side tool metadata to tool-call start events, emits executingToolCall for non-confirmation server tools, suppresses endToolCall for client-side tools.
src/uipath_langchain/chat/hitl.py Marks confirmation interrupts as “execution phase” triggers for server-side tools (not client-side).
src/uipath_langchain/agent/tools/tool_factory.py Wires new client-side tool resource config into tool creation.
src/uipath_langchain/agent/tools/client_side_tool.py Implements the client-side tool behavior using @durable_interrupt + ToolMessage result annotation.

Comment on lines 71 to 73
self.chat.tools_requiring_confirmation = self._get_tool_confirmation_info()
self.chat.client_side_tools = self._get_client_side_tools()
self._middleware_node_names: set[str] = self._detect_middleware_nodes()
Comment on lines +458 to +462
# Emit executingToolCall from MessageMapper since there's no durable interrupt
# to trigger it from the runtime loop.
if not require_confirmation and not is_client_side:
events.append(
UiPathConversationMessageEvent(
Comment on lines +505 to +510
# Suppress endToolCall for client-side tools — the client already has the result (it produced it).
is_client_side = message.response_metadata.get("uipath_client_tool", False)
events: list[UiPathConversationMessageEvent] = []

if not is_client_side:
events.append(
Comment on lines +129 to +132
# If this is a server-side tool (not client-side), execution follows immediately
# after confirmation — mark this as the execution trigger so the bridge emits
# executingToolCall. For client-side tools, the execution interrupt sets this instead.
is_execution_trigger = not (tool.metadata or {}).get("uipath_client_tool", False)

from .utils import sanitize_tool_name

logger = getLogger(__name__)

content = str(output) if output is not None else ""
if isinstance(output, dict):
content = json.dumps(output)
Comment on lines +125 to +127
elif isinstance(resource, AgentClientSideToolResourceConfig):
return create_client_side_tool(resource)

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