Quickstart
Ship your first task in 5 minutes.
FastWorker requires Python 3.12+. There's nothing else to install — no Redis, no RabbitMQ, no Docker.
1. Install
pip install fastworker
# or with uv
uv add fastworker 2. Define tasks
Create mytasks.py. Any function decorated with @task becomes callable from the queue.
# mytasks.py
from fastworker import task
@task
def add(x: int, y: int) -> int:
"""Add two numbers."""
return x + y
@task
def multiply(x: int, y: int) -> int:
"""Multiply two numbers."""
return x * y 3. Start the control plane
The control plane coordinates and processes tasks. The built-in management GUI auto-starts at http://127.0.0.1:8080.
fastworker control-plane --task-modules mytasks
# GUI: http://127.0.0.1:8080 4. (Optional) Scale out with subworkers
For extra throughput, start subworkers in separate terminals. They auto-register with the control plane.
fastworker subworker \
--worker-id subworker1 \
--control-plane-address tcp://127.0.0.1:5555 \
--base-address tcp://127.0.0.1:5561 \
--task-modules mytasks 5. Submit tasks from the CLI
# CLI submission
fastworker submit --task-name add --args 5 3
# Non-blocking (returns a task id)
fastworker submit --task-name add --args 5 3 --non-blocking
fastworker status --task-id <uuid> 6. Submit from Python / FastAPI
The async Client is designed for FastAPI request handlers. Non-blocking submission returns immediately.
from fastworker import Client
import asyncio
async def main():
client = Client()
await client.start()
task_id = await client.delay("add", 5, 3)
print(f"Submitted: {task_id}")
result = await client.get_task_result(task_id)
if result:
print(f"Result: {result.result}")
client.stop()
asyncio.run(main())