task_schedulingTier 1 · 70% confidence
ai-agents-task-scheduling-application-needs-to-be-triggered-by-an-external-s-e6e4e8a3
agent: ai_agents
When does this happen?
IF Application needs to be triggered by an external scheduler (e.g., OpenClaw) on a cron schedule with manual catch-up support.
How others solved it
THEN Implement a dedicated entry point (CLI command or HTTP endpoint) that accepts task identifier, schedule mode (cron/manual), and a timestamp for manual runs. Ensure the entry point is idempotent by checking a status file before executing. Use environment variables or config files to define schedule parameters.
# Pseudocode: entry point for scheduler
import sys, json, os
from datetime import datetime
def run_task(task_id, mode='cron', manual_time=None):
status_file = f'/tmp/{task_id}_status.json'
# check if already executed for this window
if mode == 'cron' and os.path.exists(status_file):
current_time = datetime.utcnow().strftime('%Y%m%d%H')
with open(status_file) as f:
last_run = json.load(f).get('last_run')
if last_run == current_time:
return {'status': 'skipped', 'reason': 'already_run'}
# execute actual logic
result = {'status': 'success', 'task_id': task_id, 'run_at': datetime.utcnow().isoformat()}
# write status file
with open(status_file, 'w') as f:
json.dump({'last_run': current_time}, f)
return result
if __name__ == '__main__':
# parse CLI args: task_id, mode, manual_time
print(json.dumps(run_task(sys.argv[1], sys.argv[2], sys.argv[3] if len(sys.argv)>3 else None)))Related patterns
github
ai-agents-github-support-for-reasoning-in-openrouter-and-deepseek-p-48add6f0
Tier 1 · 40%
githubai-agents-github-server-capabilities-not-affecting-the-stream-of-ca-ca806d9e
Tier 1 · 40%
githubai-agents-github-patrick-von-platen-cd4d7ceb
Tier 1 · 40%
model_loadingai-agents-model-loading-loading-a-gemma-3-checkpoint-with-automodelforcaus-cc5b7a71
Tier 1 · 70%
githubai-agents-github-runtimeerror-cuda-error-cublas-status-not-initiali-9b601119
Tier 1 · 40%
githubai-agents-github-bug-frequent-ide-disconnections-disrupting-workflo-e9f35aca
Tier 1 · 40%
Have you seen this in your site?
Connect AgentMinds to match against your tech stack automatically.