schedule_task
Queue an LLM task to run during a low-carbon, off-peak grid window before a deadline, cutting cost through batch APIs.
Instructions
Queue an AI task to run during off-peak hours inside the given deadline. Four parallel wins: (1) lighter on the electricity grid — deferring non-urgent tasks smooths projected AI compute demand; (2) up to 50% cheaper — auto-routes through Anthropic/OpenAI Batch APIs when the deadline allows; (3) faster sync calls — off-peak queues are shorter; (4) lower carbon — dispatch at the cleanest electricity-grid hour. Invoke this tool whenever the user phrases a request with deferral language: "do this later", "by tomorrow", "tonight", "overnight", "by EOD", "sometime this week", "when you have a moment", "remind me to", "queue this up", "schedule this", "no rush", "not urgent". Convert the user's wording to an ISO-8601 deadline and pass the task as the prompt. Returns a task_id you can later check with check_queue_status. Good fits: nightly digests, batch summaries, research sweeps, evaluator runs, multi-step report generation — anything the user is fine waiting on. Do NOT use for live chat, interactive code edits, or any task the user is actively waiting to see complete.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | No | Model to dispatch with (e.g. 'claude-sonnet-5' for Anthropic, 'gpt-6-sol' for OpenAI). Defaults per provider: anthropic 'claude-sonnet-5' (EBB_DEFAULT_MODEL overrides it), openai 'gpt-6-sol', gemini 'gemini-3.8-flash', ollama 'llama3.1'. When >= 2 'candidates' are supplied, routing may overwrite this with the winning candidate. | |
| prompt | Yes | The prompt or task description to dispatch when the chosen window arrives. | |
| region | No | Grid-region override (Electricity Maps zone code such as 'US-CAL-CISO'). Defaults to the host's configured region, else a host-timezone guess, else GB. | |
| dry_run | No | If true, return the planned dispatch (recommended window + carbon estimate) WITHOUT persisting anything. Useful for confirmation flows. | |
| deadline | Yes | ISO-8601 timestamp (e.g. '2026-05-13T08:00:00-04:00') by which the task must have completed. Must be in the future. Required. | |
| dispatch | No | If true (default), persist a provider_call task body that `ebb tick` (CLI) or scheduler.tick (library) can dispatch. Set to false only to enqueue a placeholder prompt without a dispatchable body (legacy in-memory mode). | |
| provider | No | Which provider to dispatch this task through: 'anthropic', 'openai', 'gemini', or 'ollama' (local). Defaults to 'anthropic'. 'anthropic' and 'openai' can auto-route through a 50%-cheaper Batch API when the deadline allows; 'gemini' and 'ollama' always dispatch synchronously. | |
| candidates | No | Optional cross-provider routing candidates: 'provider:model' strings (e.g. ['anthropic:claude-haiku-4-5','openai:gpt-6-luna','ollama:llama-3-1-8b']) the caller EXPLICITLY allows. With >= 2 entries the scheduler scores them at the chosen dispatch window on a weighted blend of carbon, cost and latency and dispatches the winner (recording the full scored list on the signed receipt). No silent model swaps — routing only ever picks from this list. Absent or a single entry leaves the provider/model behavior unchanged. Every candidate model must exist in the price table or the task is rejected loudly. | |
| output_path | No | Optional absolute file path. When the task completes, ebb-ai writes { taskId, result, receipt } as JSON to this path. | |
| route_weights | No | Optional routing weights {carbon, cost, latency}, non-negative and normalized internally. Default {carbon:0.6, cost:0.3, latency:0.1}. Only used when 'candidates' has >= 2 entries. | |
| carbon_budget_g | No | Optional hard cap on estimated grams CO2-equivalent for this task. Windows above the cap are dropped before the cleanest is chosen; if none inside the deadline meets the cap the task fails rather than dispatching to a dirty window. | |
| redact_in_receipt | No | Optional regex patterns to strip from the prompt before storing it on the receipt. Omit to use the default redaction of API-key-looking strings. |