Skip to main content

Module subtask

Module subtask 

Source
Expand description

Subtask abstraction — async spawn/join integrated with ThreadManager.

This module provides the unified mechanism for running concurrent work:

  • Subagents spawned by the main agent (joinable, return a result)
  • Background tasks (long-running, may not return)
  • One-shot tasks (quick async work that returns a result)

All subtasks:

  • Run as tokio tasks
  • Create a thread entry in ThreadManager on spawn
  • Update thread status on completion/failure
  • Support cancellation via CancellationToken
  • Support agent-settable descriptions (shown in sidebar)

Structs§

SpawnOptions
Options for spawning a subtask.
SubtaskHandle
Handle to a running subtask. Allows joining, cancelling, and updating status.
SubtaskRegistry
Registry of active subtask handles for a session.

Enums§

SubtaskResult
Result of a completed subtask.

Functions§

spawn_background
Spawn a long-running background thread.
spawn_subagent
Spawn a subagent as an async subtask.
spawn_task
Spawn a one-shot background task.