Raxol.Agent.Orchestrator (Raxol Agent v2.6.0)

Copy Markdown View Source

Coordinates multiple AI agents in the cockpit.

Manages pane layout, routes pilot input to the focused pane, handles agent spawning/killing, and implements the takeover/release protocol.

Pilot modes:

  • :observe -- watching agents work (default)
  • :command -- sending directives to agents
  • :takeover -- directly controlling an agent's terminal

Summary

Functions

Accept the pending layout recommendation.

Broadcast a directive to all agents.

Returns a specification to start this module under a supervisor.

Switch pilot focus to a different pane.

Get the current layout and agent status.

Get the pending recommendation, if any.

Get all agent statuses.

Kill an agent and remove its pane.

Pilot releases the taken-over agent's terminal.

Pilot takes over the focused agent's terminal.

Reject the pending layout recommendation.

Send a directive to a specific agent.

Route pilot input to the focused pane's agent (during takeover).

Spawn a new agent and assign it a pane.

Start the orchestrator.

Subscribe to orchestrator events.

Types

t()

@type t() :: %Raxol.Agent.Orchestrator{
  agents: %{required(atom()) => pid()},
  event_log: CircularBuffer.t() | nil,
  focused_pane: atom() | nil,
  monitors: %{required(atom()) => reference()},
  pane_layout: %{required(atom()) => map()},
  pending_recommendation: map() | nil,
  pilot_mode: :observe | :command | :takeover,
  subscribers: MapSet.t(pid())
}

Functions

accept_recommendation(orchestrator)

@spec accept_recommendation(pid()) :: :ok | {:error, :no_pending}

Accept the pending layout recommendation.

broadcast_directive(orchestrator, directive)

@spec broadcast_directive(pid(), term()) :: :ok

Broadcast a directive to all agents.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

focus_pane(orchestrator, pane_id)

@spec focus_pane(pid(), atom()) :: :ok

Switch pilot focus to a different pane.

get_layout(orchestrator)

@spec get_layout(pid()) :: map()

Get the current layout and agent status.

get_pending_recommendation(orchestrator)

@spec get_pending_recommendation(pid()) :: map() | nil

Get the pending recommendation, if any.

get_statuses(orchestrator)

@spec get_statuses(pid()) :: map()

Get all agent statuses.

kill_agent(orchestrator, agent_id)

@spec kill_agent(pid(), atom()) :: :ok

Kill an agent and remove its pane.

pilot_release(orchestrator)

@spec pilot_release(pid()) :: :ok | {:error, term()}

Pilot releases the taken-over agent's terminal.

pilot_takeover(orchestrator)

@spec pilot_takeover(pid()) :: :ok | {:error, term()}

Pilot takes over the focused agent's terminal.

reject_recommendation(orchestrator)

@spec reject_recommendation(pid()) :: :ok | {:error, :no_pending}

Reject the pending layout recommendation.

send_directive(orchestrator, agent_id, directive)

@spec send_directive(pid(), atom(), term()) :: :ok | {:error, term()}

Send a directive to a specific agent.

send_input(orchestrator, input)

@spec send_input(pid(), term()) :: :ok | {:error, term()}

Route pilot input to the focused pane's agent (during takeover).

spawn_agent(orchestrator, agent_id, agent_module, opts \\ [])

@spec spawn_agent(pid(), atom(), module(), keyword()) ::
  {:ok, atom()} | {:error, term()}

Spawn a new agent and assign it a pane.

start_link(init_opts \\ [])

@spec start_link(keyword()) :: {:ok, pid()}

Start the orchestrator.

subscribe(orchestrator)

@spec subscribe(pid()) :: :ok

Subscribe to orchestrator events.