Expand description
§adk-kernel
The Agent Kernel of ADK-Rust, the always-on form of the harness (spec 3.2,
docs/design/spec-3.2-agent-kernel.md): a resident supervisor with a process model,
wake semantics, an event bus and a control plane, composed from the durable-run
machinery adk-core and adk-server already hold.
Three rules shape it (§1):
- Always resumable, not always running. A process is a durable run; asleep is
Waitingwith a recordedWakeSetand no lease, so a sleeping agent makes no model call (K-I2). - Every wake is a governed run. A wake produces a
NewRunor wakes a parked run; nothing calls a tool outside a run (K-I1), so policy, guardrails, confirmation, the action ledger and audit apply as for an interactive turn. - The kernel owns state, surfaces attach. CLI, web and phone are terminals on one
running system over the
controlplane (K-I17).
adk-kernel hosts any Arc<Runner> and depends on no harness type (§6 D-1); the
kernel feature of adk-harness carries the glue (§10 HK1), and adk-rust up starts
it.
| Item | Spec |
|---|---|
Kernel, KernelBuilder, KernelConfig, KernelHealth, KernelState | §7.2 |
Process, ProcessMeta, ProcessView, GoalProgress, ProcessKind, Suspension, ProcessTable, ProcessSpec, ProgressSource | §7.3 |
inventory: KernelInventory, InventoryWarning, Kernel::inventory, GET /api/kernel/inventory; KernelBuilder::signals and Kernel::signal_sink (feature charter) | §7.1, §7.4 |
stores::KernelStores, stores::StoreUse, stores::StoreOrigin: every stateful store on one backend, KernelBuilder::stores, KernelBuilder::require_durable, Kernel::store_uses | §7.1, §13 Q8 |
ProcessStore, ProcessFilter, SpendScope, InMemoryProcessStore, SqliteProcessStore, PostgresProcessStore, RedisProcessStore, MongoProcessStore, FirestoreProcessStore, Neo4jProcessStore | §7.3, §13 Q8 |
Wake, WakeSet, ExpiryAction, WakeSource, WakeEvent, keys, Trigger, WakeOverlap, WakeRouter, WakeOutcome, KernelWakeExecutor, the wake source adapters | §7.4 |
vision: VisionWakeSource, VisualWake, VisualFrame, VisualRegion, vision_payload; with feature vision, the source as an adk-vision WatchSink | spec 3.7 §7.10 |
CronWatermarkStore, SourceWatermark, InMemoryCronWatermarkStore, SqliteCronWatermarkStore, PostgresCronWatermarkStore, RedisCronWatermarkStore, MongoCronWatermarkStore, FirestoreCronWatermarkStore, Neo4jCronWatermarkStore | §7.4, §7.13, §13 Q8 |
KernelEvent, EventKind, EventFilter, EventRecord, EventBus, EventSubscriber, EventSink, AuditSink, SpendDelta; WebhookSink (feature webhooks) | §7.6 |
Agenda, AgendaHandle, ProposalOutcome, AgendaItem, AgendaState, AgendaStateKind, AgendaOrigin, AgendaAnswer, ObservationAudience, PlanRef, AgendaStore, AgendaFilter, InMemoryAgendaStore, ProactivityPolicy, ProactiveApproval | §7.5 |
agents: AgentRecord, AgentStore on every backend, AgentFactory, AgentCaller, AgentPreview | spec 3.3 §5.7, §10 K7 |
ConsolidationTick, Consolidator, admit_tick, TickInputs, TickAdmission, TickMaterial, TickRun, TickOutcome, TickProposal, TickSpend, CONSOLIDATION_TARGET, CONSOLIDATION_LABEL | §7.5, §13 Q1, Q12 |
ReviewReport, StandingRuleSource, RuleAge, StaleRule, AgedProcess | §7.4, §9.1 |
QueueClass, QuietHours, Quotas | §7.9 |
drivers: DriverManifest, EffectClass, DriverStore, DriverSupervisor, DriverPolicy (feature drivers) | §7.7 |
proc (feature proc): Ledger, LedgerEntry, LedgerStore on every backend, LedgerSink, LedgerAuditTap; proc::baselines (feature proc-baselines): BaselinePass, BaselinePolicy, ObservationPhraser, Observation | §7.10 |
PartitionId, PartitionMode, Partition, CrossPartition, PartitionStore, InMemoryPartitionStore, SqlitePartitionStore, PostgresPartitionStore, RedisPartitionStore, MongoPartitionStore, FirestorePartitionStore, Neo4jPartitionStore; Partitions | §7.8 |
Crossing, CrossingResource, CrossingAccess, CrossingRun, CrossingRecord, CrossingOutcome, CrossingFilter, CrossingRoute, PartitionPolicy, CrossingTool | §7.8, §13 Q3, K-I15 |
control: ControlPlaneConfig, router, ControlPlane, ControlClient, api | §7.11 |
audit action names | §9.3 |
subagents: background sub-agents as processes of kind ProcessKind::Subagent, KernelBuilder::subagents, Kernel::subagents, SubagentHandle, KernelEvent::Subagent | adk_core::subagent |
service (feature service): ServiceDefinition, install, uninstall, run_as_service (Windows) | §7.12, §10 W3 |
conformance (feature conformance) | §11 |
managed (feature managed): KernelDef, TenantKernel, KernelResolver, ManagedKernels | §7.13, §10 M1 |
pairing: Pairing, DeviceScope, DeviceStore on every backend, DeviceTokenExtractor | spec 3.3 §10 K2 |
channels (feature channels): ChannelSink, ChannelGateway, ChannelBindingStore on every backend, InMemoryChannel | spec 3.3 §10 K1 |
Agenda and proactivity (§7.5) and attention and resources (§7.9) are phase 2; drivers (§7.7) and partitions (§7.8) phase 3; channel wakes phase 5. Each adds to these types without changing them.
§Features
| Feature | Default | Pulls in |
|---|---|---|
sqlite | on | SqliteProcessStore, on the pool of harness.db |
postgres, redis | off | PostgresProcessStore, RedisProcessStore, opened from the URL of adk-rust serve --store |
mongodb, firestore, neo4j | off | The process, agenda, driver, ledger, partition and cron watermark stores on MongoDB, Firestore or Neo4j (MongoProcessStore, FirestoreProcessStore, Neo4jProcessStore and the stores beside them), with the same backend of adk-session’s run, schedule and governance stores |
webhooks | on | webhook_wake_hook over adk-server’s WebhookIngress; WebhookSink, the outbound webhook sink over adk-core’s signed delivery |
drivers | on | drivers: manifests, the driver store, the supervisor over adk-tool’s MCP manager, the stdio launcher on adk-sandbox |
service | on | The service module: adk-rust up as a launchd agent, a systemd user unit or a Windows service (windows-service on Windows) |
proc | on | The content-free activity ledger (proc), its stores and GET /api/kernel/proc/*; the OTel GenAI histograms of the live aggregates |
proc-baselines | off | The daily baseline pass and observations over adk-eval’s ledger statistics (implies proc; the only adk-eval edge) |
channels | off | The chat channel contract (spec 3.3 §10 K1): the channels module, its binding store on every backend, and the adapter contract suite with conformance |
managed | off | The managed form: KernelDef in a managed definition, one kernel per tenant (adk-managed) |
charter | off | charter (spec 3.5 §7.10, §7.11): the charter store, the KPI tracker, autonomy records, signals and the site process kinds, on every backend of the process store |
vision | off | The bridge from adk-vision (spec 3.7 §7.10): VisionWakeSource as a WatchSink and VisualWake from a WatchEvent; the source itself needs no feature |
conformance | off | The conformance module |
§Example
use std::sync::Arc;
use adk_core::InMemoryRunStore;
use adk_kernel::{Kernel, KernelConfig, ProcessFilter};
let kernel = Kernel::builder()
.config(KernelConfig::default())
.run_store(Arc::new(InMemoryRunStore::new()))
.agent("adk-rust", runner)
.build()?;
kernel.start().await?;
for process in kernel.processes().ps(ProcessFilter::default()).await? {
println!("{} {:?} {}", process.meta.pid, process.run.state, process.meta.kind);
}
kernel.shutdown_on_signal().await?;§Stability
Beta — new in 3.0.0, and its process model, wake sources and control plane are still taking shape in use. See STABILITY.md.
Re-exports§
pub use agenda::AGENDA_TOOL_NAME;pub use agenda::Agenda;pub use agenda::AgendaAnswer;pub use agenda::AgendaFilter;pub use agenda::AgendaHandle;pub use agenda::AgendaItem;pub use agenda::AgendaOrigin;pub use agenda::AgendaState;pub use agenda::AgendaStateKind;pub use agenda::AgendaStore;pub use agenda::ObservationAudience;pub use agenda::PlanRef;pub use agenda::ProactiveApproval;pub use agenda::ProactivityPolicy;pub use agenda::ProposalOutcome;pub use bus::WebhookSink;pub use bus::AuditSink;pub use bus::DEFAULT_EVENT_CAPACITY;pub use bus::EventBus;pub use bus::EventFilter;pub use bus::EventKind;pub use bus::EventRecord;pub use bus::EventSink;pub use bus::EventSubscriber;pub use bus::KernelEvent;pub use bus::SpendDelta;pub use consolidation::CONSOLIDATION_LABEL;pub use consolidation::CONSOLIDATION_TARGET;pub use consolidation::ConsolidationTick;pub use consolidation::Consolidator;pub use consolidation::TickAdmission;pub use consolidation::TickInputs;pub use consolidation::TickMaterial;pub use consolidation::TickOutcome;pub use consolidation::TickProposal;pub use consolidation::TickRun;pub use consolidation::TickSpend;pub use consolidation::admit_tick;pub use error::KernelError;pub use error::Result;pub use kernel::Kernel;pub use kernel::KernelBuilder;pub use kernel::KernelConfig;pub use kernel::KernelHealth;pub use kernel::KernelState;pub use kernel::RunNow;pub use kernel::RunNowTarget;pub use kernel::Steering;pub use kernel::WorkerHealth;pub use partition::CROSSING_PARTITION_ARG;pub use partition::CrossPartition;pub use partition::Crossing;pub use partition::CrossingAccess;pub use partition::CrossingFilter;pub use partition::CrossingOutcome;pub use partition::CrossingRecord;pub use partition::CrossingResource;pub use partition::CrossingRoute;pub use partition::CrossingRun;pub use partition::CrossingTool;pub use partition::Partition;pub use partition::PartitionId;pub use partition::PartitionMode;pub use partition::PartitionPolicy;pub use partition::PartitionStore;pub use partition::Partitions;pub use partition::RecurringCrossing;pub use process::GoalProgress;pub use process::Process;pub use process::ProcessHandle;pub use process::ProcessKind;pub use process::ProcessMeta;pub use process::ProcessSpec;pub use process::ProcessTable;pub use process::ProcessView;pub use process::ProgressSource;pub use process::RunUsage;pub use process::Suspension;pub use review::AgedProcess;pub use review::ReviewReport;pub use review::RuleAge;pub use review::StaleRule;pub use review::StandingRuleSource;pub use sched::QueueClass;pub use sched::QuietHours;pub use sched::Quotas;pub use stores::FirestoreAgendaStore;pub use stores::FirestoreCronWatermarkStore;pub use stores::FirestorePartitionStore;pub use stores::FirestoreProcessStore;pub use stores::MongoAgendaStore;pub use stores::MongoCronWatermarkStore;pub use stores::MongoPartitionStore;pub use stores::MongoProcessStore;pub use stores::Neo4jAgendaStore;pub use stores::Neo4jCronWatermarkStore;pub use stores::Neo4jPartitionStore;pub use stores::Neo4jProcessStore;pub use stores::PostgresAgendaStore;pub use stores::PostgresCronWatermarkStore;pub use stores::PostgresPartitionStore;pub use stores::PostgresProcessStore;pub use stores::RedisAgendaStore;pub use stores::RedisCronWatermarkStore;pub use stores::RedisPartitionStore;pub use stores::RedisProcessStore;pub use stores::SqliteAgendaStore;pub use stores::SqliteCronWatermarkStore;pub use stores::SqlitePartitionStore;pub use stores::SqliteProcessStore;pub use stores::InMemoryAgendaStore;pub use stores::InMemoryCronWatermarkStore;pub use stores::InMemoryPartitionStore;pub use stores::InMemoryProcessStore;pub use stores::ProcessFilter;pub use stores::ProcessStore;pub use stores::SpendScope;pub use stores::UsageTotals;pub use subagents::SUBAGENT_LABEL;pub use subagents::SUBAGENT_NAME_LABEL;pub use subagents::SUBAGENT_NOTICE_SOURCE;pub use subagents::SubagentHandle;pub use vision::VISION_PAYLOAD_KIND;pub use vision::VisionWakeSource;pub use vision::VisualFrame;pub use vision::VisualRegion;pub use vision::VisualWake;pub use vision::vision_payload;pub use wake::webhook_wake_hook;pub use wake::ApprovalWakeSource;pub use wake::COALESCED_LABEL;pub use wake::CronWakeSource;pub use wake::ExpiryAction;pub use wake::FileWakeSource;pub use wake::KERNEL_WAKE_TARGET;pub use wake::KernelWakeExecutor;pub use wake::RUN_NOW_SOURCE;pub use wake::RunFinishedWakeSource;pub use wake::SKIPPED_LABEL;pub use wake::Trigger;pub use wake::WAKE_PAYLOAD_LIMIT;pub use wake::Wake;pub use wake::WakeEvent;pub use wake::WakeOutcome;pub use wake::WakeOverlap;pub use wake::WakeReason;pub use wake::WakeReasonHooks;pub use wake::WakeRouter;pub use wake::WakeSet;pub use wake::WakeSource;pub use wake::kernel_wake_run;pub use wake::keys;pub use wake::queue_wake_ingress;pub use watermark::CronWatermarkStore;pub use watermark::SourceWatermark;
Modules§
- agenda
- The agenda: proactivity under control (spec 3.2 §7.5).
- agents
- Agents a person adds (spec 3.3 §5.7, §10 K7): by asking or by hand, kept by the kernel, hosted beside the primary agent, and changed, paused or removed from the web home and the terminal.
- audit
- Audit actions of the kernel (spec 3.2 §9.3).
- bus
- The event bus (spec 3.2 §7.6).
- channels
- The chat channel contract (spec 3.3 §5.3, §10 K1, §11 S-I5, S-I6, S-I10; feature
channels). - charter
- The site’s charter, its KPIs, its jobs’ earned autonomy and the signals the public
partition sends the back office (spec 3.5 §7.6, §7.10, §7.11, §7.21; feature
charter). - conformance
- Conformance suites for kernel store backends (spec 3.2 §11, §13 Q8; feature
conformance). - consolidation
- The consolidation tick (spec 3.2 §7.5, §13 Q1, Q12).
- control
- The control plane (spec 3.2 §7.11).
- drivers
- Drivers: MCP servers run as supervised child processes under a manifest the user approved (spec 3.2 §7.7).
- error
- The kernel’s error type (spec 3.2 §7.1).
- inventory
- What a kernel runs, and what it would silently not do (spec 3.2 §7.1, §7.4; #1278):
Kernel::inventory, logged when the kernel starts and served atGET /api/kernel/inventory. - kernel
- The supervisor (spec 3.2 §7.2).
- managed
- The managed form of the kernel (spec 3.2 §7.13, §10 M1; feature
managed). - pairing
- Device pairing (spec 3.3 §10 K2, §11 S-I7): short-lived pairing codes, then scoped, expiring, revocable device tokens, stored hashed.
- partition
- Partitions (spec 3.2 §7.8): areas of a user’s life or an organisation’s teams kept apart, with work across them only through the coordinator and under approval.
- proc
/proc: the kernel’s self-observation (spec 3.2 §7.10, §13 Q4; featureproc).- process
- The process model (spec 3.2 §7.3).
- review
- The review the maintenance tick makes of what may have drifted (spec 3.2 §7.4, §9.1 permission drift).
- sched
- Queue classes (spec 3.2 §7.9).
- service
- Service installation (spec 3.2 §7.12, §10 W3):
adk-rust upkept running by the platform’s service manager, as the user, logging to the kernel home and restarting on failure. - stores
- The kernel-owned stores and their backends (spec 3.2 §7.1, §7.3, §13 Q8).
- subagents
- Background sub-agents as kernel processes.
- vision
- Visual wake sources (spec 3.7 §7.10).
- wake
- Sleep and wake (spec 3.2 §7.4).
- watermark
- Cron watermarks: where each cron wake source left off, so the ticks it missed while no kernel watched replay once, per the schedule’s catch-up policy (spec 3.2 §7.4, §7.13).
Macros§
- agenda_
store_ conformance_ tests - Generates one test per
agenda_storecase for anAgendaStoreHarness(spec 3.2 §7.5, §11). - agent_
store_ conformance_ tests - Generates one test per
agent_storecase for anAgentStoreHarness(spec 3.3 §5.7, §10 K7). - autonomy_
store_ conformance_ tests - Generates one test per
autonomy_storecase for anAutonomyStoreHarness(spec 3.5 §7.11, §11). - channel_
binding_ store_ conformance_ tests - Generates one test per
channel_binding_storecase for aChannelBindingStoreHarness(spec 3.3 §10 K1; featurechannels). - channel_
contract_ tests - Generates one test per
channel_contractcase for aChannelAdapterHarness(spec 3.3 §10 K1; featurechannels). - charter_
store_ conformance_ tests - Generates one test per
charter_storecase for aCharterStoreHarness(spec 3.5 §7.11, §11). - control_
store_ conformance_ tests - Generates one test per
control_storecase for aControlStoreHarness(spec 3.3 §10 K3, K4). - cron_
watermark_ store_ conformance_ tests - Generates one test per
cron_watermark_storecase for aCronWatermarkStoreHarness(spec 3.2 §7.4, §11). - device_
store_ conformance_ tests - Generates one test per
device_storecase for aDeviceStoreHarness(spec 3.3 §10 K2). - driver_
store_ conformance_ tests - Generates one test per
driver_storecase for aDriverStoreHarness(featuredrivers). - kpi_
store_ conformance_ tests - Generates one test per
kpi_storecase for aKpiStoreHarness(spec 3.5 §7.11, §11). - ledger_
store_ conformance_ tests - Generates one test per
ledger_storecase for aLedgerStoreHarness(spec 3.2 §7.10, §11; featureproc). - partition_
store_ conformance_ tests - Generates one test per
partition_storecase for aPartitionStoreHarness(spec 3.2 §7.8, §11). - process_
store_ conformance_ tests - Generates one test per
process_storecase for aProcessStoreHarness. - signal_
store_ conformance_ tests - Generates one test per
signal_storecase for aSignalStoreHarness(spec 3.5 §7.10, §11).