Files
lobehub__lobehub/docs/usage/agent/scheduled-task.mdx
YuTengjing 191f3fe776 📝 docs: fix outdated content across the docs site (#16964)
* 📝 docs: fix outdated content across the docs site

Audited docs/ against the current codebase and fixed stale content that
drifted after major refactors (Clerk/NextAuth → Better Auth, src/server →
apps/server, src/{config,envs,locales} → packages/*, model-bank updates).

- self-hosting/auth: mark removed NextAuth/Clerk pages with deprecation
  warnings; fix microsoft/zitadel alias claims and the Logto callback path
- environment-variables & advanced: correct wrong defaults (S3_SET_ACL,
  AI_IMAGE_DEFAULT_IMAGE_NUM, index/proxy URLs), drop non-existent env vars
  and fictional feature flags, fix OIDC config guidance
- development: update refactored paths, Better Auth, .mjs configs, remove
  the MSW section (msw is not a dependency)
- providers & model examples: replace retired model ids with in-bank ones;
  fix comfyui frontmatter corruption
- usage: rename Moderator→Orchestrator, GTD→Task, correct shortcut keys,
  channel capability tables, Feishu/Lark WebSocket mode
- platform/migration: fix dead links, docker service name, npx/npm → bun

EN and zh-CN pairs updated together.

* 📝 docs: fix Logto callback path and AUTH_SECRET deprecation guidance

- Revert Logto/Sealos callback URLs to /api/auth/callback/logto to match
  the runtime SSO redirectURI override
- Narrow legacy auth Callout: AUTH_SECRET remains required for Better Auth;
  mark NEXT_AUTH_SECRET as deprecated in zh-CN

* 📝 docs: refresh agent skills for locales, env, auth, and agentRun paths

Align OSS agent guidance with post-refactor layout:
- packages/locales/src/default + bun run i18n
- packages/env/src for env schemas (@/envs alias)
- spa-auth shell + src/routes/auth segments
- chat agentRun/transports/hetero instead of aiChat

* 📝 docs: document APP_URL as required for Better Auth base URL

Self-hosted auth uses appEnv.APP_URL as baseURL, not request-header
auto-detection. NEXT_PUBLIC_AUTH_URL remains deprecated.

* 📝 docs: note self-host search provider setup for web search

Built-in lobe-web-browsing needs no client plugin, but self-hosted
servers still require SEARCH_PROVIDERS / SEARXNG_URL (default SearXNG).

* 📝 docs: point feature guide welcome UI at AgentHome

Opening message/questions on the agent chat page live in
src/features/AgentHome, not Onboarding WelcomeMessage.
2026-07-10 17:50:03 +08:00

136 lines
6.2 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: Scheduled Tasks
description: >-
Learn how to use scheduled tasks, including creating, editing, and deleting
them.
tags:
- LobeHub
- CronJob
- Scheduled Tasks
- Create
- Edit
- Delete
---
# Scheduled Tasks
Scheduled tasks are jobs that run periodically in the cloud. In short, you can have an Agent run on your prompt on a schedule — for example, checking social media regularly and sending notifications. Instead of manually triggering the same workflow over and over, set it once and let it run automatically — daily, weekly, or hourly.
## Creating a Task
Scheduling now lives inside the Task system. Open **Tasks** in the left panel of the Agent conversation page, select (or create) a task, and open its **Automation** section in the task detail — that's where you turn on the **Scheduled** tab and configure the recurring schedule.
![Create Task](/blog/assets3059f679eef80c5e777085db3d2d056e.webp)
### Configuration fields
**Task name** — Give the task a descriptive name so you can recognize it at a glance:
- ✅ "Daily Market Summary - 9am"
- ✅ "Weekly Competitor Analysis"
- ❌ "Task 1"
**Task content** — Enter the prompt or instructions the Agent should run each time the task fires. Be specific and complete — this exact prompt runs on every scheduled execution. For example:
```
Analyze today's top tech news and summarize:
1. Major product launches
2. Funding announcements
3. Industry trends
Format as a brief executive summary.
```
**Frequency** — Choose how often the task runs:
- **Daily** — Every day at a specified time
- **Weekly** — On selected weekdays at a specified time (you can pick multiple days)
- **Hourly** — Every N hours, where N is any whole number from 1 to 24
**Time and timezone** — Set the exact time and timezone so the task runs at the correct local time. Times use 24-hour format. For distributed teams, getting the timezone right matters.
**Max runs** — Optionally cap how many times the task runs in total. Ongoing tasks often need no limit; for time-boxed campaigns (e.g. 30 days), you might set 30 — the task disables itself after reaching the limit.
After you create a task, you can change its configuration at any time.
## Schedule configuration examples
**Daily morning report:**
- Frequency: Daily at 08:00 in your timezone
- Prompt: "Summarize yesterday's key metrics and list today's priorities."
**Weekly planning session:**
- Frequency: Weekly on Mondays at 09:00
- Prompt: "Review last week's progress and create this week's priority list."
**Hourly monitoring:**
- Frequency: Every 2 hours
- Prompt: "Check for any critical alerts or anomalies and summarize findings."
## Managing tasks
### Viewing run history
Each scheduled run creates an entry in that Agent's conversation history, labeled with the task name and timestamp. You can review outputs, check for errors, and track past results.
### Editing a schedule
Click a scheduled task to edit it — update the prompt, change frequency or time, or adjust the timezone. Changes apply from the next scheduled run onward.
### Pausing a task
If you temporarily don't need a scheduled task, turn off its enabled state. While off, it won't run automatically; the schedule and prompt stay saved. When you turn it back on, the task continues as configured.
![Pause Task](/blog/assets636c78daf95c590cd7d80284c68eb6d9.webp)
### Deleting a task
If you no longer need a scheduled task, you can delete it. Deletion removes the schedule and prompt configuration; the system will not trigger further runs. Past conversation history is kept.
## Best practices
**Write clear, self-contained prompts** — The scheduled task prompt runs with no prior conversation context. Everything the Agent needs must be in the prompt:
- ✅ "Search for news about electric vehicles published in the last 24 hours and summarize the top 3 developments."
- ❌ "Check the news like we discussed." (The Agent has no access to earlier chats when the schedule runs.)
**Choose appropriate frequency** — Match the schedule to how fast the information actually changes. Hourly checks for daily news add unnecessary load; weekly reports for real-time metrics miss important updates.
**Use descriptive task names** — Put purpose and timing in the name: "Weekly Competitor Analysis - Monday 9am" beats "Task 2".
**Set Max runs while experimenting** — When testing a new scheduled task, cap Max runs at 5–10 so it doesn't run forever if the prompt needs tuning.
**Timezone awareness** — Always set the correct timezone. "09:00" is interpreted in the configured timezone, which may differ from your local clock. Wrong timezone is a common cause of unexpected run times.
## Use cases
### Regularly check social media and notify you
Schedule a task to periodically check social content for given platforms or keywords. It can fetch recent activity, filter what matters, and summarize when there's something important — useful for brand monitoring, competitor tracking, or creator update alerts.
### Periodic summaries and reports
For work that needs regular review — analytics, project status, or content performance — a scheduled task can gather information on a cadence and produce structured takeaways so you keep sight of trends.
### Timed reminders
Set reminders for milestones, recurring checks, or follow-ups. LobeHub can generate reminder messages and notify you (for example by email) without you triggering the flow manually.
## Troubleshooting
**Task didn't run when expected** — Check the timezone. Scheduled times are relative to the configured timezone, not necessarily "now" on your device. Also confirm the task is enabled.
**Runs at surprising times** — Double-check 24-hour time (e.g. 17:00 is 5:00 PM, not 5:00 AM).
**Poor output quality** — Scheduled prompts run without chat history. Rewrite the prompt so it is fully self-contained, with background, data sources, and format requirements spelled out.
**Too many runs** — While experimenting, set a **Max runs** cap. If a task has already run more than intended, delete it and create a new one with the right limits.
<Cards>
<Card href={'/docs/usage/agent/web-search'} title={'Web Search'} />
<Card href={'/docs/usage/getting-started/agent'} title={'Agent'} />
</Cards>