Listing Tasks
To list all tasks for a specific agent, use the list_tasks
method:
my_tasks = client.tasks.list_tasks(agent_id="xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")
my_tasks
[Task(task_id="xxxxxxxx", name="Task 1"), Task(task_id="xxxxxxxx", name="Task 2")]
Retrieving a Task
To retrieve a specific task, use the retrieve_task
method with the agent_id
and conversation_id
:
my_task = client.tasks.retrieve_task(
agent_id="xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
conversation_id="xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
)
my_task
Task(task_id="xxxxxxxx", name="Task 1")
Viewing Task Steps
To view the steps of a task, use the view_task_steps
method:
task_steps = client.tasks.view_task_steps(
agent_id="xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
conversation_id="xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
)
task_steps
Approving a Task
To approve a task, use the approve_task
method:
approved_task = client.tasks.approve_task(
agent_id="xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
conversation_id="xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
tool_id="xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
)
approved_task
TriggeredTask(task_id="xxxxxxxx", status="approved")
Deleting a Task
To delete a task, use the delete_task
method:
success = client.tasks.delete_task(
agent_id="xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
conversation_id="xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
)
success
Triggering a Task
To trigger a task, use the trigger_task
method with a message:
message = "OUR_SALES_EMAIL```xxxxxx@xxxxxx.com```EMAIL_THREAD_ID```xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx```\nLinkedIn_Chat_ID```xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx```"
triggered_task = client.tasks.trigger_task(
agent_id="xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
message=message
)
triggered_task
TriggeredTask(task_id="xxxxxxxx", status="triggered")
Rerunning a Task
To rerun a task, use the rerun_task
method:
rerun_task = client.tasks.rerun_task(
agent_id="xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
conversation_id="xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
)
rerun_task
TriggeredTask(task_id="xxxxxxxx", status="rerun")
Scheduling an Action in a Task
To schedule an action in a task, use the schedule_action_in_task
method:
scheduled_action = client.tasks.schedule_action_in_task(
agent_id="xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
conversation_id="xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
message=message,
minutes_until_schedule=86400
)
scheduled_action
ScheduledActionTrigger(action_id="xxxxxxxx", status="scheduled")