Getting started
Requirements
Section titled “Requirements”- Python 3.12+, tested on 3.12, 3.13 and 3.14 (3.13+ recommended, see the note below)
- A Redis server, 6.2 or newer (ArdiQ uses Redis streams as its broker and result store).
Install
Section titled “Install”$ pip install ardiqArdiQ ships as a prebuilt wheel with the Rust core baked in — no Rust toolchain needed to
use it. That single install gives you the library, the ardiq worker command used
below, and one runtime dependency (msgpack).
You also need a Redis server — the quickest way is Docker:
$ docker run -d --name ardiq-redis -p 127.0.0.1:6379:6379 redis # Redis on localhost:6379or install it from your package manager (or redis.io).
The 127.0.0.1: prefix keeps Redis on your machine. Without it Docker publishes the
port on every network interface, and the image has no password, so anyone on your
network could read and write the queue. Anywhere beyond local development, set a
password with --requirepass and put it in the URL (redis://:secret@host:6379/0).
Your first task
Section titled “Your first task”-
Define an app and some tasks in a module — say
example.py:example.py from ardiq import Ardiqapp = Ardiq(redis_url="redis://localhost:6379", queue_name="example")@app.task()async def add(a: int, b: int) -> int:return a + b@app.task(max_retries=3)def slow_double(x: int) -> int: # sync task — runs in a threadreturn x * 2 -
Start a worker that loads
appfromexample.py:Terminal window $ ardiq run example:app -
Enqueue tasks from anywhere — a web handler, a script, a REPL — and read their results:
import asynciofrom example import addasync def main():job = await add.enqueue(2, 3) # returns a Job handleprint(job.id)print(await job.status()) # 'queued' | 'running' | 'complete'print(await job.result(timeout=5)) # waits → TaskResult(success=True, value=5, tries=1)asyncio.run(main())
All in one process
Section titled “All in one process”You don’t need a separate worker to try things out. Burst mode drains the queue and exits, so you can enqueue and process in a single script:
import asynciofrom ardiq import Ardiq
app = Ardiq(redis_url="redis://localhost:6379", queue_name="example")
@app.task()async def add(a: int, b: int) -> int: return a + b
async def main() -> None: jobs = [await add.enqueue(i, i) for i in range(3)]
app.burst = True await app.run() # process everything queued, then exit
for job in jobs: print(await job.result())
if __name__ == "__main__": asyncio.run(main())$ python example.pyWhere to go next
Section titled “Where to go next”- Defining tasks — retries, timeouts, priorities, sync vs async.
- Enqueuing & scheduling — delays, scheduled runs, per-call options.
- Results & introspection —
Job,TaskResult,status(),info(). - Running a worker — the CLI, burst mode, graceful shutdown.
Made bytay.dev