Unbound cron jobs #4969
Problem / MotivationIs there a reason we forbid creating unbound cron jobs? if is_bound_cron_job(job):
return await run_bound_cron_job(job, agent=agent, cron=cron)
reason = "unbound agent cron job must be recreated from a chat session"
logger.warning(
"Cron: skipped unbound agent job '{}' ({}): {}",
job.name,
job.id,
reason,
)
raise CronJobSkippedError(reason)Proposed SolutionCreating a new ephemeral session for this job ( Related ComponentCron Additional Contexti'd like to get your input on the proposed solution and rationale behind requiring cron jobs to be bound to a session. |
Replies: 6 comments 1 reply
|
hi @wzrayyy I remember where I explained this, after searching for a while, I finally found it: #1445 (comment) |
|
That's reasonable. Although, I was proposing another solution. Here's what I've had in mind: wzrayyy@afa441c. If we do it like that, this would allow for completely headless cron sessions, without any delivery, and just setting it to a new value is fine since in agent/loop.py:1167 we call What do you think about just plain headless jobs? I have a usecase for this, that's why I'm asking: I'm using nanobot to automate documentation writing for work, and the main problems with the current approach are that the sessions are dirty with previous runs, and that I have to receive countless messages (thankfully in their own Telegram topics, but still). Heartbeat wouldn't work for this, since I want to have granular customization of how often the jobs run, besides, heartbeat doesn't really feel like an appropriate thing to use here. |
|
Actually, I generally recommend that tasks be opened in the web UI, which is the inevitable choice. Although third-party chat software is convenient, many functions require native UI support. In addition, regarding context pollution, I suggest you enable session auto compact and set it to 15minutes or even shorter. |
It would still be cleaner to have an option to have a clean session per each run though. Also, it seems that auto compact ignores the cron sessions that do not get any user messages (I'll need to investigate that though, not really certain about this) |
I was partially correct on this: it still keeps the last cron run, |
|
Would you perhaps like something like this (though I still like isolated sessions more)? Just archiving the session pre/post run (whichever you like more) I'm still hung up on the idea of having clean sessions for each cron run. 👉 👈 |
hi @wzrayyy
I remember where I explained this, after searching for a while, I finally found it: #1445 (comment)