Skip to main content
Task queues decouple agent work producers from consumers. Push a task, a worker picks it up, and the result is stored — independently of the caller’s lifecycle. Use queues for long-running jobs, batch processing, and reliable retries.

Quick start

Task lifecycle

Execution contracts

Every task has a contract that defines what kind of work it represents:
Standard agent chat. Runs an agent with a user message.

Worker setup

1

Create a worker

2

Register custom contract handlers

3

Start the worker

Dead-letter handling

When a task exhausts all retries, it moves to the dead-letter queue (DLQ):

Error classification

The queue uses error classification to decide whether to retry:

Queue backends

State lives in process memory. No setup required.
Use for: Development, testing, prototyping.

Connection pooling

For high-throughput production workloads, use RedisConnectionPool to manage connections efficiently:
The pool provides:
  • Configurable max connections (default: 50)
  • Idle connection management
  • Automatic health checks
  • Singleton access via get_redis_pool()

Next steps

MCP Server

Expose tools via the Model Context Protocol.

Observability

Monitor queue performance and worker health.