Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/uipath_langchain/agent/exceptions/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ class AgentRuntimeErrorCode(str, Enum):
TERMINATION_GUARDRAIL_ERROR = "TERMINATION_GUARDRAIL_ERROR"
TERMINATION_ESCALATION_REJECTED = "TERMINATION_ESCALATION_REJECTED"
TERMINATION_ESCALATION_ERROR = "TERMINATION_ESCALATION_ERROR"
ESCALATION_APP_JIT_DEBUG_MISSING_INFORMATION = (
"ESCALATION_APP_JIT_DEBUG_MISSING_INFORMATION"
)

# State
STATE_ERROR = "STATE_ERROR"
Expand Down
25 changes: 25 additions & 0 deletions src/uipath_langchain/agent/guardrails/actions/escalate_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
from ...messages.message_utils import replace_tool_calls
from ...react.types import AgentGuardrailsGraphState
from ...react.utils import extract_current_tool_call_index, find_latest_ai_message
from ...tools.escalation_jit import (
resolve_is_debug_run_safely,
resolve_jit_escalation_app,
)
from ...tools.escalation_recipient import resolve_recipient_value
from ..types import ExecutionStage
from ..utils import _extract_tool_args_from_message, get_message_content
Expand Down Expand Up @@ -211,6 +215,24 @@ async def _create_task_node(
data["ToolInputs"] = input_content
data["ToolOutputs"] = output_content

# Resolve inline (JIT) app targeting for a not-yet-deployed app in a
# debug run, mirroring the escalation tool's inline-app flow. The
# guardrail escalate app config carries no app_type/action_schema, so
# both are resolved from the solution at runtime when applicable.
is_debug = await resolve_is_debug_run_safely()
(
app_project_key,
app_type,
action_schema,
) = await resolve_jit_escalation_app(
app_name=self.app_name,
app_version=self.version,
app_type=None,
action_schema=None,
folder_path=self.app_folder_path,
is_debug=is_debug,
)

# Create the escalation task via API
client = UiPath()
created_task = await client.tasks.create_async(
Expand All @@ -219,6 +241,9 @@ async def _create_task_node(
app_name=self.app_name,
app_folder_path=self.app_folder_path,
recipient=task_recipient,
app_project_key=app_project_key,
app_type=app_type,
action_schema=action_schema,
)

# Store task URL in metadata for observability — before interrupt
Expand Down
Loading
Loading