Skip to content

feat: resolve ArgumentEmail and ArgumentGroupName recipients at runtime#735

Open
dushyant-uipath wants to merge 1 commit intomainfrom
feat/escalation-argument-assignee
Open

feat: resolve ArgumentEmail and ArgumentGroupName recipients at runtime#735
dushyant-uipath wants to merge 1 commit intomainfrom
feat/escalation-argument-assignee

Conversation

@dushyant-uipath
Copy link
Copy Markdown

@dushyant-uipath dushyant-uipath commented Mar 27, 2026

Summary

Updates resolve_recipient_value() in escalation_tool.py to handle the two new argument-driven recipient types added in UiPath/uipath-python PR #1521. At runtime, each type's argument_path is looked up in the agent's input kwargs using dot-notation (safe_get_nested) to produce a concrete TaskRecipient.

Also fixes create_mcp_tools_from_agent — the function was incorrectly aliased to create_mcp_tools_and_clients (which takes list[AgentMcpResourceConfig]), but callers pass a LowCodeAgentDefinition. Replaced with a proper wrapper that extracts MCP resources from the agent definition first.

Changed files

File Change
escalation_tool.py resolve_recipient_value accepts optional input_args; ArgumentEmailRecipient and ArgumentGroupNameRecipient handling added; call site passes filtered agent input (internal graph state fields excluded)
escalate_action.py Guardrails path also passes input_args to resolve_recipient_value — previously always raised ValueError for argument-based recipients
mcp/__init__.py + mcp_tool.py create_mcp_tools_from_agent definition moved to mcp_tool.py with correct list[BaseTool] return type; re-exported from __init__.py
pyproject.toml uipath>=2.10.49 (requires the companion PR to be merged)

Failure modes & what was tested

The only runtime failure path

In resolve_recipient_value():

value = safe_get_nested(input_args or {}, recipient.argument_path)
if value is None:
    raise ValueError(
        f"Argument '{recipient.argument_path}' has no value in agent input."
    )

This raises when:

  1. The agent is invoked without the expected input argument (key missing)
  2. The argument is present but explicitly None

This is intentional — a misconfigured escalation should fail loudly at task creation time, not silently create a task with no assignee.

There is no feature flag in the Python layer. The flag (EnableEscalationArgumentAssignee) lives in the frontend and Agents backend only. If the frontend sends an ArgumentEmail/ArgumentGroupName recipient (flag is on), the Python side always processes it. The frontend strips these types from the payload when the flag is off.

End-to-end local test (hacked-coded, 2026-04-15)

Agent configured with ArgumentEmail recipient (argument_path="assigneeEmail"), run against alpha:

uv run uipath run agent.json '{"assigneeEmail": "dushyant.pathak@uipath.com", "taskDescription": "Test dynamic assignee"}'

Action Center task created with:

recipient:
  type: TaskRecipientType.EMAIL
  value: dushyant.pathak@uipath.com   ← resolved from input arg at runtime ✓
title: Review Required
data.taskDetails: Test dynamic assignee

✓ Successful execution.

Other paths verified

  • create_mcp_tools_from_agent loads without error — agents factory registers correctly ✓
  • Existing AssetRecipient and StandardRecipient resolution paths unaffected ✓
  • input_args=None default: all existing callers that don't pass input_args continue to work ✓
  • escalate_action.py guardrails path: input_args now passed correctly, no longer raises on argument-based recipients ✓

Related

Test plan

  • ArgumentEmail recipient end-to-end: agent run with assigneeEmail input → Action Center task created with correct assignee ✓
  • Same for ArgumentGroupName
  • Run without the argument populated — verify ValueError with clear message
  • Verify existing AssetRecipient and StandardRecipient paths unaffected
  • Verify create_mcp_tools_from_agent no longer crashes when agent has MCP resources

@dushyant-uipath dushyant-uipath force-pushed the feat/escalation-argument-assignee branch from 86653ab to 7ae74eb Compare April 6, 2026 19:46
Comment thread src/uipath_langchain/agent/tools/escalation_tool.py Outdated
Comment thread src/uipath_langchain/agent/tools/escalation_tool.py Outdated
Comment thread src/uipath_langchain/agent/tools/escalation_tool.py Outdated
@dianagrecu-uipath
Copy link
Copy Markdown
Contributor

Please also add new tests to cover the new runtime code paths.

Comment thread src/uipath_langchain/agent/tools/escalation_tool.py Outdated
@dushyant-uipath dushyant-uipath force-pushed the feat/escalation-argument-assignee branch 6 times, most recently from 9a6fb38 to a62988e Compare April 13, 2026 19:21
@radugheo
Copy link
Copy Markdown
Collaborator

The method resolve_recipient_value() is also called inside EscalateAction._create_task_node() in escalate_action.py, without input_args. For the new argument-based recipient types, this will always raise a ValueError since input_args defaults to {}.

Comment thread src/uipath_langchain/agent/tools/escalation_tool.py Outdated
Comment thread src/uipath_langchain/agent/tools/escalation_tool.py Outdated
Comment thread src/uipath_langchain/agent/tools/mcp/__init__.py Outdated
Comment thread src/uipath_langchain/agent/tools/escalation_tool.py Outdated
Comment thread src/uipath_langchain/agent/tools/mcp/__init__.py Outdated
Comment thread src/uipath_langchain/agent/tools/escalation_tool.py Outdated
@dushyant-uipath dushyant-uipath force-pushed the feat/escalation-argument-assignee branch 3 times, most recently from 8538b82 to 78dcd95 Compare April 15, 2026 19:48
Updates resolve_recipient_value() in escalation_tool to handle the two
new argument-driven recipient types. Each type carries an argument_name
that is looked up in the tool's runtime kwargs to produce a concrete
email or group-name TaskRecipient.

Follows the same pattern as AssetRecipient resolution. Backward
compatible -- input_args defaults to None.

Depends on uipath-python adding ArgumentEmailRecipient and
ArgumentGroupNameRecipient to uipath.agent.models.agent.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dushyant-uipath dushyant-uipath force-pushed the feat/escalation-argument-assignee branch from 78dcd95 to 20af5a7 Compare April 15, 2026 20:33
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.

3 participants