Skip to content

Docs: add interrupt models docs #231

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
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
59 changes: 59 additions & 0 deletions sdk/core/uipath_sdk/_models/interrupt_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,63 @@


class InvokeProcess(BaseModel):
"""Interrupt model to invoke a process identified by its name.

This model is utilized to invoke a process within UiPath cloud platform. Upon completion of the invoked
process, the current agent will automatically resume execution.

Attributes:
name (str): The name of the process to invoke.
input_arguments (Optional[Dict[str, Any]]): A dictionary containing the input arguments required for the invoked process.

Example:
>>> process_output = interrupt(InvokeProcess(name="MyProcess", input_arguments={"arg1": "value1"}))
"""

name: str
input_arguments: Optional[Dict[str, Any]]


class WaitJob(BaseModel):
"""Interrupt model to wait for the completion of a job.

This model is used to wait for a job completion.
Unlike `InvokeProcess`, which automatically creates a job, this model is intended for scenarios where
the job has already been created and should be tracked.

Attributes:
job (Job): The instance of the job that the model will wait for. This should be a valid job object
that has been previously created.

Example:
>>> job_output = interrupt(WaitJob(job=my_job_instance))
"""

job: Job


class CreateAction(BaseModel):
"""Interrupt model to create an escalation action in the UiPath Action Center.

This model is utilized to create an action within the UiPath Action Center as part of an interrupt context.
The action schema must be defined as part of a UiPath app, which must be created prior to using this model.
The app can be identified either by its name or by its key. When the Human-in-the-loop process is addressed,
the agent will resume execution.

For more information on UiPath apps, refer to the [UiPath Apps User Guide](https://docs.uipath.com/apps/automation-cloud/latest/user-guide/introduction).

Attributes:
name (Optional[str]): The name of the action.
key (Optional[str]): The key of the action.
title (str): The title of the action to create.
data (Optional[Dict[str, Any]]): Values that the action will be populated with.
app_version (Optional[int]): The version of the application (default is 1).
assignee (Optional[str]): The username or email of the person assigned to handle the escalation.

Example:
>>> action_output = interrupt(CreateAction(name="ActionName", key="ActionKey", title="Escalate Issue", data={"key": "value"}, app_version=1, assignee="user@example.com"))
"""

name: Optional[str] = None
key: Optional[str] = None
title: str
Expand All @@ -25,4 +73,15 @@ class CreateAction(BaseModel):


class WaitAction(BaseModel):
"""Interrupt model to wait for an action to be handled.

This model is analogous to `CreateAction`, but it is intended for scenarios where the action has already been created.

Attributes:
action (Action): The instance of the action to wait for.

Example:
>>> action_output = interrupt(WaitAction(action=my_action_instance))
"""

action: Action
1 change: 0 additions & 1 deletion sdk/core/uipath_sdk/_services/actions_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ def create(
json_response = response.json()
if assignee:
spec = _assign_task_spec(json_response["id"], assignee)
print(spec)
self.request(spec.method, spec.endpoint, content=spec.content)
return Action.model_validate(json_response)

Expand Down
Loading