Hi LangChain ![]()
I’m working on a project using LangGraph workflows, and I want to add self-scheduling tool so that the agent itself can decide to schedule tasks in the future (instead of only executing immediately after user input).
My current setup:
The workflow works like a chatbot interaction (user gives an instruction → workflow runs).
I want the agent to schedule itself as a background task, so at a future time the workflow automatically re-runs without me manually triggering it.
For example:
User: “Remind me to practice DSA at 7:00 PM.”
Agent: calls a scheduling tool → schedules workflow to run at 7:00 PM → at that time, the workflow starts and asks me if I completed the task.
What i am doing:
def schedule_yourself(task: str, time: str) -> str:
"""
Schedule the assistant script to run at a specific time to check task completion.
"""
script_path = r"D:\Secrets_agent\personal_assistant\chatbot.py"
task_name = f"AssistantReminder_{task.replace(' ', '_')}"
cmd = (
f'schtasks /create /sc once /tn "{task_name}" '
f'/tr "python {script_path} {task_name}" /st {time}'
)
try:
subprocess.run(cmd, shell=True, check=True)
return f"Scheduled assistant to ask about '{task}' at {time}."
except subprocess.CalledProcessError as e:
return f"Failed to schedule task: {e}"
But it’s not working properly (fails to create reliable scheduled tasks on Windows).
My Question
-
What is the best way to schedule LangGraph workflows on Windows?
-
Should I continue with schtasks (but maybe with a different setup/command)?
-
Is there any LangGraph-specific pattern for scheduling workflows?