You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(mcp): suspend/resume the agent on long-running UiPath jobs via _meta
Implements Option 6 of the long-running-jobs design (mcp-longrunning-jobs-design.md):
a UiPath MCP server that backs a tool with an Orchestrator job advertises
`uipath.com/job` on initialize; the client then opts in per call and suspends the
LangGraph agent while the job runs, resuming with the result — all over MCP `_meta`,
so deployed agents gain the behavior on package upgrade with no agent.json change.
Client core (C1):
- `McpClient`: read the `InitializeResult._meta["uipath.com/job"]` advertisement
(`_apply_job_advertisement` → `is_job_aware`/`job_version`), and thread request
`_meta` through `call_tool(..., meta=)`.
- `mcp_tool._invoke_job_aware`: on a job-aware session, send the START `_meta`
(`{version}`) on every call; if the server returns a `{key, folderKey}` handle,
delegate to the injected `McpJobExecutor` with neutral `start`/`fetch` closures
(FETCH re-calls the tool with the handle `_meta`). Non-advertising/old servers
keep today's plain blocking path (back-compat).
LangGraph executor (C2):
- `LangGraphJobExecutor` (default for `create_mcp_tools_and_clients`): starts the
job inside `@durable_interrupt`, interrupts with `WaitJobRaw` (JOB/JOB_RAW
trigger), and on resume re-derives the handle from the terminal `Job` and FETCHes
the server-formatted result. `interrupt` is confined here; the neutral core lives
in `uipath.platform.mcp_jobs` (uipath-python). Non-job results resolve via
`SkipInterruptValue` to keep the durable index aligned without suspending.
Drops the fragile Option-10 notification-string bridge: advertisement-gating alone
gives back-compat (old server → no advertisement → plain path) and the free gain on
central server upgrade.
Tests: 9 new (advertisement, START/FETCH `_meta`, executor suspend/resume/faulted);
full test_mcp suite green (232 incl. circular-import guard); ruff + mypy clean.
Note: stacked on uipath-python's unreleased `uipath-platform>=0.1.65` (the
`mcp_jobs` neutral core). Floor bumped; uv.lock to be regenerated and CI goes green
once that release publishes. Developed against an editable local link (reverted).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0 commit comments