Documentation
Complete API reference for the Tasks module including all classes, methods, properties, and parameters
acreate()
from xpander_sdk import Tasks tasks = Tasks() task = await tasks.acreate( agent_id="agent-123", prompt="Analyze the sales data", file_urls=["https://example.com/sales_data.csv"], events_streaming=True ) print(f"Created task: {task.id}")
create()
from xpander_sdk import Tasks tasks = Tasks() task = tasks.create( agent_id="agent-123", prompt="Analyze the sales data", file_urls=["https://example.com/sales_data.csv"] ) print(f"Created task: {task.id}")
task = await tasks.aget("task-456") print(f"Task status: {task.status}") print(f"Task result: {task.result}")
task = tasks.get("task-456") print(f"Task status: {task.status}") print(f"Task result: {task.result}")
async for event in task.aevents(): print(f"Event: {event.type} at {event.time}") if event.type == "task_finished": print("Task completed!") break
for event in task.events(): print(f"Event: {event.type}") if event.type == "task_finished": print("Task completed!") break
# Stop a running task stopped_task = await tasks.astop("task-456") print(f"Task {stopped_task.id} has been stopped") # Update task status updated_task = await tasks.aupdate( task_id="task-456", status=AgentExecutionStatus.Completed, result="Analysis completed successfully" )
# Stop a running task stopped_task = tasks.stop("task-456") print(f"Task {stopped_task.id} has been stopped") # Update task status updated_task = tasks.update( task_id="task-456", status=AgentExecutionStatus.Completed, result="Analysis completed successfully" )
Was this page helpful?