feat: add client side tools to mapper and runtime#819
Open
Conversation
There was a problem hiding this comment.
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_toolfactory that suspends execution via@durable_interruptand 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
executingToolCallfor server-side tools without confirmation, and (d) suppressendToolCallevents 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) | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.