INNER CODE UNIT · Python
create_schedule
bunkeriot/BunkerM · backend/app/agent-api/main.py:376
async def create_schedule(body: JobCreate, x_api_key: str = Header(...)):
_auth(x_api_key)
_require_activation()
try:
CronTrigger.from_crontab(body.cron)
except Exception:
raise HTTPException(status_code=400, detail="Invalid cron expression")
with _lock:
data = _load_agents()
total = len(data["watchers"]) + len(data["jobs"])
if total >= COMMUNITY_MAX_AGENTS:
raise HTTPException(
status_code=403,
detail=f"Community limit: max {COMMUNITY_MAX_AGENTS} agents. Upgrade at bunkerai.dev",
)
job = {
"id": str(uuid.uuid4()),
"description": body.description,