mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-09-30 16:13:15 +00:00
* feat: add scheduled web agents Co-authored-by: open-swe[bot] <215916821+open-swe[bot]@users.noreply.github.com> * fix: secure scheduled agent repositories Co-authored-by: open-swe[bot] <215916821+open-swe[bot]@users.noreply.github.com> * feat: rebuild scheduled agents as Automations tab Scrap the inline ScheduledAgentsPanel and replace it with a dedicated Automations tab: sidebar nav entry, list view with stat cards + empty state, and a full editor (name, Active toggle, repo, scheduled trigger picker, agent instructions + model). * fix: clear collapsed-sidebar button on mobile in Automations * fix: allow clearing automation repo on update --------- Co-authored-by: open-swe[bot] <215916821+open-swe[bot]@users.noreply.github.com>
35 lines
1.2 KiB
Python
35 lines
1.2 KiB
Python
"""LangGraph entrypoint that fans cron ticks into fresh agent threads."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import logging
|
|
from typing import Any, TypedDict
|
|
|
|
from langgraph.graph import END, START, StateGraph
|
|
from langgraph.graph.state import RunnableConfig
|
|
|
|
from .dashboard.schedules import launch_scheduled_agent_run
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
class SchedulerState(TypedDict, total=False):
|
|
schedule_id: str
|
|
result: dict[str, Any]
|
|
|
|
|
|
async def _launch(state: SchedulerState, config: RunnableConfig) -> dict[str, Any]:
|
|
configurable = config.get("configurable") or {}
|
|
schedule_id = state.get("schedule_id") or configurable.get("schedule_id")
|
|
if not isinstance(schedule_id, str) or not schedule_id:
|
|
logger.warning("Scheduled agent tick missing schedule_id")
|
|
return {"result": {"status": "missing_schedule_id"}}
|
|
return {"result": await launch_scheduled_agent_run(schedule_id)}
|
|
|
|
|
|
def get_scheduler(config: RunnableConfig | None = None):
|
|
builder = StateGraph(SchedulerState)
|
|
builder.add_node("launch", _launch)
|
|
builder.add_edge(START, "launch")
|
|
builder.add_edge("launch", END)
|
|
return builder.compile().with_config(config or {})
|