pub struct AgentConfig { /* private fields */ }Expand description
Configuration parameters required to initialize a new agent.
This struct encapsulates the essential settings for creating an agent instance, including its unique identity, its relationship within the agent hierarchy (parent), and its connection to the system message broker.
The agent’s identity is represented by an Ern, which supports
hierarchical naming. If a parent agent is specified during configuration, the
final Ern of the new agent will be derived by appending its base id to the
parent’s Ern.
Implementations§
Source§impl AgentConfig
impl AgentConfig
Sourcepub fn new(
id: Ern,
parent: Option<AgentHandle>,
broker: Option<AgentHandle>,
) -> Result<AgentConfig>
pub fn new( id: Ern, parent: Option<AgentHandle>, broker: Option<AgentHandle>, ) -> Result<AgentConfig>
Creates a new AgentConfig instance, potentially deriving a hierarchical ID.
This constructor configures a new agent. If a parent handle is provided,
the agent’s final id (Ern) is constructed by appending the provided id
segment to the parent’s Ern. If no parent is provided, the id is used directly.
§Arguments
id- The base identifier (Ern) for the agent. IfparentisSome, this acts as the final segment appended to the parent’s ID. IfparentisNone, this becomes the agent’s root ID.parent- An optional [ParentRef] (handle) to the supervising agent.broker- An optional [BrokerRef] (handle) to the system message broker.
§Returns
Returns a Result containing the configured AgentConfig instance.
§Errors
Returns an error if parsing the parent’s ID string into an Ern fails when
constructing a hierarchical ID.
Sourcepub fn new_with_name(name: impl Into<String>) -> Result<AgentConfig>
pub fn new_with_name(name: impl Into<String>) -> Result<AgentConfig>
Creates a new AgentConfig for a top-level agent with a root identifier.
This is a convenience function for creating an AgentConfig for an agent
that has no parent (i.e., it’s a root agent in the hierarchy). The provided
name is used to create a root Ern.
§Arguments
name- A string-like value that will be used as the root name for the agent’sErn.
§Returns
Returns a Result containing the new AgentConfig instance with no parent or broker.
§Errors
Returns an error if creating the root Ern from the provided name fails
(e.g., if the name is invalid according to Ern rules).
Trait Implementations§
Source§impl Clone for AgentConfig
impl Clone for AgentConfig
Source§fn clone(&self) -> AgentConfig
fn clone(&self) -> AgentConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more