Multi-Agent Task Scheduling: Dependencies, Leases, and Fairness
Design multi-agent task scheduling with validated dependencies, renewable ownership, enforced fencing, bounded capacity, and measurable fairness across tenants.
Abhishek Raj · · 8 min read
Prepared with AI research assistance. Sources are linked throughout; worked examples are illustrative unless stated otherwise. Editorial approach.
A multi-agent scheduler decides which work may start, which worker currently owns it, and when its output becomes available to other tasks. The agent's reasoning loop sits inside that execution contract. A model can propose a useful decomposition, but application code must enforce dependencies, resource limits, ownership, and completion rules.
This guide develops a hypothetical document-review service with parallel extraction agents and a reconciliation step. The scheduler fields, policies, and numerical examples are illustrative designs, not a benchmark or a tested scheduler implementation.
Schedule artifacts and dependencies, not role names
Represent a task as a bounded operation that produces an inspectable artifact. “Finance specialist” is a role; “extract invoice totals from document version 8 with page references” is a schedulable task. Include its input versions, required capabilities, expected output schema, deadline, and acceptance conditions.
Apache Airflow's documentation separates task dependencies from the work inside tasks: its workflow model describes execution order and conditions without needing to understand each task's internal computation. That distinction is useful for agent platforms even when Airflow is not the chosen runtime. Airflow Dag concepts.
In the proposed service, contract extraction and invoice extraction are independent. Reconciliation requires both accepted artifacts. The scheduler should release reconciliation only after the required output versions have been committed, rather than after receiving two chat messages that claim completion.
Validate the task graph before admission. Reject missing dependency identifiers, cycles, contradictory requirements, and joins without an explicit completion policy. If the model discovers new work, record a versioned graph amendment and validate it before dispatch. A bounded retry is another attempt of the same logical task; it should not create an uncontrolled cycle in the dependency graph.
Separate readiness, eligibility, and selection
Three different questions determine dispatch:
| Question | Proposed decision rule | Example reason to wait |
|---|---|---|
| Ready? | Required upstream artifacts are accepted | Invoice extraction is incomplete |
| Eligible? | Authority, deadline, budget, and capabilities permit execution | Browser capacity is exhausted |
| Selected? | Scheduling policy chooses this task now | Another tenant receives its fair turn |
A task can be ready but ineligible. Repeatedly selecting it and immediately receiving rate-limit errors wastes scheduler and model capacity. Keep the blocking reason visible and wake the task when the relevant condition changes.
Resource requests should describe the actual scarce capacities: model concurrency, token allowance, browser sessions, accelerator memory, or a downstream API's limit. Reserve a consistent resource vector before dispatch and release or settle it after the attempt. A global worker count alone cannot protect a shared API used by several worker pools.
Keep admission control separate from ordering. Priority answers which eligible task goes first; it does not authorize the task to exceed a spending limit. See agent rate limits and backpressure for the overload boundary.
Make a claim a renewable, versioned grant
For the illustrative scheduler, store task status, logical task identity, attempt identifier, current owner, ownership epoch, lease expiry, input versions, and committed output reference. Claim a task through an atomic conditional transition from an eligible state. The transition increments its ownership epoch and reserves capacity, or fails without granting ownership.
A lease lets abandoned work become eligible for reassignment. Kubernetes documents Lease objects as coordination records used for heartbeats and leader election, including renewal timestamps. That establishes a practical lease pattern, not a guarantee that a Lease object automatically protects an application's external effects. Kubernetes Leases.
Use the scheduler's authoritative time and persistence semantics for lease decisions. Workers should renew with their task identity, owner identity, and epoch; a delayed renewal from a previous owner must fail. Heartbeats indicate that a process is communicating, not that its reasoning is making progress. Track a separate bounded progress signal and absolute task deadline.
A successful completion should conditionally verify the current epoch and accepted input versions while committing its output pointer. Otherwise an old worker can finish late and replace an artifact produced by its replacement. Persisting an artifact blob separately is acceptable if the authoritative pointer is committed conditionally and unreferenced blobs are cleaned up later.
Fence stale workers where effects occur
Lease expiry does not stop a paused process. It can resume believing that it still owns the task. Martin Kleppmann's analysis explains why checking expiry immediately before a write is insufficient and describes increasing fencing tokens that the protected resource enforces. The receiving service, rather than the worker's good intentions, must reject stale authority. Distributed locking and fencing.
For the proposed design, use the ownership epoch to reject stale scheduler updates. External mutations need an additional enforced contract. An action service can atomically validate a current grant when accepting an operation, or maintain a protected fencing generation advanced through a coordinated handover. Merely attaching an integer to a request does nothing if the recipient ignores it.
Token scope matters. Epoch 9 for task A cannot be compared with epoch 4 for unrelated task B to decide which may change a shared order. Use a resource-specific version or an action authority that understands both the task grant and the protected business object.
Fencing also cannot undo an action already accepted before revocation. Preserve a stable logical action identity across retries, record its result, and reconcile uncertain outcomes. Scheduling ownership and idempotency for agent actions solve related but different problems.
Define fairness in units you can observe
A single FIFO queue can let one tenant's burst occupy the backlog. Strict priority can leave a lower tier waiting indefinitely during sustained high-priority traffic. Choose an explicit service objective: bounded waiting, weighted shares, reserved capacity, or a documented best-effort batch tier.
Temporal documents priority ordering combined with weighted fairness keys within a priority level. Its guarantees are scoped to task-queue partitions, and fairness concerns dispatch rather than work already executing. Those qualifications are important when interpreting any platform's fairness feature. Temporal priority and fairness.
For this illustrative scheduler, start with separate urgency classes and weighted round-robin selection across tenants within a class. Permit idle share borrowing, but cap each tenant's in-flight work so a returning tenant can obtain service. If tasks have substantially different durations, equal numbers of starts will not imply equal resource consumption. Charge estimated work at admission, reconcile actual usage, and review estimation errors rather than trusting a model-generated cost prediction.
Avoid fetching a large private backlog into each worker. RabbitMQ's prefetch documentation describes limiting unacknowledged deliveries and notes its per-consumer semantics. The general scheduling concern is that work already held by a busy consumer is less available for reassignment or fair dispatch. RabbitMQ consumer prefetch.
Walk through a hypothetical tenant burst and expired claim
Assume four interchangeable extraction slots. Tenant A submits 100 ready documents; tenant B submits two. With equal tenant weights and short comparable tasks, alternating eligible dispatches while both tenants have backlog gives B opportunities without requiring A's entire queue to drain. Once B has no remaining work, A may borrow the idle share. These are proposed policy outcomes, not exact wall-clock guarantees.
Now A's invoice task is owned by worker W1 at epoch 11. W1 pauses long enough for its lease to expire. The scheduler reclaims the task and assigns W2 epoch 12. W2 extracts the required evidence and commits an accepted artifact under epoch 12.
When W1 resumes, its renewal and completion writes fail their epoch checks. Its duplicate artifact may be retained briefly for debugging, but cannot replace the canonical pointer. Reconciliation consumes the accepted epoch-12 artifact and the matching contract version.
If W1 had started an external mutation before pausing, the scheduler cannot infer its outcome from lease expiry. The action ledger must determine whether that operation was accepted. Reassignment should not manufacture a new action identity and repeat an uncertain effect.
Test schedules that violate convenient assumptions
Validate the scheduler as a state machine under adversarial event ordering. Delay renewals, duplicate queue notifications, crash immediately after claiming, expire a lease during a long model request, and deliver an old completion after its replacement commits.
Check invariants: one current ownership grant per task, no downstream release before accepted dependencies, no resource reservation leaked after terminal recovery, and no stale attempt able to alter the canonical artifact. For mutations, inspect actual external effects in addition to task states.
Measure queue wait separately from execution duration. Break both down by tenant, urgency class, resource type, and outcome. A low global average can hide a small tenant's starvation. Re-run overload tests with mixed task lengths and an unavailable dependency; a scheduler that behaves well only with uniform successful jobs has not demonstrated useful fairness.
Frequently asked questions
Does a task lease guarantee exactly-once execution?
No. Reassignment can overlap with a stale worker. Conditional completion, recipient-enforced authority, stable action identities, and reconciliation are needed to control the resulting effects.
Should the model choose task priority?
It can suggest urgency with evidence. Application policy should validate that suggestion against trusted deadlines and tenant entitlements; arbitrary prompt text should not grant a higher service tier.
Can a DAG support an agent that discovers new tasks?
Yes, through controlled graph amendments or bounded subworkflows. Persist and validate newly proposed dependencies, preserve input provenance, and enforce run-level resource limits before scheduling them.
Source reference list
Related reading
- AI Agent Rate Limits: Backpressure and Admission Control
Control AI agent overload with request and token budgets, bounded queues, fair scheduling, and admission rules that protect useful task completion.
- Idempotency for AI Agent Actions: Preventing Duplicate Side Effects
Prevent duplicate AI agent actions with stable intent identities, immutable request fingerprints, durable ledgers, and recovery for uncertain outcomes.
- Agent Handoffs: Shared State, Ownership, and Context Contracts
Design agent handoffs with versioned context packets, explicit ownership, stale-worker fencing, and evidence provenance across specialist workflows.