From e14340366c3590c58f53c7578b1d0eadf6b81960 Mon Sep 17 00:00:00 2001 From: gahusb Date: Sat, 11 Apr 2026 08:49:58 +0900 Subject: [PATCH] =?UTF-8?q?feat(agent-office):=20APScheduler=20=E2=80=94?= =?UTF-8?q?=20stock=20news=20cron,=20idle=20break=20checker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.6 --- agent-office/app/scheduler.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 agent-office/app/scheduler.py diff --git a/agent-office/app/scheduler.py b/agent-office/app/scheduler.py new file mode 100644 index 0000000..c5eda69 --- /dev/null +++ b/agent-office/app/scheduler.py @@ -0,0 +1,20 @@ +import asyncio +from apscheduler.schedulers.asyncio import AsyncIOScheduler + +from .agents import AGENT_REGISTRY + +scheduler = AsyncIOScheduler(timezone="Asia/Seoul") + +async def _check_idle_breaks(): + for agent in AGENT_REGISTRY.values(): + await agent.check_idle_break() + +async def _run_stock_schedule(): + agent = AGENT_REGISTRY.get("stock") + if agent: + await agent.on_schedule() + +def init_scheduler(): + scheduler.add_job(_run_stock_schedule, "cron", hour=8, minute=0, id="stock_news") + scheduler.add_job(_check_idle_breaks, "interval", seconds=60, id="idle_check") + scheduler.start()