Skip to main content

Module kernel

Module kernel 

Source
Expand description

Core agent abstractions and extensions

This module provides the minimal core interfaces that all agents implement. Following microkernel principles, the core is kept minimal with optional extensions for additional capabilities.

§Core Trait

  • MoFAAgent: The core agent interface (id, name, capabilities, execute, etc.)

§Extension Traits

  • AgentLifecycle: pause, resume, interrupt
  • AgentMessaging: handle_message, handle_event
  • AgentPluginSupport: plugin management

§Example

use mofa_sdk::kernel::MoFAAgent;

#[async_trait::async_trait]
impl MoFAAgent for MyAgent {
    fn id(&self) -> &str { "my-agent" }
    fn name(&self) -> &str { "My Agent" }
    // ... other methods
}

Core abstractions and infrastructure from mofa-kernel.

This module is a normalized, comprehensive facade over mofa-kernel with structured submodules and curated top-level re-exports.

Modules§

agent
bus
config
core
execution_events
执行事件类型
lifecycle
生命周期事件类型
message
message_events
消息事件类型
plugin
plugin_events
插件事件类型
state_events
状态事件类型
storage

Structs§

AgentBus
通信总线核心结构体
AgentCapabilities
Agent 能力描述
AgentCapabilitiesBuilder
Agent 能力构建器
AgentConfig
AgentConfig - Agent 配置
AgentContext
核心执行上下文 (Core Agent Context)
AgentMetadata
Agent 元数据
AgentOutput
Agent 输出类型
AgentRequirements
Agent 需求描述
AgentRequirementsBuilder
Agent 需求构建器
AgentSchemaConfig
Agent 配置
AgentStats
Agent 统计信息
ChatCompletionRequest
LLM 聊天完成请求
ChatCompletionResponse
LLM 聊天完成响应
ChatMessage
聊天消息
ConfigLoader
配置加载器
ContextConfig
上下文配置
CoreAgentMessage
Agent 消息
ErrorContext
错误上下文
EventBuilder
事件构建器
EventBus
事件总线
GlobalEvent
全局事件类型
HotReloadConfig
热加载配置
MemoryItem
记忆项 (搜索结果)
MemoryStats
记忆统计
Message
对话消息
MessageMetadata
消息元数据
PluginContext
插件执行上下文
PluginMetadata
插件元数据
ReasoningResult
推理结果
ReasoningStep
推理步骤
TaskRequest
TokenUsage
Token 使用统计
ToolCall
LLM 工具调用
ToolDefinition
LLM 工具定义
ToolDescriptor
工具描述符 (用于列表展示)
ToolInput
工具输入
ToolMetadata
工具元数据
ToolResult
工具执行结果
ToolUsage
工具使用记录

Enums§

AgentError
Agent 错误类型
AgentEvent
AgentInput
Agent 输入类型
AgentMessage
AgentState
Agent 状态机
AgentType
Agent 类型
ConfigFormat
配置格式
CoordinationPattern
协调模式
ErrorCategory
错误分类
GlobalError
全局错误类型
GlobalMessage
全局消息类型
HealthStatus
Agent 健康状态
InputType
支持的输入类型
InterruptResult
中断处理结果
MemoryValue
记忆值类型
MessageContent
消息内容类型
MessageRole
消息角色
OutputContent
输出内容类型
OutputType
支持的输出类型
PluginEvent
插件事件
PluginState
插件状态
PluginType
插件类型枚举
ReasoningStepType
推理步骤类型
ReasoningStrategy
推理策略
ReloadEvent
热加载事件
ReloadStrategy
热加载策略
SchedulingStatus
StreamControlCommand
StreamType
TaskPriority
TaskStatus

Traits§

AgentFactory
Agent 工厂 Trait
AgentLifecycle
Agent 生命周期扩展
AgentMessaging
Agent 消息处理扩展
AgentPlugin
核心插件 trait
AgentPluginSupport
Agent 插件支持扩展
Coordinator
协调器 Trait
LLMProvider
LLM Provider trait - 定义 LLM 提供商接口
Memory
记忆组件 Trait
MoFAAgent
MoFA Agent 统一接口
Reasoner
推理器 Trait
Storage
Generic storage trait for key-value operations
Tool
统一工具 Trait

Type Aliases§

AgentResult
Agent 操作结果类型
DynAgent
动态分发的 MoFAAgent
GlobalResult
全局结果类型
PluginResult
插件执行结果