Skip to content

Commit 0fee6a9

Browse files
docs: document recipient type for agent HITL actions (#900)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 60a674a commit 0fee6a9

1 file changed

Lines changed: 55 additions & 1 deletion

File tree

docs/human_in_the_loop.md

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ For more information on UiPath apps, refer to the [UiPath Apps User Guide](https
2020
- **title** (str): The title of the action to create.
2121
- **data** (Optional[Dict[str, Any]]): Values that the action will be populated with.
2222
- **assignee** (Optional[str]): The username or email of the person assigned to handle the escalation.
23+
- **recipient** (Optional[TaskRecipient]): A structured recipient that assigns the action to a specific user (by email or id) or group (by name or id). Takes precedence over **assignee** when both are set. See [Assigning the action to a user or group](#assigning-the-action-to-a-user-or-group).
2324

2425
#### Example:
2526

@@ -35,6 +36,57 @@ The human's decision (which Approve/Reject button was clicked, stored in `task.a
3536

3637
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.
3738

39+
#### Assigning the action to a user or group
40+
41+
`CreateTask` and `CreateEscalation` — together with their wait counterparts [`WaitTask`](#2-waittask) and [`WaitEscalation`](#4-waitescalation) — support two ways to assign the action:
42+
43+
- **assignee** (Optional[str]): The simple shortcut — a single username or email.
44+
- **recipient** (Optional[TaskRecipient]): A structured recipient that can target a **user** (by email or id) or a **group** (by name or id). When both are provided, **`recipient` takes precedence over `assignee`**.
45+
46+
`TaskRecipient` is imported from `uipath.platform.action_center.tasks` and has the following fields:
47+
48+
- **type** (TaskRecipientType): The kind of recipient (see the table below).
49+
- **value** (str): The identifier — an email, group name, user id, or group id, matching `type`.
50+
- **display_name** (Optional[str]): An optional human-readable name. For `USER_ID` and `GROUP_ID` recipients it is resolved automatically from the identity service.
51+
52+
| TaskRecipientType | Assigns to | `value` holds |
53+
| --- | --- | --- |
54+
| `EMAIL` | a single user, by email | the user's email |
55+
| `USER_ID` | a single user, by id | the user id |
56+
| `GROUP_NAME` | a group, by name | the group name |
57+
| `GROUP_ID` | a group, by id | the group id |
58+
59+
#### Example:
60+
61+
```python
62+
from uipath.platform.common import CreateTask
63+
from uipath.platform.action_center.tasks import TaskRecipient, TaskRecipientType
64+
65+
# Assign to a single user by email
66+
task_output = interrupt(
67+
CreateTask(
68+
app_name="AppName",
69+
app_folder_path="MyFolderPath",
70+
title="Escalate Issue",
71+
data={"key": "value"},
72+
recipient=TaskRecipient(type=TaskRecipientType.EMAIL, value="user@example.com"),
73+
)
74+
)
75+
76+
# Or assign to a group by name
77+
task_output = interrupt(
78+
CreateTask(
79+
app_name="AppName",
80+
app_folder_path="MyFolderPath",
81+
title="Escalate Issue",
82+
data={"key": "value"},
83+
recipient=TaskRecipient(type=TaskRecipientType.GROUP_NAME, value="Finance Approvers"),
84+
)
85+
)
86+
```
87+
88+
The same `recipient` field is available on `CreateEscalation`, `WaitTask`, and `WaitEscalation`.
89+
3890
---
3991

4092
### 2. WaitTask
@@ -45,6 +97,7 @@ The `WaitTask` model is used to wait for a task to be handled. This model is int
4597

4698
- **task** (Task): The instance of the task to wait for.
4799
- **app_folder_path** (Optional[str]): The folder path of the app.
100+
- **recipient** (Optional[TaskRecipient]): Optionally assign the task to a user or group while waiting. See [Assigning the action to a user or group](#assigning-the-action-to-a-user-or-group).
48101

49102
#### Example:
50103

@@ -62,7 +115,7 @@ Like `CreateTask`, the return value is the task output only. Use [`WaitEscalatio
62115

63116
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.
64117

65-
Accepts the same attributes as [`CreateTask`](#1-createtask).
118+
Accepts the same attributes as [`CreateTask`](#1-createtask), including `assignee` and `recipient` (see [Assigning the action to a user or group](#assigning-the-action-to-a-user-or-group)).
66119

67120
#### Example:
68121

@@ -98,6 +151,7 @@ The return value is the full `Task` object (including `task.action`, `task.data`
98151

99152
- **action** (Task): The instance of the task to wait for.
100153
- **app_folder_path** (Optional[str]): The folder path of the app.
154+
- **recipient** (Optional[TaskRecipient]): Optionally assign the task to a user or group while waiting. See [Assigning the action to a user or group](#assigning-the-action-to-a-user-or-group).
101155

102156
#### Example:
103157

0 commit comments

Comments
 (0)