Agents: expand cron tool description (#1988)
Co-authored-by: Tomas Cupr <tomascupr@users.noreply.github.com>
This commit is contained in:
@@ -8,6 +8,7 @@ Status: unreleased.
|
|||||||
### Changes
|
### Changes
|
||||||
- Doctor: warn on gateway exposure without auth. (#2016) Thanks @Alex-Alaniz.
|
- Doctor: warn on gateway exposure without auth. (#2016) Thanks @Alex-Alaniz.
|
||||||
- Docs: add Vercel AI Gateway to providers sidebar. (#1901) Thanks @jerilynzheng.
|
- Docs: add Vercel AI Gateway to providers sidebar. (#1901) Thanks @jerilynzheng.
|
||||||
|
- Agents: expand cron tool description with full schema docs. (#1988) Thanks @tomascupr.
|
||||||
|
|
||||||
## 2026.1.24-3
|
## 2026.1.24-3
|
||||||
|
|
||||||
|
|||||||
@@ -133,8 +133,50 @@ export function createCronTool(opts?: CronToolOptions): AnyAgentTool {
|
|||||||
return {
|
return {
|
||||||
label: "Cron",
|
label: "Cron",
|
||||||
name: "cron",
|
name: "cron",
|
||||||
description:
|
description: `Manage Gateway cron jobs (status/list/add/update/remove/run/runs) and send wake events.
|
||||||
"Manage Gateway cron jobs (status/list/add/update/remove/run/runs) and send wake events. Use `jobId` as the canonical identifier; `id` is accepted for compatibility. Use `contextMessages` (0-10) to add previous messages as context to the job text.",
|
|
||||||
|
ACTIONS:
|
||||||
|
- status: Check cron scheduler status
|
||||||
|
- list: List jobs (use includeDisabled:true to include disabled)
|
||||||
|
- add: Create job (requires job object, see schema below)
|
||||||
|
- update: Modify job (requires jobId + patch object)
|
||||||
|
- remove: Delete job (requires jobId)
|
||||||
|
- run: Trigger job immediately (requires jobId)
|
||||||
|
- runs: Get job run history (requires jobId)
|
||||||
|
- wake: Send wake event (requires text, optional mode)
|
||||||
|
|
||||||
|
JOB SCHEMA (for add action):
|
||||||
|
{
|
||||||
|
"name": "string (optional)",
|
||||||
|
"schedule": { ... }, // Required: when to run
|
||||||
|
"payload": { ... }, // Required: what to execute
|
||||||
|
"sessionTarget": "main" | "isolated", // Required
|
||||||
|
"enabled": true | false // Optional, default true
|
||||||
|
}
|
||||||
|
|
||||||
|
SCHEDULE TYPES (schedule.kind):
|
||||||
|
- "at": One-shot at absolute time
|
||||||
|
{ "kind": "at", "atMs": <unix-ms-timestamp> }
|
||||||
|
- "every": Recurring interval
|
||||||
|
{ "kind": "every", "everyMs": <interval-ms>, "anchorMs": <optional-start-ms> }
|
||||||
|
- "cron": Cron expression
|
||||||
|
{ "kind": "cron", "expr": "<cron-expression>", "tz": "<optional-timezone>" }
|
||||||
|
|
||||||
|
PAYLOAD TYPES (payload.kind):
|
||||||
|
- "systemEvent": Injects text as system event into session
|
||||||
|
{ "kind": "systemEvent", "text": "<message>" }
|
||||||
|
- "agentTurn": Runs agent with message (isolated sessions only)
|
||||||
|
{ "kind": "agentTurn", "message": "<prompt>", "model": "<optional>", "thinking": "<optional>", "timeoutSeconds": <optional>, "deliver": <optional-bool>, "channel": "<optional>", "to": "<optional>", "bestEffortDeliver": <optional-bool> }
|
||||||
|
|
||||||
|
CRITICAL CONSTRAINTS:
|
||||||
|
- sessionTarget="main" REQUIRES payload.kind="systemEvent"
|
||||||
|
- sessionTarget="isolated" REQUIRES payload.kind="agentTurn"
|
||||||
|
|
||||||
|
WAKE MODES (for wake action):
|
||||||
|
- "next-heartbeat" (default): Wake on next heartbeat
|
||||||
|
- "now": Wake immediately
|
||||||
|
|
||||||
|
Use jobId as the canonical identifier; id is accepted for compatibility. Use contextMessages (0-10) to add previous messages as context to the job text.`,
|
||||||
parameters: CronToolSchema,
|
parameters: CronToolSchema,
|
||||||
execute: async (_toolCallId, args) => {
|
execute: async (_toolCallId, args) => {
|
||||||
const params = args as Record<string, unknown>;
|
const params = args as Record<string, unknown>;
|
||||||
|
|||||||
Reference in New Issue
Block a user