Bardo.AgentManager.AgentWorkerSupervisor (Bardo v0.1.0)
View SourceDynamic 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 for supervisor.
This allows this module to be used directly in a supervision tree.
@spec count_agents() :: {:ok, non_neg_integer()}
Get the count of running agents.
Returns
{:ok, count}
- The number of running agent workers
@spec list_agents() :: {:ok, [atom()]}
List all running agent IDs.
Returns
{:ok, [atom()]}
- List of running agent IDs
@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 agentparams
- 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
Starts the dynamic supervisor for agent workers.
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