ExAgent.Session.TurnPolicy.SupervisorPolicy (ExAgent v3.0.0)

View Source

A coordinator-driven turn order: a supervisor participant alternates with each worker in turn, forever.

Stability — Stable.

The sequence is supervisor, worker[0], supervisor, worker[1], …, supervisor, worker[0], …. This models a "DM" or triage coordinator that stays in the loop between every worker action — useful when the supervisor must react (narrate, validate, re-route) each time a worker acts. The supervisor may also hand off mid-turn via ExAgent.Session.handoff/3, or delegate sub-tasks via ExAgent.Coordination.delegation_tool/2.

ExAgent.Session.start_link(
  shared_state: %{},
  policy: {:supervisor, supervisor: "dm", workers: ["rogue", "wizard"]},
  participants: [...]
)

:supervisor defaults to the first participant; :workers defaults to every other participant. Configured roles must belong to the initial roster. Workers must be distinct from one another and from the supervisor. An explicit list can omit observers and sets the worker order. Participants who join later enter the worker rotation.

Summary

Types

t()

@type t() :: %ExAgent.Session.TurnPolicy.SupervisorPolicy{
  current: term() | nil,
  emit_supervisor_next: boolean(),
  supervisor: term() | nil,
  worker_index: non_neg_integer(),
  workers: [term()]
}