Skip to main content
Litestar Queues

Task queues, workers, schedules, realtime event streams, and storage/execution backends for Litestar.

PyPI Python CI Documentation License

Quickstart · Architecture · Storage Backends · Execution & Operations · Events & Streams · API Reference


litestar-queues decouples authoritative task storage (BaseQueueBackend) from execution delivery (BaseExecutionBackend). Persist tasks, retries, uniqueness reservations, and event history in SQLSpec (PostgreSQL, MySQL, MariaDB, SQLite, DuckDB, CockroachDB, Spanner, Oracle, SQL Server), Advanced Alchemy, Redis, or Valkey while dispatching execution across local workers, Google Cloud Tasks, Google Cloud Run Jobs, Pub/Sub, SQS, RabbitMQ, or Kafka using an ID-only wire payload ({"version": 1, "task_id": "<uuid>"}).

Install

uv add litestar-queues

Add optional extras for your storage or execution backend (sqlspec, advanced-alchemy, redis, valkey, cloud-tasks, cloudrun, pubsub, sqs, rabbitmq, kafka, otel, prometheus).

Quickstart

from uuid import UUID

from litestar import Litestar, get, post
from litestar.di import NamedDependency
from litestar.exceptions import NotFoundException
from litestar.params import FromPath, FromQuery

from litestar_queues import QueueConfig, QueuePlugin, QueueService, task


@task(queue="reports")
async def render_report(report_id: str, requested_by: str) -> dict[str, str]:
    """Render an analytics report in the background."""
    return {"report_id": report_id, "requested_by": requested_by, "status": "ready"}


@post("/reports/{report_id:str}")
async def start_report(
    report_id: FromPath[str],
    queue_service: NamedDependency[QueueService],
    requested_by: FromQuery[str] = "team@example.com",
) -> dict[str, str]:
    """Enqueue a background report job and return its tracking ID."""
    handle = await queue_service.enqueue(render_report, report_id, requested_by=requested_by)
    return {"task_id": str(handle.id), "status": handle.status or "pending"}


@get("/tasks/{task_id:uuid}")
async def get_report_status(task_id: FromPath[UUID], queue_service: NamedDependency[QueueService]) -> dict[str, object]:
    """Inspect the status and return value of a queued task."""
    record = await queue_service.get_task(task_id)
    if record is None:
        raise NotFoundException(detail=f"Task {task_id} not found")
    return {
        "task_id": str(record.id),
        "status": record.status,
        "is_terminal": record.is_terminal,
        "result": record.result,
    }


app = Litestar(route_handlers=[start_report, get_report_status], plugins=[QueuePlugin(config=QueueConfig())])

Start the server and its supervised worker process:

LITESTAR_APP=app:app uv run litestar run --reload

Enqueue a report job and inspect its status:

curl -X POST http://127.0.0.1:8000/reports/q3-revenue
curl http://127.0.0.1:8000/tasks/<task_id>

Capabilities

Area Highlights
Storage Backends Zero-config EphemeralQueueBackend (WAL SQLite), InMemoryQueueBackend, SQLSpecQueueBackend (9+ relational databases & third-party adapters), SQLAlchemyBackend (Advanced Alchemy), RedisQueueBackend, and ValkeyQueueBackend.
Execution & Workers WorkerConfig(placement="server" | "asgi" | "external"), multi-backend routing (QueueConfig.execution_backends), Google Cloud Tasks push callbacks (CloudTasksOIDCGuard), Cloud Run Jobs, Pub/Sub, SQS, RabbitMQ, and Kafka.
Tasks & Schedules Priority queues, retries with exponential/jittered backoff, argument-identity uniqueness & forever reservations, cooperative & remote cancellation, cron/interval ScheduleConfig, and attempt-scoped TaskDependencyProvider.
Events & Observability Live SSE & WebSocket event streams (EventStreamConfig), durable event history (EventHistoryConfig, QueueEventQuery, EventHistoryExtraColumn), and low-cardinality OpenTelemetry, Prometheus, and SQLCommenter telemetry (ObservabilityConfig).

Documentation

Contributing & License

Run make install, make test-unit, make lint, and make docs before submitting changes; see the Contributing & Testing guide for details. litestar-queues supports Python 3.11 through 3.15 and is distributed under the MIT License.

Metadata

Release files for litestar-queues 0.15.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for litestar-queues 0.15.1
File Size Uploaded Provenance Actions
litestar_queues-0.15.1.tar.gz 1.3 MB With provenance Details for litestar_queues-0.15.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for litestar-queues 0.15.1
File Interpreter ABI Platform Actions
litestar_queues-0.15.1-py3-none-any.whl Python 3 none any Details for litestar_queues-0.15.1-py3-none-any.whl

Total release size: 1.8 MB

Release files / litestar_queues-0.15.1.tar.gz

Download URL litestar_queues-0.15.1.tar.gz
Size 1.3 MB
Tags Source
SHA-256 checksum
How to use checksums
86977c574f9bbbc80bf980d0bada818197fafdd8de02abe4bd889f19688f1349
BLAKE2b-256 checksum
How to use checksums
ad019b376151bc56cbb7435b0d2273d9ca24086429c7c18ffaddf94f43db9cb7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Release files / litestar_queues-0.15.1-py3-none-any.whl

Download URL litestar_queues-0.15.1-py3-none-any.whl
Size 436.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1996cc62034611c8b81226fced1a0134b5b27a71693afb25f6d4d3d905ba9a70
BLAKE2b-256 checksum
How to use checksums
bdf47ee62ae4bfc4e1656f0c79445aef2f2a700daad0b4a547882cb7c443340d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Security for litestar-queues 0.15.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for litestar_queues-0.15.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page