pub struct AgentConfig {
pub id: String,
pub name: String,
pub description: Option<String>,
pub agent_type: AgentType,
pub components: ComponentsConfig,
pub capabilities: CapabilitiesConfig,
pub custom: HashMap<String, Value>,
pub env_mappings: HashMap<String, String>,
pub enabled: bool,
pub version: Option<String>,
}Expand description
Agent 配置
统一的 Agent 配置结构,支持多种 Agent 类型
§示例
ⓘ
use mofa_kernel::agent::config::{AgentConfig, AgentType, LlmAgentConfig};
let config = AgentConfig {
id: "my-agent".to_string(),
name: "My LLM Agent".to_string(),
description: Some("A helpful assistant".to_string()),
agent_type: AgentType::Llm(LlmAgentConfig {
model: "gpt-4".to_string(),
..Default::default()
}),
..Default::default()
};Fields§
§id: StringAgent ID (唯一标识符)
name: StringAgent 名称 (显示名)
description: Option<String>Agent 描述
agent_type: AgentTypeAgent 类型配置
components: ComponentsConfig组件配置
capabilities: CapabilitiesConfig能力配置
custom: HashMap<String, Value>自定义配置
env_mappings: HashMap<String, String>环境变量映射
enabled: bool是否启用
version: Option<String>版本号
Implementations§
Source§impl AgentConfig
impl AgentConfig
Sourcepub fn with_description(self, description: impl Into<String>) -> AgentConfig
pub fn with_description(self, description: impl Into<String>) -> AgentConfig
设置描述
Sourcepub fn with_type(self, agent_type: AgentType) -> AgentConfig
pub fn with_type(self, agent_type: AgentType) -> AgentConfig
设置 Agent 类型
Sourcepub fn with_custom(self, key: impl Into<String>, value: Value) -> AgentConfig
pub fn with_custom(self, key: impl Into<String>, value: Value) -> AgentConfig
添加自定义配置
Sourcepub fn get_custom<T>(&self, key: &str) -> Option<T>where
T: DeserializeOwned,
pub fn get_custom<T>(&self, key: &str) -> Option<T>where
T: DeserializeOwned,
获取自定义配置
Trait Implementations§
Source§impl Clone for AgentConfig
impl Clone for AgentConfig
Source§fn clone(&self) -> AgentConfig
fn clone(&self) -> AgentConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AgentConfig
impl Debug for AgentConfig
Source§impl Default for AgentConfig
impl Default for AgentConfig
Source§fn default() -> AgentConfig
fn default() -> AgentConfig
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for AgentConfig
impl<'de> Deserialize<'de> for AgentConfig
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<AgentConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<AgentConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for AgentConfig
impl Serialize for AgentConfig
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for AgentConfig
impl RefUnwindSafe for AgentConfig
impl Send for AgentConfig
impl Sync for AgentConfig
impl Unpin for AgentConfig
impl UnsafeUnpin for AgentConfig
impl UnwindSafe for AgentConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Message for T
impl<T> Message for T
Source§fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
Convert a BoxedMessage to this concrete type
Source§fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
Convert this message to a BoxedMessage