Scheduler examples
Run leased, idempotent Lucid HTTP-profile calls on recurring schedules.
The scheduler is an application-level worker around Lucid's Agent Card and
HTTP entrypoint client. The package namespace is a2a, but these calls are not
the official A2A v1 binding. A hire describes the target and schedule; a
SchedulerStore coordinates leases, attempts, and the next run time.
Use the repository sources as the executable reference:
hello-interval.tsruns one recurring paid service call.double-hire.tsruns independent schedules against multiple services.
PAYMENTS_FACILITATOR_URL=https://YOUR_FACILITATOR_URL \
PAYMENTS_RECEIVABLE_ADDRESS=0xYOUR_ADDRESS \
PAYMENTS_NETWORK=eip155:84532 \
AGENT_WALLET_PRIVATE_KEY=0xYOUR_PRIVATE_KEY \
bun run packages/examples/src/scheduler/hello-interval.tsThe scheduler package is a Next surface. Do not add it to a Stable project until its public npm version is listed as Stable in the release channels.
Runtime shape
const scheduler = createSchedulerRuntime({
runtime: buyerRuntime,
store,
});
await scheduler.createHire({
agentCardUrl: 'https://seller.example',
entrypointKey: 'report',
schedule: { kind: 'interval', everyMs: 60_000 },
jobInput: { topic: 'markets' },
});
const worker = createSchedulerWorker(scheduler, 1_000);
await scheduler.recoverExpiredLeases();
worker.start();The runtime obtains card discovery from buyerRuntime.a2a and a payment-aware
Fetch from buyerRuntime.payments; paymentContext and fetchAgentCard are
not current constructor options.
Production requirements
- Implement and inject a durable
SchedulerStore; the package currently ships onlycreateMemoryStore()and does not include SQLite or Postgres stores. - Run multiple workers only with a store that provides atomic leases.
- Set attempt timeouts and retry limits for the target's fulfillment profile.
- Give every invocation a stable idempotency key so a recovered lease cannot produce duplicate work or charges.
- Record both scheduler job IDs and payment records for reconciliation.
A database name in an application architecture does not make it a supported
scheduler backend. The custom store must implement every SchedulerStore
method, atomic claimJob(), expired-lease recovery, persistence before
acknowledgement, and safe concurrent updates.
See Schedule calls for the task guide and
@lucid-agents/scheduler for the API boundary.