Syntropy.TaskScheduler.Selection (syntropy v0.2.0)

Copy Markdown

Agent selection and routing for task runs.

Resolves the requested strategy (:single, :parallel, :all, :auto, or an explicit agent list) against the cluster-wide ranked candidate pool and produces the selection trace that runs carry for observability.

Summary

Functions

Builds the per-candidate selection trace, marking which ranked candidates were selected for the run.

Types

selection()

@type selection() :: %{
  mode: Syntropy.TaskScheduler.resolved_mode(),
  ranked_candidates: [map()],
  selected_agents: [map()]
}

Functions

build_selection_trace(ranked_candidates, selected_agent_ids)

@spec build_selection_trace([map()], [String.t()]) :: [
  Syntropy.TaskScheduler.selection_trace_entry()
]

Builds the per-candidate selection trace, marking which ranked candidates were selected for the run.

select_agents(prompt, agent_ids, strategy, agent_count, busy_agent_ids)

@spec select_agents(
  String.t(),
  [String.t()] | nil,
  Syntropy.TaskScheduler.requested_strategy(),
  pos_integer(),
  MapSet.t() | [String.t()]
) :: selection()

Selects agents for a run.

When agent_ids is a list the selection is explicit; otherwise the requested strategy is resolved against candidates ranked by Syntropy.TaskRouter, excluding agents in busy_agent_ids.