Skip to content
Merged
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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "uipath-langchain"
version = "0.5.34"
version = "0.5.35"
description = "Python SDK that enables developers to build and deploy LangGraph agents to the UiPath Cloud Platform"
readme = { file = "README.md", content-type = "text/markdown" }
requires-python = ">=3.11"
Expand Down
23 changes: 18 additions & 5 deletions src/uipath_langchain/agent/tools/escalation_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from langchain_core.messages.tool import ToolCall
from langchain_core.tools import BaseTool, StructuredTool
from langgraph.func import task
from langgraph.types import interrupt
from pydantic import BaseModel
from uipath.agent.models.agent import (
Expand All @@ -21,7 +22,7 @@
from uipath.eval.mocks import mockable
from uipath.platform import UiPath
from uipath.platform.action_center.tasks import TaskRecipient, TaskRecipientType
from uipath.platform.common import CreateEscalation, UiPathConfig
from uipath.platform.common import UiPathConfig, WaitEscalation
from uipath.runtime.errors import UiPathErrorCode

from uipath_langchain.agent.react.jsonschema_pydantic_converter import create_model
Expand Down Expand Up @@ -185,18 +186,29 @@ async def escalation_tool_fn(**kwargs: Any) -> dict[str, Any]:
example_calls=channel.properties.example_calls,
)
async def escalate():
return interrupt(
CreateEscalation(
@task
async def create_escalation_task():
client = UiPath()
return await client.tasks.create_async(
title=task_title,
data=kwargs,
recipient=recipient,
app_name=channel.properties.app_name,
app_folder_path=channel.properties.folder_name,
app_folder_path=channel.properties.folder_name or "",
recipient=recipient,
priority=channel.priority,
labels=channel.labels,
is_actionable_message_enabled=channel.properties.is_actionable_message_enabled,
actionable_message_metadata=channel.properties.actionable_message_meta_data,
)

created_task = await create_escalation_task()
return interrupt(
WaitEscalation(
action=created_task,
app_folder_path=channel.properties.folder_name,
app_name=channel.properties.app_name,
recipient=recipient,
)
)

result = await escalate()
Expand Down Expand Up @@ -266,6 +278,7 @@ async def escalation_wrapper(
"output": result["output"],
"outcome": result["outcome"],
"task_id": result["task_id"],
"task_url": result["task_url"],
"assigned_to": result["assigned_to"],
}

Expand Down
Loading