Table of Contents

Class DelegatedWorkState

Namespace
Oscova.Agents.Providers
Assembly
Oscova.Agents.dll

Owns the subagent workers of one root run and wakes the parent when they change.

public sealed class DelegatedWorkState : IAsyncDisposable

Inheritance

Implements

Inherited Members

Constructors

DelegatedWorkState(CancellationToken)

Creates the state for one root run. The root token also stops every worker.

Fields

MaxActiveWorkers

Active workers allowed per root run, shared by same-agent and custom-agent targets.

ResultSourceId

Attribution source for worker results sent to the parent model.

Properties

ActiveCount

Counts active workers across the whole root run.

CurrentWorker

The worker whose execution is running on the current flow, or null for a root or consulted agent.

Methods

Describe(DelegatedWorkerStatus)

Lower-case status words shared by tool output and waits.

DisposeAsync()

Cancels every worker and returns once all executions have exited.

Find(AgentSession, string)

Finds a worker started by the given parent session.

GetWorkers(AgentSession)

Lists workers started by the given parent session, oldest first.

GetWorkers()

Lists every worker of the root run, oldest first.

HasUnsettledWork(AgentSession)

True while the parent session has a running worker or a result it has not received.

InterruptAsync(DelegatedWorker)

Stops a worker and returns once its execution has exited.

Pulse()

Wakes settlement and waits so they recheck workers, jobs and pending input.

SettleAsync(AIAgent, AgentSession, Func<CancellationToken, Task>?, CancellationToken)

Waits while the parent session has active workers and nothing to answer. Returns undelivered results to send, an empty list when queued input is pending while workers run, or null when settled.

Start(AgentSession, string, string, string?, IReadOnlyList<ChatMessage>, Func<ChatMessage, CancellationToken, Task>, Func<DelegatedWorker, CancellationToken, Task<string>>)

Starts a worker in its own execution, or throws when no slot is free.

WaitAsync(AIAgent, AgentSession, IReadOnlyList<string>, TimeSpan, CancellationToken)

Waits for selected workers or background jobs, a steer, or the timeout, and describes what it observed. With no handles it is a timed sleep that only a steer ends early.

Watch(string, string?, Task)

Lets a background job wake waits. Owner is the worker handle, or null for the parent. A job already watched keeps its first owner.