Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
fix: make cron run command actually execute the agent
Clayton Wilson4367038a95a8
diff --git a/nanobot/cli/commands.py b/nanobot/cli/commands.pyindex 2f4ba7b5c..a45b4a733 100644--- a/nanobot/cli/commands.py+++ b/nanobot/cli/commands.py@@ -860,17 +860,51 @@ def cron_run(force: bool = typer.Option(False, "--force", "-f", help="Run even if disabled"),):"""Manually run a job."""- from nanobot.config.loader import get_data_dir+ from nanobot.config.loader import load_config, get_data_dirfrom nanobot.cron.service import CronService-+ from nanobot.bus.queue import MessageBus+ from nanobot.agent.loop import AgentLoop+ from loguru import logger+ logger.disable("nanobot")++ config = load_config()+ provider = _make_provider(config)+ bus = MessageBus()+ agent_loop = AgentLoop(+ bus=bus,+ provider=provider,+ workspace=config.workspace_path,+ model=config.agents.defaults.model,+ max_iterations=config.agents.defaults.max_tool_iterations,+ memory_window=config.agents.defaults.memory_window,+ exec_config=config.tools.exec,+ restrict_to_workspace=config.tools.restrict_to_workspace,+ )+store_path = get_data_dir() / "cron" / "jobs.json"service = CronService(store_path)-++ result_holder = []++ async def on_job(job):+ response = await agent_loop.process_direct(+ job.payload.message,+ session_key=f"cron:{job.id}",+ channel=job.payload.channel or "cli",+ chat_id=job.payload.to or "direct",+ )+ result_holder.append(response)+ return response++ service.on_job = on_job+async def run():return await service.run_job(job_id, force=force)-+if asyncio.run(run()):- console.print(f"[green]✓[/green] Job executed")+ console.print("[green]✓[/green] Job executed")+ if result_holder:+ _print_agent_response(result_holder[0], render_markdown=True)else:console.print(f"[red]Failed to run job {job_id}[/red]")