Skip to main content

z4j-bare

PyPI version Python License

The framework-free agent runtime for z4j.

Bootstraps a z4j agent inside any Python process, Celery worker, RQ worker, Dramatiq actor, plain script, custom service, and connects it to z4j over an authenticated WebSocket. Used directly when there's no framework adapter (z4j-django / z4j-flask / z4j-fastapi); used indirectly by those framework adapters too.

Compatibility

Python 3.11+. No framework or engine pinned; pair with whichever engine adapter your worker runs (z4j-celery, z4j-rq, z4j-dramatiq, z4j-huey, z4j-arq, z4j-taskiq) and that adapter carries the engine-version floor.

Full per-adapter matrix at https://docs.z4j.com/reference/compatibility/.

What it ships

  • Agent runtime, connect, authenticate, supervise, reconnect with bounded backoff
  • Outbound buffer, captured events are written to a bounded local SQLite ring before going out on the wire and survive short brain outages and agent restarts. At the configured count or byte limit, the oldest buffered rows are evicted and the loss is logged.
  • Engine signal hooks, wired up by whichever engine adapter you install (z4j-celery, z4j-rq, etc.); the runtime drains them into the buffer
  • Schedule inventory, emits a full snapshot at boot, on a periodic timer (default 15 min), and on demand from the brain's Sync now command. Existing schedules show up automatically.
  • Command dispatcher, receives operator actions from the brain (retry, cancel, restart, schedule.fire, schedule.resync, etc.) and routes them to the right adapter

Install

pip install z4j-bare

Most users install a framework adapter (z4j-django / z4j-flask / z4j-fastapi) which pulls z4j-bare automatically.

Quick start (framework-free worker)

import os

from z4j_bare import install_agent
from z4j_celery import CeleryEngineAdapter

install_agent(
    engines=[CeleryEngineAdapter(celery_app=app)],
    brain_url="https://brain.example.com",
    token="z4j_agent_...",
    project_id="my-project",
    hmac_secret=os.environ["Z4J_HMAC_SECRET"],
)

Durable native schedule control

from z4j_bare import NativeScheduleControl provides the private SQLite store used by the Huey periodic, arq cron and TaskIQ label-source adapters. Construct it with a stable application-local file path and pass it as control= to the scheduler adapter in the actual native producer. Back up this file: it retains dashboard-created schedules, field overrides, pauses and deletion tombstones. The producer consumes it without requiring a live server connection. See each scheduler's setup guide for startup ordering.

Reliability

  • Invalid or missing configuration and unsafe buffer initialization fail the explicit install_agent() call; after successful startup, transport work runs off the host application's request and task paths.
  • Engine adapters use bounded in-process event queues and the runtime uses a bounded SQLite buffer. A full engine queue loses an event: the Celery, RQ and Dramatiq adapters evict the oldest queued event, the Huey, arq and TaskIQ adapters drop the new one. Buffer pressure evicts the oldest rows. Both paths log the loss.
  • The supervisor retries every failure with bounded, jittered backoff until the agent is stopped. Authentication and protocol-version failures are retried on much longer schedules (up to 10 minutes and 1 hour between attempts) so they do not create reconnect storms.

Documentation

Full docs at docs.z4j.com/frameworks/bare/.

License

Apache-2.0, see LICENSE.

Metadata

Release files for z4j-bare 1.13.2

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

Source distribution (sdist)

Source distribution for z4j-bare 1.13.2
File Size Uploaded Provenance Actions
z4j_bare-1.13.2.tar.gz 312.0 kB Without provenance Details for z4j_bare-1.13.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for z4j-bare 1.13.2
File Interpreter ABI Platform Actions
z4j_bare-1.13.2-py3-none-any.whl Python 3 none any Details for z4j_bare-1.13.2-py3-none-any.whl

Total release size: 514.9 kB

Release files / z4j_bare-1.13.2.tar.gz

Download URL z4j_bare-1.13.2.tar.gz
Size 312.0 kB
Tags Source
SHA-256 checksum
How to use checksums
bcb5acc4826ed08d025e56e3fccdc0d221ad4bc6104c084d21e3a590844656a6
BLAKE2b-256 checksum
How to use checksums
23bb9f0e56279972ae3a0dfb42c318c01613732d0c41b63fc54ca425cfabfde8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / z4j_bare-1.13.2-py3-none-any.whl

Download URL z4j_bare-1.13.2-py3-none-any.whl
Size 202.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ebfa6887118f40695eadbe95817840ab4590082e476029bf74498b80ecb1cdc2
BLAKE2b-256 checksum
How to use checksums
45e5a41bce00af96f5b1a200a4bffee5da0d00d2b6cba8aa592a2f881dfa639b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Security for z4j-bare 1.13.2

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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