A3S CodeExamples
Lane Queue
Priority-based task queue with preemption
Lane Queue
The lane queue provides priority-based task scheduling with four lanes. High-priority tasks preempt lower-priority ones already in the queue.
Lanes (highest → lowest priority)
Prop
Type
Basic Queue Setup
const session = agent.session('/my-project', {
permissive: true,
queueConfig: { enableAllFeatures: true },
});
const result = await session.send('List all Rust files');
console.log(result.text);Run: node examples/test_task_priority.ts
Source: sdk/node/examples/test_task_priority.ts
from a3s_code import SessionQueueConfig
queue_config = SessionQueueConfig()
queue_config.enable_all_features = True
session = agent.session("/my-project",
permissive=True,
queue_config=queue_config,
)
result = session.send("List all Rust files")
print(result.text)Run: python examples/test_task_priority.py
Source: sdk/python/examples/test_task_priority.py
Priority Preemption
// Submit a low-priority background task
await session.submitTask({
id: 'background-analysis',
lane: 'generate',
payload: { prompt: 'Analyze the entire codebase' },
});
// Submit a high-priority query that preempts it
await session.submitTask({
id: 'urgent-query',
lane: 'query',
payload: { prompt: 'What is the current git branch?' },
});# Submit a low-priority background task
session.submit_task({
"id": "background-analysis",
"lane": "generate",
"payload": {"prompt": "Analyze the entire codebase"},
})
# Submit a high-priority query that preempts it
session.submit_task({
"id": "urgent-query",
"lane": "query",
"payload": {"prompt": "What is the current git branch?"},
})For full lane queue documentation, see Lane Queue.
API Reference
SessionQueueConfig
Prop
Type
ExternalTask fields (Rust)
Prop
Type
Queue management methods
Prop
Type