ViteHub is still experimental. Expect bugs and breaking changes.

Schedule

Declare Agent Schedules or expose Runtime Schedule tools to an Agent.

schedule() covers two schedule-related Agent abilities. It can declare fixed Agent Schedules as Capability metadata, or it can expose Runtime Schedule read and edit tools when configured with a mode.

Installation

Import the Capability factory from -hub/agent/capabilities and add it to defineAgent({ capabilities }). Use the configuration example below as the starting point, then tighten modes, policies, stores, and providers for the Agent boundary.

What it adds

Static Agent Schedule mode records one or more five-field UTC cron expressions on the Capability. Runtime Schedule mode contributes schedule_read and, in write mode, schedule_edit.

Configuration

Use static schedules when the Agent should run on known cron entries. ViteHub derives a stable id from the cron expression when you do not provide one.

server/agents/support.ts
import { defineAgent } from '@vite-hub/agent'
import { schedule } from '@vite-hub/agent/capabilities'

export default defineAgent({
  driver: { model },
  capabilities: [
    schedule({
      schedules: ['0 9 * * 1'],
    }),
  ],
})

Runtime behavior

Static schedules add metadata that framework integrations and schedule-aware runtime behavior can inspect. Runtime Schedule mode reads visible Runtime Schedules and can create, update, enable, disable, or delete scoped schedules when write mode is enabled.

Requirements

Static schedules require at least one five-field UTC cron expression. Runtime Schedule mode requires a configured schedule primitive.

Runtime Schedule edits require write mode and approval by default. Self-targeting requires explicit self-target permission.

Driver support

Agent DriverSupport
Model-backedReceives Runtime Schedule tools when mode is configured; static schedules are runtime metadata.
Harness-backedRuntime metadata and requirements apply; model-facing schedule tools are not passed by default.
Custom-run-backedReceives prepared metadata and context; driver.run decides how to use schedule context.

Inspect and verify

Inspect Capability metadata for static schedule ids and cron expressions. For Runtime Schedule mode, inspect the tool list and verify schedule_edit appears only in write mode.

Run a schedule with a six-field cron expression during development. The Capability should reject it before the Agent starts.

Options

OptionTypeDefaultDescription
schedulesArray<string | { cron: string; id?: string }>required for Agent SchedulesDeclares fixed five-field UTC Agent Schedules.
mode"read" | "write"required for Runtime Schedule toolsSelects read or write Runtime Schedule tools.
targetsstring[]all visible targetsAllowlist of Runtime Schedule target names.
selfTargetstringnoneTarget name of the owning Agent.
allowSelfTargetbooleanfalseAllows Runtime Schedule tools to target the owning Agent.
policyAgentToolPolicyDecision | function"require-approval"Policy for schedule_edit.

Reference

Copyright © 2026