SubAgents

class SubAgents(val agents: List<SubAgent>, val toolName: String = DELEGATE_TASK, clock: () -> Long = System::currentTimeMillis) : Capability(source)

Lets the agent delegate self-contained tasks to named agents — the same contract as Pydantic AI Harness SubAgents, so on-device and server agents behave alike and UIs render both the same way:

  • one tool, delegate_task(agent_name, task);

  • the roster is a static instruction (cache-stable);

  • each delegation runs in a fresh context and returns the delegate's final answer to the parent.

While a delegation runs, its reply streams to the UI through ToolCallContext.subagent and is rendered by the Subagent element.

Constructors

Link copied to clipboard
constructor(agents: List<SubAgent>, toolName: String = DELEGATE_TASK, clock: () -> Long = System::currentTimeMillis)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
open override val instructions: String?

Guidance for the model, or null.

Link copied to clipboard

Functions

Link copied to clipboard
open suspend fun context(): String?

Per-turn context read when a turn starts (e.g. a memory snapshot), placed after the static instructions. It may change between turns, so keep it small and at the end.

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

Tools the capability contributes.