Skip to content

Commit 83378e3

Browse files
committed
docs: add interrupt models docs
1 parent 7781048 commit 83378e3

2 files changed

Lines changed: 128 additions & 0 deletions

File tree

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# UiPath Interrupt Models
2+
3+
This module contains models that facilitate invoking processes, waiting for jobs, creating actions and waiting for HITL actions in an interrupt context.
4+
5+
## Models Overview
6+
7+
### 1. InvokeProcess
8+
9+
The `InvokeProcess` model is utilized to invoke a process within UiPath cloud platform. Upon completion of the invoked process, the current agent will automatically resume execution.
10+
11+
#### Attributes:
12+
- **name** (str): The name of the process to invoke.
13+
- **input_arguments** (Optional[Dict[str, Any]]): A dictionary containing the input arguments required for the invoked process.
14+
15+
#### Example:
16+
```python
17+
process_output = interrupt(InvokeProcess(name="MyProcess", input_arguments={"arg1": "value1"}))
18+
```
19+
20+
---
21+
22+
### 2. WaitJob
23+
24+
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
25+
the job has already been created.
26+
27+
#### Attributes:
28+
- **job** (Job): The instance of the job that the agent will wait for. This should be a valid job object that has been previously created.
29+
30+
#### Example:
31+
```python
32+
job_output = interrupt(WaitJob(job=my_job_instance))
33+
```
34+
35+
---
36+
37+
### 3. CreateAction
38+
39+
The `CreateAction` model is utilized to create an escalation action within the UiPath Action Center as part of an interrupt context. The action will rely on a previously created UiPath app.
40+
After addressing the escalation, the current agent will resume execution.
41+
For more information on UiPath apps, refer to the [UiPath Apps User Guide](https://docs.uipath.com/apps/automation-cloud/latest/user-guide/introduction).
42+
43+
#### Attributes:
44+
- **name** (Optional[str]): The name of the app.
45+
- **key** (Optional[str]): The key of the app.
46+
- **title** (str): The title of the action to create.
47+
- **data** (Optional[Dict[str, Any]]): Values that the action will be populated with.
48+
- **app_version** (Optional[int]): The version of the app (defaults to 1).
49+
- **assignee** (Optional[str]): The username or email of the person assigned to handle the escalation.
50+
51+
#### Example:
52+
```python
53+
action_output = interrupt(CreateAction(name="AppName", title="Escalate Issue", data={"key": "value"}, app_version=1, assignee="user@example.com"))
54+
```
55+
56+
---
57+
58+
### 4. WaitAction
59+
60+
The `WaitAction` model is used to wait for an action to be handled. This model is intended for scenarios where the action has already been created.
61+
62+
#### Attributes:
63+
- **action** (Action): The instance of the action to wait for.
64+
65+
#### Example:
66+
```python
67+
action_output = interrupt(WaitAction(action=my_action_instance))
68+
```
69+

sdk/core/uipath_sdk/_models/interrupt_models.py

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,63 @@
77

88

99
class InvokeProcess(BaseModel):
10+
"""Interrupt model to invoke a process identified by its name.
11+
12+
This model is utilized to invoke a process within UiPath cloud platform. Upon completion of the invoked
13+
process, the current agent will automatically resume execution.
14+
15+
Attributes:
16+
name (str): The name of the process to invoke.
17+
input_arguments (Optional[Dict[str, Any]]): A dictionary containing the input arguments required for the invoked process.
18+
19+
Example:
20+
>>> process_output = interrupt(InvokeProcess(name="MyProcess", input_arguments={"arg1": "value1"}))
21+
"""
22+
1023
name: str
1124
input_arguments: Optional[Dict[str, Any]]
1225

1326

1427
class WaitJob(BaseModel):
28+
"""Interrupt model to wait for the completion of a job.
29+
30+
This model is used to wait for a job completion.
31+
Unlike `InvokeProcess`, which automatically creates a job, this model is intended for scenarios where
32+
the job has already been created and should be tracked.
33+
34+
Attributes:
35+
job (Job): The instance of the job that the model will wait for. This should be a valid job object
36+
that has been previously created.
37+
38+
Example:
39+
>>> job_output = interrupt(WaitJob(job=my_job_instance))
40+
"""
41+
1542
job: Job
1643

1744

1845
class CreateAction(BaseModel):
46+
"""Interrupt model to create an escalation action in the UiPath Action Center.
47+
48+
This model is utilized to create an action within the UiPath Action Center as part of an interrupt context.
49+
The action schema must be defined as part of a UiPath app, which must be created prior to using this model.
50+
The app can be identified either by its name or by its key. When the Human-in-the-loop process is addressed,
51+
the agent will resume execution.
52+
53+
For more information on UiPath apps, refer to the [UiPath Apps User Guide](https://docs.uipath.com/apps/automation-cloud/latest/user-guide/introduction).
54+
55+
Attributes:
56+
name (Optional[str]): The name of the action.
57+
key (Optional[str]): The key of the action.
58+
title (str): The title of the action to create.
59+
data (Optional[Dict[str, Any]]): Values that the action will be populated with.
60+
app_version (Optional[int]): The version of the application (default is 1).
61+
assignee (Optional[str]): The username or email of the person assigned to handle the escalation.
62+
63+
Example:
64+
>>> action_output = interrupt(CreateAction(name="ActionName", key="ActionKey", title="Escalate Issue", data={"key": "value"}, app_version=1, assignee="user@example.com"))
65+
"""
66+
1967
name: Optional[str] = None
2068
key: Optional[str] = None
2169
title: str
@@ -25,4 +73,15 @@ class CreateAction(BaseModel):
2573

2674

2775
class WaitAction(BaseModel):
76+
"""Interrupt model to wait for an action to be handled.
77+
78+
This model is analogous to `CreateAction`, but it is intended for scenarios where the action has already been created.
79+
80+
Attributes:
81+
action (Action): The instance of the action to wait for.
82+
83+
Example:
84+
>>> action_output = interrupt(WaitAction(action=my_action_instance))
85+
"""
86+
2887
action: Action

0 commit comments

Comments
 (0)