ExAgent. AgentSupervisor
(ExAgent v3.0.0)
View Source
A DynamicSupervisor that owns ExAgent.Server processes.
Stability — Stable.
After an abnormal exit the supervisor restarts the Server with a new PID,
subject to its restart limit. Calling stop_agent/1 removes the child.
Supply :name to address the replacement process. The :agent_id identifies
the conversation in events and storage. With a Store, the replacement can
restore the conversation's last confirmed snapshot.
Omitting :agent_id generates one per child specification. Supply a stable
ID to restore the conversation after a new start_agent/1 call.
Example
{:ok, pid} = ExAgent.AgentSupervisor.start_agent(agent: my_agent, name: :dm)
ExAgent.Server.chat(:dm, "Roll for initiative")
Summary
Functions
Returns a specification to start this module under a supervisor.
Start an ExAgent.Server under this supervisor. opts are forwarded to
ExAgent.Server.start_link/1. Returns {:ok, pid} or {:error, _}.
Stop a supervised agent by pid. Returns :ok or {:error, _}.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec start_agent(keyword()) :: DynamicSupervisor.on_start_child()
Start an ExAgent.Server under this supervisor. opts are forwarded to
ExAgent.Server.start_link/1. Returns {:ok, pid} or {:error, _}.
@spec stop_agent(pid()) :: :ok | {:error, :not_found}
Stop a supervised agent by pid. Returns :ok or {:error, _}.