Flask
v1.6.8 Apache-2.0z4j-flask ยท Upstream project
Flask extension pattern. One line to install.
Standard Flask extension shape (Z4J(app)). Discovers Celery or Dramatiq tasks from your extensions/ layout. Reads config from app.config. No monkey-patching, no magic.
- Latest
- v1.6.8
- Released
- 2026-06-08
- License
- Apache-2.0
Install
pip install z4j-flask Flask + any task engine
Every extra pulls the engine adapter AND its companion scheduler in one shot, so a fresh install never needs a second command.
| Engine | Install command | Bundled scheduler |
|---|---|---|
| Celery recommended |
pip install z4j-flask[celery]
| celery-beat |
| RQ |
pip install z4j-flask[rq]
| rq-scheduler |
| Dramatiq |
pip install z4j-flask[dramatiq]
| APScheduler |
| Huey |
pip install z4j-flask[huey]
| huey-periodic |
| arq |
pip install z4j-flask[arq]
| arq-cron |
| TaskIQ |
pip install z4j-flask[taskiq]
| taskiq-scheduler |
| Every engine (CI / kitchen sink) |
pip install z4j-flask[all]
| all of the above |
pip install z4j-flask
with no extra installs only the framework adapter. Pick an engine extra
for the normal case.
Wire it in
from flask import Flask
from z4j_flask import Z4J
app = Flask(__name__)
app.config.from_prefixed_env("Z4J_")
z4j = Z4J(app) Confirm the agent reaches the brain
Run the doctor as the same user the service runs under. It probes brain DNS / TCP / TLS / WebSocket upgrade, the on-disk buffer path, and reports auto-detected engines - exits 0 on all-green, 1 on any failure.
python -m z4j_flask doctor
Catches the gunicorn-under-www-data silent startup failure (the agent now auto-relocates the buffer to $TMPDIR/z4j-{uid} when $HOME is unwritable), NAT / firewall / cert mismatches, and wrong-token / wrong-project_id problems with a specific failure reason. Add --no-websocket to skip the WS round-trip, --json for scripts. Reference.
Flask-specific features
Flask works with every z4j engine
The framework adapter handles lifecycle and config. Any engine adapter slots in alongside.
Celery
The industry standard, covered end-to-end.
Learn more
RQ
Lightweight Redis queue, fully instrumented.
Learn more
Dramatiq
Middleware-driven Dramatiq observability.
Learn more
Huey
Lightweight Redis/SQLite queue, first-class.
Learn more
arq
Async Redis queue for FastAPI-era Python.
Learn more
taskiq
Broker-agnostic async task framework.
Learn more