Repository navigation
feat(mcp): ask the server to watch a Remote server's task [PRODEV-2009] - #2032
Open
alessandromuresan wants to merge 1 commit into
Open
alessandromuresan wants to merge 1 commit into
alessandromuresan wants to merge 1 commit into
Conversation
A task a Remote MCP server runs has no Orchestrator job behind it, so McpTask.job is empty and a caller could not suspend on it. AgentHub can watch such a task and wake the caller's job through an API trigger; the caller asks for that on a tasks/get. - McpService.watch_task / watch_task_async: one tasks/get that names the caller's job for the server to wake. - McpTask.api_trigger and McpTask.watch read the server's annotation. - call_tool(resume_trigger_types=...) declares the trigger kinds the caller can suspend on; the default is unchanged. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
Human integration review is needed because AgentHubService#2544 was inaccessible, and mocked validation does not establish live watch-contract compatibility, safe retry behavior, or API-trigger wake-up compatibility.
No open issues 🎉
What changed in this PR
Adds SDK support for asking AgentHub to watch Remote MCP tasks, enabling callers to suspend and resume through API triggers without an underlying Orchestrator job. Existing polling and default trigger declarations remain unchanged.
Changes:
- Adds synchronous and asynchronous
watch_taskmethods and configurable resume-trigger declarations. - Exposes API-trigger and watch metadata with validation and regression tests.
- Bumps
uipath-platformto0.3.22and updates both lockfiles.
| File | Description |
|---|---|
| packages/uipath/uv.lock | Updates the linked platform package version. |
| packages/uipath-platform/uv.lock | Records platform version 0.3.22. |
| packages/uipath-platform/tests/services/test_mcp_tasks.py | Tests metadata validation, watch requests, and unchanged polling defaults. |
| packages/uipath-platform/src/uipath/platform/orchestrator/mcp_tasks.py | Adds API-trigger and watch models and task properties. |
| packages/uipath-platform/src/uipath/platform/orchestrator/_mcp_service.py | Adds watch methods and configurable request metadata. |
| packages/uipath-platform/src/uipath/platform/orchestrator/__init__.py | Exports the new task metadata models. |
| packages/uipath-platform/pyproject.toml | Bumps the platform package version to 0.3.22. |
Review effort: Balanced
|
This branch has not been deployed
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.



The SDK part of suspending on a Remote MCP server's task, for coded agents. Server side: UiPath/AgentHubService#2544. Low-code agents: UiPath/uipath-langchain-python#1253. Jira: PRODEV-2009.
Why
A Remote MCP server's upstream can answer a tool call with a task of its own. No Orchestrator job is behind it, so
McpTask.jobis empty and a caller has nothing to suspend on. AgentHub can watch such a task and wake the caller's job through an API trigger, but the caller has to ask for that on atasks/get, andMcpService.get_taskcould not send it.What changed
McpService.watch_task(task, job_key=…, folder_key=…)(andwatch_task_async). Onetasks/getthat also asks the server to watch the task for the job named. It returns the task asget_taskdoes.McpTask.api_trigger: set when the server annotated a working task with anApiresume trigger, with itssuspend_after_ms.McpTask.watch: the watch the server started, from awatch_taskreply:watch_idandexpires_in_ms.Nonewhen the reply names none or one that cannot be used.call_tool(..., resume_trigger_types=…)(andcall_tool_async). The trigger kinds declared to the server. The default stays["Job"]; a caller that can suspend through a watch passes["Job", "Api"].Nothing changes for an existing caller: the default declaration is the same, and
get_tasksends what it sent before.How it is used
The suspend itself is
uipath-langchain's; it will call this fromcall_mcp_toolonce this version is released.Testing
packages/uipath-platform/tests/services: all pass (4 skipped, live LLM tests with no credentials). New:TestMcpTaskWatch, 21 tests — the two new properties and what they refuse, the declaration oncall_tool, the requestwatch_tasksends (sync and async), and that an ordinary poll is unchanged.ruffandmypyare clean.McpRemoteUiPathTaskson, a real Orchestrator, a Remote server over an in-cluster upstream that answersresearchwith a 150-second task, and a coded agent (call_mcp_tool) on a local Python robot built from the three branches. The job went Running → Suspended → Resumed → Successful. AgentHub logged the watch andwoke job … (task completed, delivery Delivered); the upstream saw the repeatedtasks/getevery 5 s while the job was suspended, and the job resumed about 5 s after the task completed. So AgentHub's service identity could read the job's triggers and deliver there.mcp-session-idonserver/discover; AgentHub refuses a session id it did not see opened on a Remote server (-32601 Not Found), so the client falls back to the older handshake, where tasks are not declared. Low-code suspend on a Remote task needs that resolved first.uipath-platformgoes to 0.3.22.🤖 Generated with Claude Code