Skip to main content

z4j FastAPI framework adapter (Apache 2.0)

Project description

z4j-fastapi

PyPI version Python License

The FastAPI framework adapter for z4j.

Adds the z4j agent into your FastAPI app via a single add_z4j(app) call. Auto-discovers the engine adapter you have installed (Celery, RQ, Dramatiq, Huey, arq, TaskIQ) and streams every task lifecycle event to z4j. Operator control actions flow back the same channel.

What it ships

  • One-line install, add_z4j(app) and the agent connects on the next uvicorn worker boot
  • Engine auto-discovery, picks up whichever z4j engine adapter is installed alongside; cross-stack combos (FastAPI + arq, FastAPI + Celery) are first-class
  • @z4j_meta decorator, optional per-task annotations (priority="critical", description="...") for dashboard filtering and SLO display
  • Service-user safe, auto-relocates the local outbound buffer to $TMPDIR/z4j-{uid} when $HOME is unwritable (uvicorn under a service account, distroless images, etc.)

Install

pip install z4j-fastapi z4j-celery z4j-celerybeat

Wire it into your app:

from fastapi import FastAPI
from z4j_fastapi import add_z4j

app = FastAPI()
add_z4j(app)  # reads Z4J_AGENT_TOKEN, Z4J_BRAIN_URL, Z4J_PROJECT from env

Mint the agent token from the dashboard's Agents page.

Reliability

  • No exception from the agent ever propagates back into FastAPI request handlers or your worker code.
  • Events buffer locally when z4j is unreachable; your application never blocks on network I/O.

Documentation

Full docs at z4j.dev/frameworks/fastapi/.

License

Apache-2.0, see LICENSE.

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

z4j_fastapi-1.4.0.tar.gz (26.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

z4j_fastapi-1.4.0-py3-none-any.whl (21.2 kB view details)

Uploaded Python 3

File details

Details for the file z4j_fastapi-1.4.0.tar.gz.

File metadata

  • Download URL: z4j_fastapi-1.4.0.tar.gz
  • Upload date:
  • Size: 26.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for z4j_fastapi-1.4.0.tar.gz
Algorithm Hash digest
SHA256 ee9f9495c0ead55bce3ae48648866eb11b82052ffed5cfbc8c540fa580ca1ec6
MD5 c4dd8dfb5232d3239d950f8b975e4170
BLAKE2b-256 baee3089ae87345dc6b419ba3244c872f335bb42aef2cdc63f5cfddd06c9d148

See more details on using hashes here.

File details

Details for the file z4j_fastapi-1.4.0-py3-none-any.whl.

File metadata

  • Download URL: z4j_fastapi-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 21.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for z4j_fastapi-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 819fdd321952dcef8f12061c76b12cf152ddb0275154d8490e77b825558d61c4
MD5 302ad3efd5ead63fbdd9d3a24b3c354c
BLAKE2b-256 2fd5c9ab1144c4973ae9d6f0afa776022842a453c39306b7e9a3559aef1ea815

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page