Scheduler

class Scheduler(context: Context) : Capability(source)

Scheduled and recurring agent runs: the agent can schedule_task a prompt for later (once, or every N minutes), list_scheduled_tasks and cancel_scheduled_task. Runs happen in the background on WorkManager (ScheduledAgentWorker), survive reboots, and post their answer as a notification (if the app may post notifications).

Background runs have nobody to approve tools, so tools that require approval are denied there. Scheduling itself requires the user's approval. The app's Application must implement ScheduledAgentHost.

Constructors

Link copied to clipboard
constructor(context: Context)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override val instructions: String
Link copied to clipboard
val tasks: StateFlow<List<ScheduledTask>>

All scheduled tasks with their last result, for a settings screen.

Functions

Link copied to clipboard

Cancel the task id; false when there is none.

Link copied to clipboard
open suspend fun context(): String?
Link copied to clipboard
fun schedule(title: String, prompt: String, firstRunAt: Instant, everyMinutes: Int? = null): ScheduledTask

Schedule prompt at firstRunAt, repeating every everyMinutes (≥ 15) when given.

Link copied to clipboard
open suspend override fun tools(): List<AgentTool>