Skip to content

refactor(agents): extract schedules into agents/schedules#1897

Draft
mattzcarey wants to merge 1 commit into
feat/standardise-agent-lifecyclefrom
refactor/extract-agent-schedules
Draft

refactor(agents): extract schedules into agents/schedules#1897
mattzcarey wants to merge 1 commit into
feat/standardise-agent-lifecyclefrom
refactor/extract-agent-schedules

Conversation

@mattzcarey

Copy link
Copy Markdown
Contributor

Stack

Summary

  • Add an Agent-owned AgentScheduler component and publish it from agents/schedules.
  • Move schedule schema migration, CRUD, retries, callback execution, observability, facet ownership, and cleanup out of the base Agent.
  • Keep the single physical Durable Object alarm in Agent, where it is still arbitrated with destroy, keep-alive, fiber recovery, facet runs, and timers.
  • Keep Agent.schedule, scheduleEvery, get/list, and cancellation methods as compatible delegators.
  • Move natural-language scheduling helpers to agents/schedules; retain agents/schedule as a deprecated compatibility re-export.

Behavior preserved

  • one-shot, cron, and interval semantics
  • idempotent schedule creation
  • callback retry and transient platform deferral
  • alarm memory-limit circuit breaking
  • stale duplicate warnings and hung interval recovery
  • sub-agent owner paths and root alarm routing
  • schema migration and explicit destroy cleanup

Scope

This does not extract queues, fibers, workflows, keep-alive, timers, or physical alarm arbitration.

Verification

  • pnpm run build
  • pnpm run check
  • focused Workers suites: 302 tests across scheduling, migration, alarms, retries, keep-alive, destroy, and sub-agents
  • lifecycle component tests: 9 tests
  • CI=true pnpm exec nx affected -t test
    • Agents: 2,245 tests
    • AI Chat: 728 tests
    • Think: 974 tests across Workers/generated-entry/Vite/CLI/React suites
    • affected Voice, recovery, and example suites also passed

@changeset-bot

changeset-bot Bot commented Jul 8, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: dc270cc

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
agents Minor
@cloudflare/agent-think Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Jul 8, 2026

Copy link
Copy Markdown

Open in StackBlitz

agents

npm i https://pkg.pr.new/agents@1897

@cloudflare/ai-chat

npm i https://pkg.pr.new/@cloudflare/ai-chat@1897

@cloudflare/codemode

npm i https://pkg.pr.new/@cloudflare/codemode@1897

create-think

npm i https://pkg.pr.new/create-think@1897

hono-agents

npm i https://pkg.pr.new/hono-agents@1897

@cloudflare/shell

npm i https://pkg.pr.new/@cloudflare/shell@1897

@cloudflare/think

npm i https://pkg.pr.new/@cloudflare/think@1897

@cloudflare/voice

npm i https://pkg.pr.new/@cloudflare/voice@1897

@cloudflare/worker-bundler

npm i https://pkg.pr.new/@cloudflare/worker-bundler@1897

commit: dc270cc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant