Crate agent_kernel

Crate agent_kernel 

Source
Expand description

Agent lifecycle state machine and execution loop.

This crate provides the building blocks required by MXP-native agents: lifecycle management, message routing, and a lightweight scheduler backed by tokio.

Structs§

AgentKernel
Core runtime that wires lifecycle, scheduler, and MXP handlers.
AgentRecord
Snapshot of an agent returned by discovery calls.
CallExecutor
Executes MXP Call messages by invoking registered tools and the configured ModelAdapter.
CallOutcome
Outcome of processing a call message.
CheckpointMetadata
Metadata about a checkpoint.
CollectingSink
Sink used during testing to capture outcomes.
CompositeAuditEmitter
Fan-out emitter that broadcasts audit events to multiple sinks.
CompositePolicyObserver
Composite observer that forwards decisions to a collection of observers.
DiscoverRequest
Agent discovery request payload.
DiscoverResponse
Discovery response payload.
ErrorResponse
Error payload used for protocol error responses.
GovernanceAuditEmitter
Sends audit events to a remote governance agent using MXP transport.
HandlerContext
Context provided to message handlers.
HeartbeatRequest
Heartbeat request emitted by agents.
HeartbeatResponse
Heartbeat acknowledgement returned to agents.
KernelMessageHandler
Handler implementation that wires the call executor into the MXP handler trait.
KernelMessageHandlerBuilder
Builder for KernelMessageHandler that automates tool registration and optional components.
Lifecycle
Lifecycle state manager.
MxpAuditObserver
Observer that emits MXP audit events for deny/escalate outcomes.
MxpRegistryClient
MXP-backed registry client that speaks directly to the MXP Nexus registry service.
RegisterRequest
Registration payload emitted by agents.
RegisterResponse
Successful registration acknowledgement.
RegistrationConfig
Configuration for registration and heartbeat maintenance.
SchedulerConfig
Maximum number of concurrent tasks allowed per agent.
ShutdownCoordinator
Coordinates graceful shutdown of agent workloads.
StateCheckpoint
Checkpoint containing critical agent state for recovery.
StateRecovery
Manages checkpoint persistence and recovery.
TaskScheduler
Lightweight wrapper around tokio::spawn that enforces per-agent concurrency.
ToolInvocationResult
Result describing an executed tool invocation.
TracingAuditEmitter
Tracing-based audit emitter that logs MXP audit events.
TracingCallSink
Sink implementation that logs to tracing.
TracingPolicyObserver
Observer that emits decisions to the tracing system.
ValidationConfig
Configuration for message validation.
WorkGuard
RAII guard for tracking in-flight work.

Enums§

AgentState
Discretely states an agent can occupy during its lifetime.
HandlerError
Errors that can occur during message handling.
KernelError
Errors emitted by AgentKernel operations.
LifecycleError
Errors emitted by the lifecycle controller.
LifecycleEvent
Events that trigger lifecycle transitions.
RecoveryError
Errors from state recovery operations.
RegistryError
Errors surfaced by registry integration.
SchedulerError
Errors produced by the scheduler.
ShutdownError
Errors from shutdown operations.
ShutdownState
Shutdown state enumeration.
ValidationError
Errors that can occur during message validation.
WireAgentStatus
Simplified agent status representation.

Traits§

AgentMessageHandler
Trait implemented by agent-specific MXP message handlers.
AgentRegistry
Trait implemented by discovery/registry backends.
AuditEmitter
Emits MXP audit events when policy decisions deny or escalate requests.
CallOutcomeSink
Observer trait used to capture call outcomes (for logging, metrics, etc.).
PolicyObserver
Observer invoked whenever a policy decision is produced.

Functions§

validate_message
Validates an MXP message against configured limits.

Type Aliases§

HandlerResult
Result alias for handler operations.
KernelResult
Result alias for kernel operations.
LifecycleResult
Result alias used for lifecycle operations.
RecoveryResult
Result type for recovery operations.
RegistryResult
Result alias for registry operations.
SchedulerResult
Result alias for scheduler operations.
ShutdownResult
Result type for shutdown operations.
ValidationResult
Result alias for validation operations.