tasklease
A leased task board for coordinating agents and workers across machines. Cloudflare Workers and SQLite Durable Objects hold tasks; R2 holds large files. The Python package includes a typed client, durable requester, generic worker, operator CLI, local dashboard and the prebuilt service bundle.
Licensed under Apache-2.0.
Own rotates a task's ID, fencing previous owners. Consume atomically retires
that ID and posts up to 16 successors, including replies. Renew preserves the
ID. A stable, server-carried origin_id follows the original Create through
Own and Consume, so replies prove which request they descend from. The
requester saves replies locally before acknowledging the server copy. Cancel
can retire the initial task even while a worker holds it.
Example use cases
Request and reply. A coding agent on macOS needs to verify a commit on
Linux. It posts the repository, commit ID, and reply topic to verify/linux.
A Linux worker checks out the commit, runs the tests, and uploads the log to
R2. One Consume operation retires the task and posts a result with the log's
blob key. The requesting agent saves the reply locally. Outbound HTTPS lets
the Linux worker run behind a home or office router. The project supplies
the verification handler; tasklease supplies the leases and reply handling.
A pipeline. A crawler posts a URL to check/url. A worker fetches the
page, stores it in R2, and in one Consume retires its task and posts a pointer
to the content to both classify/content and classify/security. Workers on
those topics each post their finding to assemble, whose worker writes each
finding to its own column of the URL's row. Every handoff is atomic: a
worker's task is retired exactly when its successors exist, so a crash can
make a stage run again but never loses or duplicates a handoff. The topics
are the graph's stages, and the dashboard shows each one's backlog and
latency.
Choosing tasklease
Use tasklease when agents and machines exchange discrete jobs, either as requests that end in a reply or as pipelines whose stages hand work forward, and you want no servers to operate:
- Jobs: platform builds, verification runs, GPU work, classification stages or requests for advice, taking seconds to hours. A worker holds a task for up to 24 hours per Own or Renew and keeps renewing while it works. An idle worker holds one 30-second long-poll open, so it picks up new work within a round trip instead of waiting for its next poll.
- Machines: laptops, desktops and home or office servers on macOS, Linux and Windows. Workers need only outbound HTTPS, including R2 uploads through presigned URLs, so they run behind NAT without a VPN, open ports or a broker to expose.
- Scale: thousands of workers. In a load test against a deployed service, 5,000 workers, each with its own token, polled one domain with no errors, and one domain served about 1,000 requests a second. All domains share one identity registry, which has not been tested beyond 5,000 tokens. Plan for 10,000–100,000 outstanding tasks per domain (see Scale guidance).
- Operations: after you create R2 access keys in the Cloudflare
dashboard, one
tl service deployprovisions the Worker, its storage, the bucket and the secrets in your own Cloudflare account; deploying needs Node.js and a Wrangler sign-in. Rerunning it upgrades the service; check the changelog for compatibility and migration instructions. There are no servers, brokers or databases to patch or back up: Cloudflare's durability is the backup. Requests are billed, idle polls included, so the scale figures assume a paid Workers plan.
Request/reply is built in: reply topics, a requester that saves replies locally before acknowledging them, server-carried origins and cancellation, a dashboard, and a Python worker runtime with lease renewal. Pipelines need no extra machinery: a handler's Consume posts up to 16 successors to any topics its identity may create in the domain. Workers can reserve local capacity, such as a build slot or GPU, before claiming work. Your application defines each job's payload, handler and next step.
Use something else when:
- a process needs a central record of its state: steps that wait for several results before continuing, durable timers, compensation, or querying and cancelling a whole run (Temporal);
- Python services in one network already share a broker and need task chains, groups or schedules (Celery);
- throughput is high (thousands of messages a second), every pickup must be sub-second, or consumers should scale automatically (Amazon SQS, Cloudflare Queues). A waiting worker usually gets a new task within a few hundred milliseconds, but with five workers the measured p99 was about 2 seconds (see Load test);
- you cannot use Cloudflare.
What each option takes to run
| Option | You provision | You maintain | Worker networking | Prefer it for |
|---|---|---|---|---|
| tasklease | A Cloudflare account and R2 access keys created in its dashboard. tl service deploy, run with Node.js and a Wrangler sign-in, creates the Worker, its Durable Objects, an R2 bucket with a seven-day lifecycle rule and the secrets; tl identity add issues one token per machine. |
Rerun tl service deploy to upgrade; rotate or revoke machine tokens. Workers run as tl worker under the startup templates. |
Outbound HTTPS only. | Request/reply jobs and handoff pipelines across machines and agents. |
| Temporal | Temporal Cloud, or a self-hosted Temporal Server with its persistence database (PostgreSQL, MySQL or Cassandra). | Self-hosted: server and schema upgrades, database operations. Either way: workflow code must stay deterministic and be versioned when it changes. | Workers connect to the Temporal frontend; self-hosted, it must be reachable from every worker. | Multi-step processes with a central record of their state: joins, durable timers, retry policies and compensation. |
| Celery | A broker such as RabbitMQ or Redis, an optional result backend, and the worker processes. See the Celery overview. | Broker upgrades, persistence and monitoring, and result-backend cleanup. | Every worker must reach the broker: expose it with TLS or use a VPN. | Python task composition and scheduling where a broker already runs. |
| Amazon SQS | An AWS account, queues and per-machine IAM credentials, plus your own reply queues and result storage. | Managed queues; you build the worker loop, visibility-timeout extension, reply matching and dashboards. | Outbound HTTPS. | Sustained high message rates on AWS. |
| Cloudflare Queues | Queues and consumers in a Cloudflare account; API tokens for HTTP pull consumers. | Managed queues; you build request/reply conventions, result storage and monitoring. | Outbound HTTPS for pull consumers. | Bursty traffic absorbed by automatically scaled Workers consumers. |
Lease expiry makes a task available for another attempt. The supplied worker
turns handler exceptions into failure replies; application code decides
whether to retry failed work. Every Own gives the task a new ID, and Consume
only works with the current one. So if a worker's lease runs out and another
worker claims the task, the old worker's Consume fails and its reply or
downstream tasks are never posted. A queue's visibility timeout does not stop
a timed-out consumer from sending its output. Consume commits task removal
and up to 16 successors together within one domain, so a pipeline lives in
one domain. Fan-out is atomic; fan-in is not built in: a step that must wait
for several results keeps track of what has arrived itself, for example in
the row it writes. A pipeline exists only as the tasks its handlers post, so
use origin_id to follow its descendants. Cancel applies only before the
initial task's first Consume; broader workflow state, scheduling and
cancellation belong in application code. Fencing
covers what tasklease posts; external effects, such as writing a finding or
publishing an artifact, still need idempotence, because a crash can cause a
step to run again.
Install
Python 3.12 or newer is required. Install from PyPI:
uv tool install tasklease
tl --help
Wheel and sdist installations include the dashboard and Worker, so installation and normal client/worker/monitor use need no Node.js. Service deployment uses Node.js and the exact Wrangler version recorded in the installed bundle. Published packages are available on PyPI.
For development, use Node ^22.12.0 || >=24, Python 3.12+ and uv:
make install
make check
make build
Artifacts are written under python/dist/. make check runs generated-contract
drift checks, Workers-runtime tests, Svelte component/model checks, Python
tests and conformance against both an isolated local Worker and the in-process
fake service.
See the release guide for first-release setup and the checklist for every release, and the changelog for user-visible changes and deployment notes.
For offline tests, tasklease.testing.FakeBoard provides real clients over
in-memory HTTP transports, controlled time, scoped identities and blob
transfers. tasklease.blobs supplies streaming file upload and verified
download helpers for tests and production. See offline testing and blob
transfers for examples and public validation helpers.
To work on the dashboard without a service, serve it with mock data:
npm run monitor:mock # dev server with hot reload
npm run monitor:mock:preview # the production build
npm run monitor:mock -- --port 5180 # Vite options go after --
Pick a scenario in the page URL, for example /?scenario=empty&delay=3000:
busy (default; an incident with a down machine, an error task and a
lapsed lease), building (healthy during a long build), empty, degraded
(some sources unavailable), large
(many domains and topics, a truncated queue, long names, inbox paging) or
unreachable (HTTP 502). TL_MOCK_SCENARIO sets the default. Scenarios live
in monitor/src/mock/ and are tested against the service schema.
Deploy the service
Choose fresh Worker and bucket names for a new service. Follow the CLI's Cloudflare login and R2 credential instructions:
tl service deploy --help
tl service deploy --config service.toml --name YOUR_WORKER --bucket YOUR_BUCKET
tl service status --config service.toml
Use a Cloudflare login with Workers and R2 management access. For signed R2
uploads, supply TL_R2_ACCESS_KEY_ID and TL_R2_SECRET_ACCESS_KEY for the chosen
bucket. The command configures the bucket lifecycle, uploads the bundled
Worker, installs secrets and verifies a task/blob round trip.
Save the admin candidate printed during bootstrap and follow its confirmation
status. A timed-out confirmation leaves an unconfirmed candidate; the CLI
explains recovery. Expected setup stops save the nonsecret target coordinates
so the next invocation resumes the same service. Tokens and R2 credentials
are never saved in service.toml. See deployment design
for the complete recovery sequence.
Operator setup
Set TL_ADMIN_TOKEN to the confirmed admin token to issue identities.
identity add, list, rotate and revoke use this admin credential.
Topic/task commands and whoami use an identity token from the client
config or TL_TOKEN; setting TL_ADMIN_TOKEN does not authorize them.
Service deployment also uses the admin credential for verification and recovery.
Issue an operator identity for the demo domain. It can administer tasks and
topics throughout that domain without individual scope grants:
umask 077 # On macOS/Linux, create new credential files private to this user.
tl --config service.toml identity add operator --domain demo --operator
Save only the returned token string, without JSON or quotes, in
operator.token. Create operator.toml beside it, copying the deployed URL
from service.toml:
url = "https://YOUR_WORKER.YOUR_SUBDOMAIN.workers.dev"
domain = "demo"
[token]
file = "operator.token"
On macOS/Linux, restrict the files before using them:
chmod 600 operator.toml operator.token
On Windows, use files whose access-control lists restrict access to your user. See Client configuration for default locations. Check the identity, declare the served work topic and list the domain:
tl --config operator.toml whoami
tl --config operator.toml topic declare work/echo
tl --config operator.toml topics --domain demo
topic declare TOPIC selects its domain from --domain, TL_DOMAIN or the
config's domain, in that order. --remove removes only the declaration,
not its tasks. Declaring a topic keeps it listed while empty; identity scopes
control access independently. topics without --domain lists all domains
granted to the identity.
Use the same operator config to inspect error topics. Worker-generated error
tasks wrap their data in an error record with original, outcome and error;
large records may contain truncated JSON text. For a retry, fix the cause and
resubmit valid original input through the requester or application profile.
move preserves the entire error record, so use it to route that record for
manual review rather than replay the original work. Replace TASK_ID with a
current ID from the task listing:
tl --config operator.toml tasks demo work/echo/error
tl --config operator.toml read demo work/echo/error TASK_ID
tl --config operator.toml move demo work/echo/error TASK_ID --to review/echo
Issue a separate scoped identity for each agent host and worker machine. For the echo example, the requester owns its replies and creates work; the worker owns work and creates replies:
tl --config service.toml identity add requester --domain demo --create work/echo --own reply/agent
tl --config service.toml identity add echo-worker --domain demo --own work/echo --create reply/agent
Save the requester's token string in requester.token and the worker's in
worker.token, each beside its client config. Keep the operator token on the
operator's machine. Once identity administration is finished, the requester
and worker do not need TL_ADMIN_TOKEN.
Upgrade from 0.5.0 to 0.6.0
Deploy the 0.6.0 service before enabling multi-topic workers. Existing
0.5.0 workers can keep polling during the rollout. Keep their tokens, queued
tasks and local Store records. A 0.6.0 worker can also use a 0.5.0 service
with a single topic.
Upgrade from 0.4.x to 0.5.0
The 0.5.0 release requires a coordinated service, worker, requester and application
profile upgrade. Drain old work and replies, stop the old processes, deploy
the new service, archive/reset old local Store directories, then upgrade all
clients and profiles before restarting workers and requesters. The package
requires a service that supplies origin_id; mixed old/new correlation
conventions on the same topics are unsupported. See the
upgrade procedure.
Request work and run an echo worker
Give the requester this requester.toml:
url = "https://YOUR_WORKER.YOUR_SUBDOMAIN.workers.dev"
domain = "demo"
agent_id = "agent"
# wait_seconds = 30 # long-poll per reply check; 0 or "off" polls immediately
[token]
file = "requester.token"
Give the worker this worker.toml; token paths are relative to their config:
url = "https://YOUR_WORKER.YOUR_SUBDOMAIN.workers.dev"
domain = "demo"
worker_label = "echo-on-this-machine"
[token]
file = "worker.token"
[worker]
topic = "work/echo"
handler = "echo"
# wait_seconds = 30 # long-poll per Own; 0 or "off" polls immediately
On macOS/Linux, set private modes after saving the configs and tokens:
chmod 600 requester.toml requester.token worker.toml worker.token
Start the worker in another terminal or on another machine:
tl --config worker.toml worker
Post a request and wait for its reply:
tl --config requester.toml request --topic work/echo --reply-topic reply/agent --data '{"message":"hello"}' --wait --timeout 1m
tl --config requester.toml inbox
The echo handler accepts a message of at most 4096 UTF-8 bytes and returns
the message; the service carries the origin onto its reply. Custom handlers are an importable
module:factory; see Writing a handler. The library's
WorkerLoop.step() also supports an externally held capacity lock;
WorkerLoop.run() acquires capacity before Own.
Gracefully stop the worker on its machine with
tl --worker echo-on-this-machine worker stop. Platform startup templates
and installation instructions are in deploy/.
API at a glance
Every operation is an authenticated JSON POST to /v1/<operation>, and the
Python tasklease.client.Client has a method for each. The
specification defines each request and response.
| Operation | What it does | Needs |
|---|---|---|
| Create | Posts a task to a topic. | create on the topic |
| Own | Leases the oldest available task across the requested topics for 1 second to 24 hours and gives it a new ID; optionally waits up to 30 seconds for one. | own on every requested topic |
| Renew | Extends the lease and keeps the ID. | own, and holding the task |
| Consume | Retires the held task and posts up to 16 successors, atomically. | own on the task's topic, create on each successor's topic |
| Delete | Removes a task: its holder's, or its creator's before anyone owned it. | the holder rule |
| Cancel | Removes the initial task by origin, including while held; stops working after its first Consume. | its creator or an operator in the domain |
| Read, Tasks List | One task, or a topic's tasks in pages. | read or own |
| Topics List, Topic Pollers | Per-topic counts, and who polled a topic recently. | read or own |
| Topic Declare | Keeps a topic listed while it is empty. | an operator identity |
| Blob Put URL, Blob Get URL | Presigned R2 URLs for payloads too large for a task. | create, or read or own, in the domain |
| Monitor Snapshot | One consistent view of a domain for the dashboard. | read or own |
| Identity Add, Revoke, Rotate, List | Manage machine tokens. | the admin token |
Writing a handler
A Linux worker can serve platform-neutral and Linux-only requests with
topics = ["verify/any", "verify/linux"] in its [worker] config, or with
tl worker --topic verify/any --topic verify/linux. One long poll covers
1–16 distinct topics and leases the oldest available task across them,
regardless of list order. The worker needs own on every listed topic, and
its handler must accept work from each of them.
You can upgrade the service while existing workers continue to send topic.
Deploy the updated service before switching a worker to topics, even for a
one-item list. A single --topic flag or a topic setting in [worker]
continues to send the single-topic request.
tl worker owns a task, calls validate,
calls run while it renews the lease, and then Consumes the task with the
successors reply returns: one reply for a request, or a pipeline's next
stages. A Rejection, an exception or too many Owns becomes a failure reply
to the task's reply_topic if it has one, and otherwise goes to the topic's
error topic for an operator. run receives a lost event that is set if the
lease is lost; long work should check it and stop.
The fetch stage of the pipeline example, in
crawl_stages.py:
from threading import Event
from tasklease.generated import protocol as p
from tasklease.worker import Rejection
class Fetch:
def validate(self, task: p.Task) -> str | Rejection:
url = task["data"].get("url")
return url if isinstance(url, str) else Rejection("url must be text")
def run(self, url: str, lost: Event) -> str:
return fetch_and_store(url, lost) # your code: returns an R2 blob key
def reply(self, task: p.Task, blob: str) -> list[p.NewTask]:
data = {"url": task["data"]["url"], "blob": blob}
return [
{"topic": "classify/content", "data": data},
{"topic": "classify/security", "data": data},
]
def fetch() -> Fetch:
return Fetch()
Run it with topic = "check/url" and handler = "crawl_stages:fetch" in the
worker's [worker] table, with the module importable by tl (for example
through PYTHONPATH). Its identity needs own on check/url and create on
classify/*; failures go to check/url/error, which own already grants.
Calling the service from code
from tasklease.client import Client
from tasklease.errors import Empty, NotFound
with Client(URL, token, "crawler-1") as client:
client.create(
{
"domain": "crawl",
"topic": "check/url",
"data": {"url": "https://example.com"},
}
)
with Client(URL, worker_token, "fetcher-1") as client:
try:
task = client.own(
{"domain": "crawl", "topic": "check/url", "hold_seconds": 600}
)["task"]
except Empty:
task = None # nothing to do; poll again later
if task is not None:
successor = {**task["data"], "blob": "<blob key>"}
try:
client.consume(
{
"domain": "crawl",
"topic": task["topic"],
"id": task["id"],
"tasks": [
{"topic": "classify/content", "data": successor},
{"topic": "classify/security", "data": successor},
],
}
)
except NotFound:
pass # the lease ran out and another worker took the task
Each error code maps to an exception in tasklease.errors, such as Empty,
NotFound and Forbidden. A worker written against the client renews long
leases itself; tl worker and tasklease.worker.WorkerLoop do it for you.
Recovery and monitoring
Successful submissions print the server's origin_id. Resume with
tl wait --origin-id ID; it checks durable local replies first.
tl cancel --origin-id ID cancels a saved initial request across Own ID
rotations. Operators or callers without a local record can use
tl cancel --domain DOMAIN --topic TOPIC --origin-id ID. Once Consume posts
successors, cancellation reports not_found and leaves those successors alone.
Submission calls Create before saving the local record. To recover a lost
response, generate one UUIDv7 with tasklease.names.new_idempotency_key() and
reuse it in Store.submit(..., idempotency_key=key) or
tl request --idempotency-key UUIDV7. For seven days from acceptance, the key
recovers the original origin even after completion or cancellation. The first
accepted request wins; changing a replay's topic or payload does not update it.
Persist the key and original arguments before submission for crash recovery.
Without a key, retrying creates a separate origin and both requests may execute.
If Create returns an ID but local saving fails,
SubmissionError.origin_id and the CLI diagnostic expose that ID for direct
inspection or cancellation. Unrelated messages and replies to uncertain
submissions remain in the inbox with matched: false and cannot take another
origin's answer slot. reply() and wait() return the first reply per origin.
Later replies with different stable content are durably archived before
acknowledgement and appear in the inbox with duplicate: true, including the
creator. Redelivery of unchanged content does not add another copy.
Worker leases default to 600 seconds, with renewal every 180 seconds. A lost
lease sets the handler's lost event; handlers should cooperate with it.
This LeaseEvent also exposes reason and revoked: server rejection sets
revoked, while local expiry does not. Cancellation is observed through Renew
or Consume, so it cannot force immediate shutdown or undo external effects.
Fenced Consume prevents stale completion, while external side effects still
need application-level idempotence. Automated workers refuse /error topics;
operators inspect those manually.
tl --config worker.toml monitor
tl --config worker.toml topics
tl --config worker.toml pollers --help
tl inbox --all
The monitor binds to 127.0.0.1, keeps the identity credential in Python,
and shows only service topics the identity may read or own. It also reads
this machine's agent stores. Requests are read-only and cached for 25 seconds.
Use --no-browser for a headless monitor and --port for a fixed local port.
--domain D selects one service domain; local records still cover every
agent on this machine.
Client configuration
tl selects a config in this order: --config PATH, then TL_CONFIG, then
platformdirs.user_config_path("tasklease")/config.toml. The usual locations,
without config-directory overrides, are:
| Platform | Default config file |
|---|---|
| macOS | ~/Library/Application Support/tasklease/config.toml |
| Linux | ~/.config/tasklease/config.toml |
| Windows | %LOCALAPPDATA%\tasklease\tasklease\config.toml |
Linux follows XDG_CONFIG_HOME when set. tl --help shows the platform fallback
path on the current machine. On each client machine, you can place its config
at that path as config.toml and its token beside it, then omit --config.
Keep explicitly named configs when using several identities on one machine;
service.toml holds deployment settings, while operator.toml,
requester.toml and worker.toml above select their respective identities.
[token] file defaults to token beside the selected config. Relative paths
are resolved against that config's directory, absolute paths are accepted,
and a leading ~ is expanded. For example, a TOML value of
file = "~/private/tasklease/operator.token" works independently of the config
location. Quote shell paths with spaces, such as
tl --config "$HOME/Library/Application Support/tasklease/config.toml" whoami.
On POSIX systems, tl refuses token files with any group or other permission
bits set. Use chmod 600 PATH_TO_TOKEN (owner-only read/write); owner-only
read access also works. On Windows, protect the file with user-restricted
ACLs; POSIX mode bits do not describe Windows access. Configs should also be
private to your user.
Configuration supports TL_URL, TL_DOMAIN, TL_AGENT_ID, TL_WORKER and
TL_TOKEN, which override file settings; --url and --worker override their
environment settings. TL_TOKEN bypasses the identity token file.
Identity administration uses environment-only TL_ADMIN_TOKEN.
Domain names . and .. are prohibited. Domains otherwise follow the grammar
in the protocol specification.
Scale guidance
Each domain is one Durable Object with one database, so a domain's requests and tasks share one object's capacity. Count tasks across all its topics, including work, replies, and errors.
Workers. An idle worker holds one 30-second Own open, so 1,000 idle
workers send about 33 requests a second to their domain. A load test against a
deployed service (below) handled 5,000 workers without errors, and a single
domain served about 1,000 requests a second, Cloudflare's documented soft
limit for one Durable Object: roughly 30,000 idle workers, less the requests
their actual work adds. An idle poll usually writes nothing, which keeps it
cheap. A held poll keeps the Durable Object resident: request counts match a
30-second short poll, so a domain already polled continuously costs the same
in compute. A worker with a longer poll_interval keeps that request
cadence, because the wait counts toward the interval, but each wait still
keeps the domain resident for up to 30 seconds; set wait_seconds = 0 to let
a deliberately cold domain sleep. One topic retains up to 10,000 waiters,
at most 1,000 of them from one identity; beyond that, Own answers empty at once (marked wait_refused) and clients
fall back to their short-poll sleep, so a larger idle fleet degrades to the old
behavior rather than growing the object without bound.
Workers with their own tokens added about 65 ms per request compared with shared tokens: each Worker instance caches a token's identity for a minute, and with many tokens most requests miss that cache and ask the shared identity registry. Split independent workloads into separate domains to add capacity.
Tasks. On a paid Workers plan, with task payloads around 1–16 KiB, 10,000–100,000 outstanding tasks per domain is a reasonable initial planning range. This estimate comes from local SQLite benchmarks.
A million tasks can form a backlog, but calls that scan many held tasks or count every task take longer and share the domain's capacity with other requests. Measure those calls under load before adopting that scale. Keep large outputs in R2 and budget task storage: one million 16 KiB payloads alone exceed the paid plan's 10 GB storage limit per Durable Object. Use separate domains for independent workloads; Consume operates within one domain.
The benchmark reads the service's schema and SQL. These p95 query times used 1 KiB payloads, one topic, 31 measured runs after warmup, and a 64 MiB SQLite page cache on a local Linux machine with SQLite 3.37.2. The 1 KiB results and 16 KiB results record the measurements and method. Service latency and throughput require measurements in your deployment; the benchmark excludes HTTP, authentication, concurrent requests, and replicated durability.
| Tasks in the domain | Claim lookup after 32 held tasks | Poll with all tasks held | Topic counts |
|---|---|---|---|
| 10,000 | 0.015 ms | 0.58 ms | 1.2 ms |
| 100,000 | 0.007 ms | 5.3 ms | 11 ms |
| 1,000,000 | 0.007 ms | 70 ms | 121 ms |
Both benchmark programs are preserved under scripts/. Run the workload
benchmark against the current service schema, or compare index choices and
topic aggregation with bench_queue_indexes.py:
python3 scripts/bench_queue.py --output /tmp/tasklease-queue.json
python3 scripts/bench_queue_indexes.py --output /tmp/tasklease-indexes.json
Each creates and removes temporary databases, then writes a JSON report.
Use --sizes 10000 --samples 15 for a shorter run. The comparison program
also offers --maintained-totals to measure an experimental counter query;
that option excludes the cost of maintaining the counters.
Load test
load_pollers.py simulates workers against a deployed service: each worker polls one topic with Own at the real worker's jittered interval, and a producer creates tasks that workers own, hold for two seconds and consume. These runs used the acceptance deployment from one Linux client on 2026-11-08 and 2026-11-09; latency is measured at the client and includes about 45 ms of network path. The results record each run.
| Simulated load | Requests/s | Own p50 / p95 / p99 | Errors |
|---|---|---|---|
| 1,000 workers, 10 shared tokens, 30 s polls | 39 | 45 / 72 / 129 ms | 0 |
| 5,000 workers, own tokens, 30 s polls | 181 | 111 / 165 / 253 ms | 0 |
| 1,000 workers, 10 shared tokens, 3 s polls | 347 | 68 / 177 / 314 ms | 0 |
| 1,000 workers, 10 shared tokens, 0.5 s polls | 1,012 (of ~2,040 offered) | 480 / 775 / 1,038 ms | 0 |
The last row is the domain's ceiling: requests queued rather than failed, and a probe on another topic of the same domain, timed from a separate process, waited 117 ms at the median and 728 ms at p95. The first and third rows predate the change that stopped idle polls from writing; then a domain queued from about 550 requests a second, and the results file records both.
Long-polling was measured the same way on 2026-11-12, from one macOS client against service 0.4.0; the results record each run. Pickup is the time from sending a Create to the claim reaching a worker.
| Simulated load | Requests/s | Pickup p50 / p95 / p99 |
|---|---|---|
| 5 workers, 30 s polls, no wait | 0.46 | 3,568 / 10,766 / 11,979 ms |
| 5 workers, 30 s polls, 30 s wait | 0.37 | 266 / 773 / 1,947 ms |
| 1,000 workers, 30 s polls, no wait | 39.1 | 102 / 203 / 322 ms |
| 1,000 workers, 30 s polls, 30 s wait | 37.7 | 87 / 169 / 228 ms |
A small fleet gains the most: a new task no longer waits for the next poll. A large fleet already polls often enough to find it quickly, and the wait leaves its request rate about the same. The 1,000-worker rates are steady state, without the first 30 s, in which a held poll has not yet answered; the 5-worker rates cover the whole run. One 1,000-worker waiting run saw 49 held polls (0.7%) end in a connection error at the client and its repeat saw one; the Worker logged no failure, and no task was lost. Redeploying the same bundle during 200 held waits interrupted none of them; a code change, which resets the Durable Object, was not measured.
TL_ADMIN_TOKEN=... uv run --project python python scripts/load_pollers.py \
--url https://YOUR_WORKER.YOUR_SUBDOMAIN.workers.dev --workers 1000 \
--poll-seconds 30 --duration 240 --processes 2 --output /tmp/load.json
Unset HTTPS_PROXY unless the client needs a proxy: a local proxy adds its
own latency and connection handling to every measurement. Run it only
against a test deployment: requests are billed, and the domain
keeps the test's poller and statistics rows until they expire. One client
process sustains about 100 requests a second; use --processes for more.
Reference and acceptance
- Specification and implementation design.
- Phase checklist and review evidence.
- Local release/native acceptance and Windows agent prompt.
- Schema contract, generated SDK DTOs and shared examples.
FluxShot-specific profiles and workers belong in the FluxShot repository: tasklease profiles.
Metadata
Release files for tasklease 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tasklease-0.6.0.tar.gz | 419.1 kB | With provenance | Details for tasklease-0.6.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tasklease-0.6.0-py3-none-any.whl | Python 3 | none | any | Details for tasklease-0.6.0-py3-none-any.whl |
Total release size: 699.8 kB
Release files / tasklease-0.6.0.tar.gz
| Download URL | tasklease-0.6.0.tar.gz |
|---|---|
| Size | 419.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4d6e5bdcb9f8a24e82ed276305d418b9bbbfa9f25e0ae3c11a4998009418c65d
|
|
BLAKE2b-256 checksum How to use checksums |
edf2743200c0a44de1bdbaef3d5bee4bb302d81476c70f07483ff4375b555649
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logRelease files / tasklease-0.6.0-py3-none-any.whl
| Download URL | tasklease-0.6.0-py3-none-any.whl |
|---|---|
| Size | 280.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
76533b90a0b4e396c689239494b892c399d8bf4eb27b50acd9746908fc1ad37a
|
|
BLAKE2b-256 checksum How to use checksums |
092f56d2403c9898eb3f2f0ecebcf95806ad3536c145f39e7f45042bb49d1a88
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logSecurity for tasklease 0.6.0
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for tasklease-0.6.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logA 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.