from acontext import AcontextClient
client = AcontextClient(api_key='sk_project_token')
# Get tasks from a session
tasks = client.sessions.get_tasks(
session_id='session-uuid',
limit=20,
time_desc=False
)
print(f"Found {len(tasks.items)} tasks")
for task in tasks.items:
print(f"Task {task.id}: {task.status}")
# If there are more tasks, use the cursor for pagination
if tasks.has_more:
next_tasks = client.sessions.get_tasks(
session_id='session-uuid',
limit=20,
cursor=tasks.next_cursor
){
"code": 123,
"error": "<string>",
"msg": "<string>",
"data": {
"has_more": true,
"items": [
{
"created_at": "<string>",
"data": {
"progresses": [
"<string>"
],
"sop_thinking": "<string>",
"task_description": "<string>",
"user_preferences": [
"<string>"
]
},
"id": "<string>",
"is_planning": true,
"order": 123,
"project_id": "<string>",
"session_id": "<string>",
"space_digested": true,
"status": "<string>",
"updated_at": "<string>"
}
],
"next_cursor": "<string>"
}
}Get tasks from session with cursor-based pagination
from acontext import AcontextClient
client = AcontextClient(api_key='sk_project_token')
# Get tasks from a session
tasks = client.sessions.get_tasks(
session_id='session-uuid',
limit=20,
time_desc=False
)
print(f"Found {len(tasks.items)} tasks")
for task in tasks.items:
print(f"Task {task.id}: {task.status}")
# If there are more tasks, use the cursor for pagination
if tasks.has_more:
next_tasks = client.sessions.get_tasks(
session_id='session-uuid',
limit=20,
cursor=tasks.next_cursor
){
"code": 123,
"error": "<string>",
"msg": "<string>",
"data": {
"has_more": true,
"items": [
{
"created_at": "<string>",
"data": {
"progresses": [
"<string>"
],
"sop_thinking": "<string>",
"task_description": "<string>",
"user_preferences": [
"<string>"
]
},
"id": "<string>",
"is_planning": true,
"order": 123,
"project_id": "<string>",
"session_id": "<string>",
"space_digested": true,
"status": "<string>",
"updated_at": "<string>"
}
],
"next_cursor": "<string>"
}
}Project Bearer token (e.g., "Bearer sk-ac-xxxx")
Session ID
Limit of tasks to return, default 20. Max 200.
Cursor for pagination. Use the cursor from the previous response to get the next page.
Order by created_at descending if true, ascending if false (default false)