Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

内核 API 参考

内核层 (mofa-kernel) 提供核心抽象和类型。

模块

agent

核心智能体 trait 和类型。

components

智能体组件,如工具和记忆。

plugin

插件系统接口。

核心类型

#![allow(unused)]
fn main() {
// 智能体状态
pub enum AgentState {
    Created,
    Ready,
    Executing,
    Paused,
    Error,
    Shutdown,
}

// 能力
pub struct AgentCapabilities {
    pub tags: Vec<String>,
    pub input_type: InputType,
    pub output_type: OutputType,
    pub max_concurrency: usize,
}

// 错误处理
pub type AgentResult<T> = Result<T, AgentError>;

pub enum AgentError {
    InitializationFailed(String),
    ExecutionFailed(String),
    InvalidInput(String),
    ToolNotFound(String),
    Timeout,
    // ...
}
}

功能标志

内核没有可选功能——它始终提供最小化的核心。

另见