from acontext import AcontextClient
client = AcontextClient(api_key='sk_project_token')
# Get sandbox logs
logs = client.sandboxes.get_logs(limit=20, time_desc=True)
for log in logs.items:
print(f"Log {log.id}: {log.backend_type}")
# If there are more logs, use the cursor for pagination
if logs.has_more:
next_logs = client.sandboxes.get_logs(
limit=20,
cursor=logs.next_cursor
){
"code": 123,
"error": "<string>",
"msg": "<string>",
"data": {
"has_more": true,
"items": [
{
"backend_sandbox_id": "<string>",
"backend_type": "<string>",
"created_at": "<string>",
"generated_files": [
{}
],
"history_commands": [
{}
],
"id": "<string>",
"project_id": "<string>",
"updated_at": "<string>",
"will_total_alive_seconds": 123
}
],
"next_cursor": "<string>"
}
}Get sandbox logs for the project with cursor-based pagination
from acontext import AcontextClient
client = AcontextClient(api_key='sk_project_token')
# Get sandbox logs
logs = client.sandboxes.get_logs(limit=20, time_desc=True)
for log in logs.items:
print(f"Log {log.id}: {log.backend_type}")
# If there are more logs, use the cursor for pagination
if logs.has_more:
next_logs = client.sandboxes.get_logs(
limit=20,
cursor=logs.next_cursor
){
"code": 123,
"error": "<string>",
"msg": "<string>",
"data": {
"has_more": true,
"items": [
{
"backend_sandbox_id": "<string>",
"backend_type": "<string>",
"created_at": "<string>",
"generated_files": [
{}
],
"history_commands": [
{}
],
"id": "<string>",
"project_id": "<string>",
"updated_at": "<string>",
"will_total_alive_seconds": 123
}
],
"next_cursor": "<string>"
}
}Project Bearer token (e.g., "Bearer sk-ac-xxxx")
Limit of sandbox logs 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)