Skip to content

Commit e55f59a

Browse files
authored
docs: document CreateEscalation and WaitEscalation HITL models (#789)
1 parent 664a0ac commit e55f59a

1 file changed

Lines changed: 56 additions & 4 deletions

File tree

docs/human_in_the_loop.md

Lines changed: 56 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ from uipath.platform.common import CreateTask
2828
task_output = interrupt(CreateTask(app_name="AppName", app_folder_path="MyFolderPath", title="Escalate Issue", data={"key": "value"}, assignee="user@example.com"))
2929
```
3030
/// info
31-
The return value of the interrupt is the task output. If the task did not produce any output, the return value will be the task status, e.g., `{"status": "completed"}`.
31+
The return value of the interrupt is the task output — only the data fields written back by the app, not the full task object. If the task did not produce any output, the return value will be the task status, e.g., `{"status": "completed"}`.
32+
33+
The human's decision (which Approve/Reject button was clicked, stored in `task.action`) is **not** included in the return value. To branch on the outcome, either add an explicit output field to the app schema (e.g. a boolean `IsApproved` wired to the buttons), or use [`CreateEscalation`](#3-createescalation) instead, which returns the full task object.
3234
///
3335

3436
For a practical implementation of the `CreateTask` model, refer to the [ticket-classification sample](https://github.com/UiPath/uipath-langchain-python/tree/main/samples/ticket-classification). This sample demonstrates how to create an action with dynamic input.
@@ -51,15 +53,65 @@ from uipath.platform.common import WaitTask
5153
task_output = interrupt(WaitTask(task=my_task_instance, app_folder_path="MyFolderPath"))
5254
```
5355
/// info
54-
The return value of the interrupt is the task output. If the task did not produce any output, the return value will be the task status, e.g., `{"status": "completed"}`.
56+
Like `CreateTask`, the return value is the task output only. Use [`WaitEscalation`](#4-waitescalation) if you need the full task object back, including the selected action.
57+
///
58+
59+
---
60+
61+
### 3. CreateEscalation
62+
63+
The `CreateEscalation` model creates an Action Center action the same way `CreateTask` does, but when the agent resumes it receives the **full `Task` object** instead of just `task.data`. Use this when the agent needs to branch on the human's decision (the button the reviewer clicked, stored in `task.action`) rather than only on the data fields written back by the app.
64+
65+
Accepts the same attributes as [`CreateTask`](#1-createtask).
66+
67+
#### Example:
68+
69+
```python
70+
from uipath.platform.common import CreateEscalation
71+
72+
task = interrupt(
73+
CreateEscalation(
74+
app_name="ApprovalApp",
75+
app_folder_path="MyFolderPath",
76+
title="Approve expense",
77+
data={"amount": 1200},
78+
assignee="reviewer@example.com",
79+
)
80+
)
81+
82+
if task.action == "Approve":
83+
...
84+
else:
85+
...
86+
```
87+
/// info
88+
The return value is the full `Task` object (including `task.action`, `task.data`, `task.status`, etc.). If the task is deleted while the agent is suspended, the task object is still returned rather than raising, so the agent can handle the deletion gracefully.
5589
///
5690

5791
---
5892

93+
### 4. WaitEscalation
94+
95+
`WaitEscalation` is the escalation counterpart of [`WaitTask`](#2-waittask): wait on an already-created task and receive the full `Task` object on resume.
96+
97+
#### Attributes:
98+
99+
- **action** (Task): The instance of the task to wait for.
100+
- **app_folder_path** (Optional[str]): The folder path of the app.
101+
102+
#### Example:
103+
104+
```python
105+
from uipath.platform.common import WaitEscalation
106+
task = interrupt(WaitEscalation(action=my_task_instance, app_folder_path="MyFolderPath"))
107+
```
108+
109+
---
110+
59111
> 💡The UiPath-LangChain SDK also supports **Robot/Agent-in-the-loop** scenarios. In this context, the execution of one agent
60112
> can be suspended until another robot or agent finishes its execution.
61113
62-
### 3. InvokeProcess
114+
### 5. InvokeProcess
63115

64116
The `InvokeProcess` model is utilized to invoke a process within the UiPath cloud platform.
65117
This process can be of various types, including API workflows, Agents or RPA automation.
@@ -90,7 +142,7 @@ For a practical implementation of the `InvokeProcess` model, refer to the [multi
90142

91143
---
92144

93-
### 4. WaitJob
145+
### 6. WaitJob
94146

95147
The `WaitJob` model is used to wait for a job completion. Unlike `InvokeProcess`, which automatically creates a job, this model is intended for scenarios where
96148
the job has already been created.

0 commit comments

Comments
 (0)