Self-improving AI Employees for everyone
Python ai-agentsai-employeeai-employeesassistantautonomous-agentsco-employeescompanygrok-botinstinctloop-agentsmuseown-your-datapersonalself-hosted
docs(timer): the Timer says its real limits (1b.8)
trohitgb7a575bef288
diff --git a/docs-internal/node-logic-flows/workflow_triggers/timer.md b/docs-internal/node-logic-flows/workflow_triggers/timer.mdindex 9402f91d..98543bdc 100644--- a/docs-internal/node-logic-flows/workflow_triggers/timer.md+++ b/docs-internal/node-logic-flows/workflow_triggers/timer.md@@ -5,7 +5,7 @@| **Category** | workflow / utility / tool (dual-purpose) || **Backend handler** | Plugin [`server/nodes/scheduler/timer/__init__.py`](../../../server/nodes/scheduler/timer/__init__.py) (`TimerNode`); dispatch via `BaseNode.execute()` + the `@Operation("wait")` method. || **Tests** | [`server/tests/nodes/test_workflow_triggers.py`](../../../server/tests/nodes/test_workflow_triggers.py) |-| **Skill (if any)** | none |+| **Skill (if any)** | [`timer-skill`](../../../server/skills/task_agent/timer-skill/SKILL.md) || **Dual-purpose tool** | yes - exposed on the `tool` output handle so AI agents can invoke it |## Purpose@@ -27,7 +27,7 @@ of next-run; it simply pauses the branch of the workflow it is on for| Name | Type | Default | Required | displayOptions.show | Description ||------|------|---------|----------|---------------------|-------------|| `duration` | number | `1` | yes | - | How long to wait. Pydantic-validated `ge=1, le=86400`. |-| `unit` | options | `seconds` | no | - | One of `seconds` / `minutes` / `hours`. Unknown values are treated as `seconds`. |+| `unit` | options | `seconds` | no | - | One of `seconds` / `minutes` / `hours`; validation refuses any other value. |## Outputs (handles)@@ -74,8 +74,8 @@ flowchart TD## Decision Logic- **Unit mapping**: `seconds` / `minutes` / `hours` multiply duration by- 1 / 60 / 3600. Any other value falls through to the `_` match case and is- treated as raw seconds.+ 1 / 60 / 3600. The `_` match case (raw seconds) is unreachable, since+ `Params` validation refuses any other unit.- **Explicit cancellation**: `asyncio.CancelledError` propagates. In aTemporal activity it stays a cancel (a worker shutdown retries the wait,which is safe to repeat); in process `NodeExecutor` answers `Cancelled`.@@ -112,18 +112,23 @@ count; this user-requested delay is admitted node work. See## Edge cases & known limits-- Only three unit strings are supported - anything else is silently treated- as raw seconds. There is no surfaced validation error.-- `duration` is Pydantic-validated `ge=1, le=86400`; for `hours` that is up- to 86400 hours, so a large value with `unit=hours` can sleep effectively- indefinitely.+- Only three unit strings are accepted: `unit` is a `Literal`, so `Params`+ validation refuses any other (there is no `days`).+- `duration` is Pydantic-validated `ge=1, le=86400`, but the Activity's+ timeouts bound a wait first:+ - **As a tool call**, one attempt lasts at most the Timer's declared+ `start_to_close_timeout`, the 10-minute action default, so a wait longer+ than about 9 minutes times out. The tool description says so.+ - **As a graph node**, one attempt can last up to the 24-hour graph ceiling.+ - Either way, there are three attempts, and each waits the full duration+ again: a worker restart starts the wait from the beginning.+- The call blocks: an agent waiting on it does nothing else meanwhile.- Cancellation (`asyncio.CancelledError`) propagates as a cancel, sodownstream nodes do not execute when the timer is cancelled.## Related-- **Skills using this as a tool**: `timer` is exposed on the `tool` handle- but there is no dedicated SKILL.md file.+- **Skills using this as a tool**: [`timer-skill`](../../../server/skills/task_agent/timer-skill/SKILL.md).- **Sibling triggers**: [`cronScheduler`](./cronScheduler.md) for recurringschedules; [`start`](./start.md) for manual entry.- **Architecture docs**: [Execution Engine Design](../../DESIGN.md)diff --git a/server/nodes/scheduler/timer/__init__.py b/server/nodes/scheduler/timer/__init__.pyindex f25f190a..c3b950cf 100644--- a/server/nodes/scheduler/timer/__init__.py+++ b/server/nodes/scheduler/timer/__init__.py@@ -35,7 +35,10 @@ class TimerNode(ActionNode):description = "Timer-based trigger with configurable delay"component_kind = "square" # has input handletool_name = "timer"- tool_description = "Wait/sleep for a specified duration. Specify duration (1-3600) and unit (seconds, minutes, or hours). Returns timestamp and elapsed time after waiting."+ tool_description = (+ "Wait/sleep for a specified duration, then return the timestamp and elapsed time. Specify duration and unit "+ "(seconds, minutes, or hours). The call blocks while it waits, and a wait longer than about 9 minutes times out."+ )handles = ({"name": "input-main", "kind": "input", "position": "left", "label": "Input", "role": "main"},{"name": "output-main", "kind": "output", "position": "right", "label": "Output", "role": "main"},diff --git a/server/skills/task_agent/timer-skill/SKILL.md b/server/skills/task_agent/timer-skill/SKILL.mdindex 90b420b5..340a6e47 100644--- a/server/skills/task_agent/timer-skill/SKILL.md+++ b/server/skills/task_agent/timer-skill/SKILL.md@@ -1,6 +1,6 @@---name: timer-skill-description: Set one-time delayed timers. Execute actions after a specified duration (seconds, minutes, hours, days).+description: Wait for a short delay (seconds, or a few minutes) before the next step. The call blocks while it waits, and a wait longer than about 9 minutes times out.allowed-tools: timermetadata:author: opencompany@@ -11,31 +11,28 @@ metadata:# Timer Tool-Set one-time delayed execution timers.+Wait for a short, fixed delay before the next step.## How It Works-This skill provides instructions for the **Timer** tool node. Connect the **Timer** node to Zeenie's `input-tools` handle to enable timed delays.+This skill provides instructions for the **Timer** tool node. Connect the **Timer** node to Zeenie's `input-tools` handle to let the agent pause.-## timer Tool+The call **blocks**: the agent waits until the timer finishes and does nothing else meanwhile. It is not a reminder or a scheduler, and nothing fires later.-Create a one-time timer that triggers after a specified duration.+## timer Tool### Schema Fields| Field | Type | Required | Description ||-------|------|----------|-------------|-| duration | number | Yes | Time value for the delay |-| unit | string | Yes | Time unit: `"seconds"`, `"minutes"`, `"hours"`, `"days"` |+| duration | number | Yes | How long to wait (1 or more) |+| unit | string | No | `"seconds"` (the default), `"minutes"` or `"hours"` |-### Time Units+### Limits-| Unit | Range | Use Case |-|------|-------|----------|-| `seconds` | 1-3600 | Short delays, testing |-| `minutes` | 1-1440 | Task reminders, short waits |-| `hours` | 1-168 | Scheduled checks, delayed notifications |-| `days` | 1-30 | Long-term reminders, follow-ups |+- A wait as a tool call can last **at most about 9 minutes**. A longer one times out, and the call fails.+- If the worker restarts during a wait, the wait starts again from the beginning.+- There is no `days` unit. For a delay of hours or days, or anything that repeats, use a schedule (the Cron Scheduler node) instead.### Examples@@ -47,7 +44,7 @@ Create a one-time timer that triggers after a specified duration.}```-**5 minute reminder:**+**5 minute pause between checks:**```json{"duration": 5,@@ -55,52 +52,15 @@ Create a one-time timer that triggers after a specified duration.}```-**1 hour delay:**-```json-{- "duration": 1,- "unit": "hours"-}-```--**2 day follow-up:**-```json-{- "duration": 2,- "unit": "days"-}-```-### Response Format-**Timer set:**```json{- "success": true,- "message": "Timer set for 5 minutes",+ "timestamp": "2026-10-27T12:05:00",+ "elapsed_ms": 300012,"duration": 5,"unit": "minutes",- "duration_seconds": 300,- "trigger_at": "2025-01-30T12:05:00Z"-}-```--**Timer triggered:**-```json-{- "success": true,- "triggered": true,- "message": "Timer completed after 5 minutes",- "duration": 5,- "unit": "minutes"-}-```--### Error Response--```json-{- "error": "Duration must be a positive number"+ "message": "Timer completed after 5 minutes"}```@@ -109,59 +69,20 @@ Create a one-time timer that triggers after a specified duration.| Use Case | Duration | Unit | Description ||----------|----------|------|-------------|| Quick test | 10-30 | seconds | Testing workflow execution |-| Reminder | 5-30 | minutes | Short-term reminders || Rate limit | 60 | seconds | Wait between API calls |-| Daily check | 24 | hours | Daily automation |-| Follow-up | 2-7 | days | Long-term follow-ups |--## Common Workflows--### Delayed notification+| Short pause | 1-5 | minutes | Give something time before checking again |-1. Receive user request for reminder-2. Set timer with requested duration-3. Timer triggers → send notification+## As a workflow node-### Rate-limited API calls--1. Make API call-2. Set 60-second timer-3. Timer triggers → make next call--### Scheduled workflow--1. Set timer for desired delay-2. Timer triggers → execute workflow nodes--## Integration with Workflow--When used as a trigger node in a workflow:-1. Deploy the workflow-2. Timer countdown begins-3. After duration, downstream nodes execute--When used as AI tool:-1. Agent decides to set timer-2. Timer is scheduled-3. Agent can proceed with other work-4. Notification when timer triggers+On the canvas, the Timer pauses its branch: it waits for the duration, then the nodes after it run. As a graph node, one wait can last up to 24 hours, and a worker restart starts it again from the beginning.## Best Practices-1. **Use appropriate units**: Don't use 3600 seconds when 1 hour is clearer-2. **Consider time zones**: Timers use server time-3. **Account for drift**: Long timers may have slight variance-4. **Test short first**: Start with seconds before days-5. **Chain timers carefully**: Avoid infinite loops--## Limitations--- Timers are not persistent across server restarts-- Maximum practical delay depends on server uptime-- Timers are one-time (use cron for recurring)+1. **Keep waits short**: as a tool call, stay well under 9 minutes+2. **Use appropriate units**: don't use 300 seconds when 5 minutes is clearer+3. **Schedule, don't wait**: for anything hours or days away, use a schedule instead## Setup Requirements1. Connect the **Timer** node to Zeenie's `input-tools` handle-2. For workflow triggers, connect Timer as the first node-3. Deploy workflow to activate timer+2. For a pause inside a workflow, put the Timer between two nodes