AgentSea.Crew (agentsea_crews v0.1.0)

Copy Markdown

A crew of agents that collaborate on a task DAG.

Starting a crew boots a supervision subtree (a Task.Supervisor, a DynamicSupervisor of agents, and a coordinator). Tasks are added, then kickoff/1 runs them — dispatching ready tasks to agents via the configured delegation strategy, running independent tasks concurrently, and unlocking dependents as results arrive.

Example

spec = %AgentSea.Crew.Spec{
  name: :research_crew,
  strategy: AgentSea.Crew.Delegation.BestMatch,
  agents: [researcher_config, writer_config]
}

{:ok, _sup} = AgentSea.Crew.start_link(spec)
AgentSea.Crew.add_task(:research_crew, description: "Research X", required_capabilities: ["research"])
{:ok, result} = AgentSea.Crew.kickoff(:research_crew)

Summary

Functions

Abort: cancel in-flight tasks; the kickoff caller gets {:error, :aborted}.

Add a task to the crew (only while idle). Accepts AgentSea.Crew.Task.new/1 attrs.

Run the crew to completion; returns {:ok, result} with results & failures.

Pause dispatching (in-flight tasks finish). Only while :running.

Resume dispatching after a pause. Only while :paused.

Start a crew supervision subtree from a Spec.

Current crew status: :idle | :running | :paused | :completed | :aborted.

Functions

abort(crew)

Abort: cancel in-flight tasks; the kickoff caller gets {:error, :aborted}.

add_task(crew, attrs)

Add a task to the crew (only while idle). Accepts AgentSea.Crew.Task.new/1 attrs.

kickoff(crew)

Run the crew to completion; returns {:ok, result} with results & failures.

pause(crew)

Pause dispatching (in-flight tasks finish). Only while :running.

resume(crew)

Resume dispatching after a pause. Only while :paused.

start_link(spec)

Start a crew supervision subtree from a Spec.

status(crew)

Current crew status: :idle | :running | :paused | :completed | :aborted.