Bardo.AgentManager.AgentWorkerSupervisor (Bardo v0.1.0)

View Source

Dynamic supervisor for agent workers.

This module is a simple alias for the DynamicSupervisor used to manage individual agent worker processes. It provides helper functions for starting, stopping, and managing agents.

Summary

Functions

Child spec for supervisor.

Get the count of running agents.

List all running agent IDs.

Start a new agent worker under the dynamic supervisor.

Starts the dynamic supervisor for agent workers.

Stop an agent worker.

Functions

child_spec(args)

Child spec for supervisor.

This allows this module to be used directly in a supervision tree.

count_agents()

@spec count_agents() :: {:ok, non_neg_integer()}

Get the count of running agents.

Returns

  • {:ok, count} - The number of running agent workers

list_agents()

@spec list_agents() :: {:ok, [atom()]}

List all running agent IDs.

Returns

  • {:ok, [atom()]} - List of running agent IDs

start_agent(agent_id, params)

@spec start_agent(binary() | atom(), map()) :: DynamicSupervisor.on_start_child()

Start a new agent worker under the dynamic supervisor.

Parameters

  • agent_id - Unique identifier for the agent
  • params - Parameters for the agent, including morphology, id, etc.

Returns

  • {:ok, pid} - If the worker was started successfully
  • {:error, reason} - If there was an error starting the worker

start_link(init_arg \\ [])

Starts the dynamic supervisor for agent workers.

stop_agent(agent_id)

@spec stop_agent(binary() | atom()) :: :ok | {:error, :not_found}

Stop an agent worker.

Parameters

  • agent_id - Unique identifier for the agent

Returns

  • :ok - If the worker was stopped successfully
  • {:error, :not_found} - If the worker was not found