Jido.Messaging.AgentSupervisor (Jido Messaging v1.0.0)

Copy Markdown View Source

DynamicSupervisor for spawning and managing AgentRunner processes.

Each Jido.Messaging instance has its own AgentSupervisor that manages agent runners on-demand.

Summary

Functions

Returns a specification to start this module under a supervisor.

Count running agent runners for this instance

List all running agents in a room.

List all running agents across all rooms

Stop an agent assigned to a room thread.

Functions

child_spec(arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

count_agents(instance_module)

Count running agent runners for this instance

list_agents(instance_module, room_id)

List all running agents in a room.

Returns a list of {{thread_id, agent_id}, pid} tuples.

list_all_agents(instance_module)

List all running agents across all rooms

start_agent(instance_module, room_id, thread_id, agent_id, agent_config)

Start an agent assigned to a room thread.

Returns {:ok, pid} if started successfully, or {:error, {:already_started, pid}} if the agent is already running in this room.

Options

The agent_config map must include:

  • :handler - Function (message, context) -> {:reply, text} | :noreply | {:error, reason}

  • :trigger - :all | :mention | {:prefix, "/cmd"}

  • :name - Display name for the agent

start_link(opts)

stop_agent(instance_module, room_id, thread_id, agent_id)

Stop an agent assigned to a room thread.

Returns :ok if stopped, or {:error, :not_found} if not running.