Skip to main content

Module kernel

Module kernel 

Source
Available on crate feature harness-kernel only.
Expand description

The agent kernel, the always-on form of the harness (spec 3.2 §8.2).

Everything adk-kernel exports: the Kernel supervisor and its builder, the process table, wake sources, the event bus and the control plane adk-rust up serves.

Available with feature: harness-kernel (included in enterprise and full)

§Example

use std::sync::Arc;
use adk_rust::kernel::{Kernel, KernelConfig, QueueClass};

let kernel = Kernel::builder()
    .config(KernelConfig::default().with_app_name("ops"))
    .run_store(Arc::new(adk_rust::InMemoryRunStore::new()))
    .build()
    .unwrap();
assert_eq!(kernel.config().queues, QueueClass::defaults());

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).
channelschannels
The chat channel contract (spec 3.3 §5.3, §10 K1, §11 S-I5, S-I6, S-I10; feature channels).
chartercharter
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).
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 at GET /api/kernel/inventory.
kernel
The supervisor (spec 3.2 §7.2).
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.
procproc
/proc: the kernel’s self-observation (spec 3.2 §7.10, §13 Q4; feature proc).
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).
serviceservice
Service installation (spec 3.2 §7.12, §10 W3): adk-rust up kept 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).

Structs§

AgedProcess
A process the review reports (spec 3.2 §7.4).
Agenda
The agenda of a kernel (spec 3.2 §7.5): proposals, approvals and the processes items become. Kernel::agenda returns it; cloning shares it.
AgendaAnswer
A person’s answer to a question item (AgendaOrigin::is_question), recorded on the item when it closes (spec 3.2 §7.10).
AgendaFilter
Which agenda items AgendaStore::list returns (spec 3.2 §7.5, §8.1 adk-rust agenda list). An empty field matches everything.
AgendaHandle
A handle on a kernel’s agenda that does not keep the kernel alive, bound when the kernel is built (spec 3.2 §7.5, §10 HK1): the harness’s propose_followup tool exists before the kernel that hosts it.
AgendaItem
One item of the agenda (spec 3.2 §7.5).
ApprovalWakeSource
Wakes on decided approvals (spec 3.2 §7.4): an ApprovalNotifier registered on StoreApprovalService::with_notifier whose decisions it publishes as wake events keyed keys::approval.
AuditSink
Writes the events that are audit records to the signed audit log (spec 3.2 §7.6, §9.3), kind Other(KERNEL_AUDIT_KIND) with the kernel.* actions of crate::audit.
ConsolidationTick
The consolidation tick of one partition (spec 3.2 §7.5, §13 Q1, Q12).
CronWakeSource
A cron wake source over adk_agent::ambient::CronTrigger (spec 3.2 §7.4); keys keys::cron.
Crossing
One request reaching from one partition into another (spec 3.2 §7.8).
CrossingFilter
Which crossing records PartitionStore::crossings returns. An empty field matches everything.
CrossingRecord
One entry of the crossing ledger (spec 3.2 §7.8, §9.3): who crossed where, when, in which run, and what happened. It holds a digest of the crossing fingerprint, never the call’s arguments.
CrossingTool
A tool of another partition offered to the coordinator (spec 3.2 §7.8): a driver’s tool, or a tool reading another partition’s sessions, named <to>__<tool> and governed as a crossing by the coordinator’s PartitionPolicy, with which it registers itself.
EventBus
The kernel’s event bus (spec 3.2 §7.6).
EventFilter
Which KernelEvents a sink delivers, by kind (spec 3.2 §7.6).
EventRecord
A numbered KernelEvent as the bus delivers it (spec 3.2 §7.6).
EventSubscriber
A subscription to the EventBus (spec 3.2 §7.6).
FileWakeSource
A file-change wake source over adk_agent::ambient::FileWatchTrigger (spec 3.2 §7.4); keys keys::file, reading the modification time when the event arrives.
GoalProgress
Where a goal process stands (spec 3.2 §7.3, §10 HK3): iteration of max, spend, duration, and the last check’s exit code and output tail.
InMemoryAgendaStore
An AgendaStore in process memory, for tests and a kernel with no durable store (spec 3.2 §7.5). Its items end with the process.
InMemoryCronWatermarkStore
A CronWatermarkStore in process memory, for tests and a kernel with no durable store (spec 3.2 §7.4). Its cursors end with the process, so a restarted kernel over it sees no tick it missed.
InMemoryPartitionStore
A PartitionStore in process memory, for tests and a kernel with no durable store (spec 3.2 §7.8). Its records end with the process.
InMemoryProcessStore
A ProcessStore in process memory, for tests and a kernel with no durable store (spec 3.2 §7.3). Its rows end with the process.
Kernel
The resident supervisor (spec 3.2 §7.2). Cloning shares the kernel.
KernelBuilder
Builds a Kernel (spec 3.2 §7.2).
KernelConfig
How the kernel runs (spec 3.2 §7.2).
KernelHealth
The kernel’s health (spec 3.2 §7.2): per worker, scheduler lag and store latency.
KernelWakeExecutor
Executes kernel.wake runs on the maintenance worker: decodes the WakeEvent a webhook or queue delivery carried and routes it (spec 3.2 §7.4).
Partition
A partition (spec 3.2 §7.8): a policy class plus a memory scope plus a driver set, run by its own HarnessAgent built with default_mode.
PartitionId
Names a partition: work, home, a team (spec 3.2 §7.8).
PartitionPolicy
The policy of one partition’s harness (spec 3.2 §7.8, K-I15): a ToolPolicy that decides the calls of its crossing tools and lets every other call through, so it composes with the harness policy through StrictestPolicy and never loosens it (K-I6).
Partitions
The partition table and its crossings (spec 3.2 §7.8): reads and changes partitions with kernel.partition.created and kernel.partition.changed records, builds each partition’s PartitionPolicy, and keeps the crossing ledger the policy and the crossing tools write and the run’s approvals are read from. Cloning shares it.
PlanRef
The plan an agent proposed with its follow-up (spec 3.2 §7.5, spec 3.1 §7.11): the steps as the harness writes them, each a spec 3.1 PlanStep in JSON, and their digest. The kernel stores them without reading them (§6 D-1).
ProactivityPolicy
The proactivity limits of a partition (spec 3.2 §7.5, §9.1 runaway proactivity).
Process
A process as ps shows it: the run, the kernel’s side table and the live view (spec 3.2 §7.3).
ProcessFilter
Which processes ps lists (spec 3.2 §7.3, §8.1 adk-rust ps [--partition P] [--state S]).
ProcessHandle
A handle on a running kernel’s processes that does not keep the kernel alive, given to a ProgressSource by ProgressSource::attach (spec 3.2 §7.3).
ProcessMeta
The kernel-owned side table of one process, keyed by run id (spec 3.2 §7.3, §6 D-2).
ProcessSpec
What ProcessTable::spawn records beside the run it enqueues (spec 3.2 §7.3).
ProcessTable
The process table: a view over DurableRunStore plus the kernel’s ProcessStore (spec 3.2 §7.3).
ProcessView
A process’s live aggregates (spec 3.2 §7.3, §7.10, §13 Q4): what ps and top show, computed by sum and count over the kernel’s records. Spend is in micro-USD, as SpendLedger counts it; the kernel attributes each charge to the run that made it and keeps daily totals per process (ProcessStore::spend).
QuietHours
A daily local-time window in which proactive and maintenance processes never start (spec 3.2 §7.5, §7.9, K-I11); interactive and approval-woken runs always may.
Quotas
A partition’s quotas (spec 3.2 §7.9): enforced at admission, they bound each partition within a queue so none starves another (§13 Q2). None leaves a quota unlimited.
RecurringCrossing
A crossing that keeps happening (spec 3.2 §7.8): what the maintenance process reports, with partition membership as the remedy, never a waiver.
ReviewReport
One partition’s review (spec 3.2 §7.4, §9.1): what is older than its review period.
RuleAge
When a standing rule was granted and whether it expires, as the review reads it (spec 3.2 §9.1).
RunFinishedWakeSource
Wakes on finished processes (spec 3.2 §7.4): fed by the worker’s S1 on_finish hook, it publishes each finished run as a wake event keyed keys::run_finished.
RunNow
What Kernel::run_now queued.
RunUsage
What a session’s runs have used so far, as the hosted agent counts it (spec 3.2 §7.3, §7.10): model calls, tool calls, cost in micro-USD, total tokens and the usage per UsageUnit (BudgetTracker::units).
SourceWatermark
The cursor of one cron source in a CronWatermarkStore, as the adk_agent::ambient::TickWatermark a CronWakeSource or a CronTrigger keeps (spec 3.2 §7.4).
SpendDelta
Usage a process committed (spec 3.2 §7.6): the cost in micro-USD as SpendLedger counts it, the model calls and tokens a run budget counts, and the usage per UsageUnit.
SqliteAgendaStoresqlite
An AgendaStore in SQLite (spec 3.2 §7.1, §7.5, feature sqlite).
SqliteCronWatermarkStoresqlite
A CronWatermarkStore in SQLite (spec 3.2 §7.4, feature sqlite).
SqlitePartitionStoresqlite
A PartitionStore in SQLite (spec 3.2 §7.1, §7.8, feature sqlite).
SqliteProcessStoresqlite
A ProcessStore in SQLite (spec 3.2 §7.1, feature sqlite).
StaleRule
A standing rule the review asks to renew (spec 3.2 §9.1).
Steering
A message a running process holds for its agent’s next safe point (spec 3.3 §6 “steer”): what Kernel::steer answers.
SubagentHandle
A handle on a kernel’s sub-agent host that does not keep the kernel alive, bound when the kernel is built with it: an agent’s sub-agent tools exist before the kernel that hosts the agent. Until bound, and after the kernel is gone, every operation fails with subagent.unavailable.
TickInputs
What the tick gate reads (spec 3.2 §7.5): a partition’s TickMaterial with the kernel’s view of it.
TickMaterial
What a partition holds for a consolidation tick, as its Consolidator reports it (spec 3.2 §7.5).
TickOutcome
What one tick did, in counts, and what it proposes (spec 3.2 §7.5).
TickProposal
A follow-up a tick proposes; the kernel files it as an AgendaOrigin::Consolidation item, which a person approves in every mode (K-I23).
TickRun
One tick a Consolidator runs (spec 3.2 §7.5).
TickSpend
What the consolidation ticks of a partition spent today (spec 3.2 §7.5): what budget_share is measured against.
Trigger
A standing wake that starts a new process each time it fires, when no sleeping process matched (spec 3.2 §7.4 step 3): a sleeper consumes the event, a trigger is the fallback.
UsageTotals
What a process or a partition used over a span of UTC days (ProcessStore::usage).
VisionWakeSource
A WakeSource for one camera, screen or browser stream (spec 3.7 §7.10): each VisualWake published becomes a WakeEvent named after the stream and keyed keys::vision, which Wake::Queue { source } matches.
VisualFrame
The frame a visual wake names: its place in the stream, the digest of its encoded bytes, its size, and the artifact it is kept as.
VisualRegion
One region of a visual wake: its box in source pixels, label, score and track.
VisualWake
A watch condition that passed on a stream, as the kernel takes it: the condition, what happened, the track with its label and score, the frame, and the regions that met the condition in it, the track’s first.
WakeEvent
One wake delivered by a WakeSource (spec 3.2 §7.4).
WakeReason
Why a process woke, as its next turn is told (spec 3.2 §7.4 step 3): the event’s source, key and time, and its payload as compact JSON cut to WAKE_PAYLOAD_LIMIT bytes.
WakeReasonHooks
Gives each woken turn its WakeReason (spec 3.2 §7.4 step 5): the WorkerHooks::wake_input of a DurableWorker whose runs a WakeRouter wakes. A Kernel registers the same lookup on its own workers; this is for a worker composed without one.
WakeRouter
The wake matcher (spec 3.2 §7.4 steps 2–3): routes each WakeEvent to the sleeping processes and Triggers it matches.
WakeSet
The conditions that wake a sleeping process: any one of them (spec 3.2 §7.4).
WebhookSinkwebhooks
Delivers the kernel’s events to an HTTP endpoint as signed webhooks (spec 3.2 §7.6).
WorkerHealth
One worker’s health (spec 3.2 §7.2).

Enums§

AgendaOrigin
Who proposed an AgendaItem (spec 3.2 §7.5).
AgendaState
Where an AgendaItem stands (spec 3.2 §7.5).
AgendaStateKind
The kind of an AgendaState, without its payload: what an AgendaFilter selects and an AgendaStore::transition compares (spec 3.2 §7.5).
CrossPartition
Whether a partition takes part in crossings (spec 3.2 §7.8).
CrossingAccess
Whether a crossing only reads (spec 3.2 §7.8, §13 Q3).
CrossingOutcome
What happened to a crossing (spec 3.2 §9.3 kernel.partition.crossing).
CrossingResource
What a crossing reaches (spec 3.2 §7.8): the resource class of its fingerprint.
CrossingRoute
How a crossing tool’s call names what it reaches (spec 3.2 §7.8).
CrossingRun
The run an approved read holds for (spec 3.2 §13 Q3): a durable run, across the invocations that resume it, or one invocation outside a durable run.
EventKind
The kind of a KernelEvent, named as its type field serializes it (spec 3.2 §7.6).
ExpiryAction
What happens when a WakeSet expires before any wake fires (spec 3.2 §7.4).
KernelError
What went wrong in the kernel (spec 3.2 §7.1).
KernelEvent
A change in the kernel (spec 3.2 §7.6).
KernelState
Where the kernel is in its lifecycle (spec 3.2 §7.2).
PartitionMode
A partition’s default mode (spec 3.2 §7.8): what its agents may do without asking.
ProactiveApproval
How agenda proposals are approved (spec 3.2 §7.5).
ProcessKind
What kind of work a process is (spec 3.2 §7.3).
ProposalOutcome
What Agenda::propose did with a proposal (spec 3.2 §7.5).
QueueClass
A priority class: the run-store queue a process waits in and the worker that claims it (spec 3.2 §7.9).
RunNowTarget
What Kernel::run_now runs now.
SpendScope
Whose spend ProcessStore::spend sums (spec 3.2 §7.3, §7.10).
Suspension
Why a process is parked by a suspension rather than a wake set (spec 3.2 §7.3).
TickAdmission
The tick gate’s decision (spec 3.2 §7.5).
Wake
One condition that wakes a sleeping process (spec 3.2 §7.4).
WakeOutcome
What one routed WakeEvent did to one process (spec 3.2 §7.4, §9.3 kernel.wake).
WakeOverlap
What a standing wake’s firing does while a process it started is unfinished — queued, running, or waiting (on a person, a sleep, a freeze or admission) — (spec 3.2 §7.4, §7.9). A Trigger and a managed wake set take one; skip is the default.

Constants§

AGENDA_TOOL_NAME
The approval-inbox tool name of agenda proposals (spec 3.2 §7.5): an Ask partition’s proposal waits in the inbox as an ApprovalRequest with this tool_name, the item as args_redacted and allowed_actions = [Approve, Edit, Reject].
COALESCED_LABEL
The label on the row of a trigger’s process waiting to start that counts the firings that joined it (WakeOutcome::Coalesced), as a decimal number; adk-rust ps shows it.
CONSOLIDATION_LABEL
The label a tick’s process carries, with the value consolidation (spec 3.2 §7.5).
CONSOLIDATION_TARGET
The workflow a consolidation tick runs as (spec 3.2 §7.5): a Maintenance durable run on the maintenance queue.
CROSSING_PARTITION_ARG
The argument naming the target partition of a crossing tool whose CrossingRoute is Argument.
DEFAULT_EVENT_CAPACITY
How many events a subscriber may fall behind before it skips ahead.
KERNEL_WAKE_TARGET
The target of a kernel.wake run: a webhook or queue delivery the maintenance worker turns into a routed wake (spec 3.2 §7.4).
RUN_NOW_SOURCE
The source of the wake Kernel::run_now submits.
SKIPPED_LABEL
The label on the row of a trigger’s unfinished process that counts the firings its WakeOverlap::Skip skipped while it ran, as a decimal number; adk-rust ps shows it.
SUBAGENT_LABEL
The label of a sub-agent’s processes that holds its id.
SUBAGENT_NAME_LABEL
The label of a sub-agent’s processes that holds its name.
SUBAGENT_NOTICE_SOURCE
The source of the processes that tell a parent about its sub-agent: triggered:subagent.
VISION_PAYLOAD_KIND
The kind of every visual wake payload.
WAKE_PAYLOAD_LIMIT
The most bytes of a wake’s payload, as compact JSON, a WakeReason keeps (spec 3.2 §7.4). The kernel.wake run keeps the whole payload.

Traits§

AgendaStore
The kernel’s store of agenda items (spec 3.2 §7.5, §13 Q8), on every backend the ProcessStore has.
Consolidator
The memory a consolidation tick works on (spec 3.2 §7.5, §6 D-1): the kernel reads no harness type, so the harness implements this for a partition (adk_harness::Harness::consolidator) and registers it with KernelBuilder::consolidator.
CronWatermarkStore
Where each cron wake source left off (spec 3.2 §7.4, §7.13): the instant through which its ticks are accounted for, by source name.
EventSink
A destination for kernel events (spec 3.2 §7.6): the SSE stream, a channel notifier, an outbound webhook, the audit log.
ObservationAudience
Whom a partition’s observations are put to, and where a confirmed one is remembered (spec 3.2 §7.10, spec 3.1 §7.15): the kernel reads no harness type, so the harness implements this over its long-term memory (adk_harness::Harness::observation_audience) and registers it with KernelBuilder::observation_audience.
PartitionStore
The partition table and the crossing ledger (spec 3.2 §7.8, §13 Q8), on every backend ProcessStore has: InMemoryPartitionStore, SqlitePartitionStore, PostgresPartitionStore and RedisPartitionStore, with one conformance suite (partition_store_conformance_tests!, feature conformance).
ProcessStore
The kernel’s side table of process metadata, keyed by run id (spec 3.2 §7.3, §6 D-2).
ProgressSource
Reports what only the hosted agent knows about a process: a goal’s progress, the loop guard’s verdict and the session’s usage (spec 3.2 §7.3, §10 HK3).
StandingRuleSource
Reads the standing rules the review checks (spec 3.2 §9.1): the harness implements it over its rule store and Harness::kernel registers it (KernelBuilder::standing_rules).
WakeSource
A source of wake events: an adapter over adk_agent::ambient::EventSource where one exists (spec 3.2 §7.4).

Functions§

admit_tick
Whether tick admits a consolidation tick on inputs (spec 3.2 §7.5, §13 Q1), and with what budget.
kernel_wake_run
Builds the kernel.wake run a webhook or queue delivery enqueues: target KERNEL_WAKE_TARGET on the maintenance queue, keyed by event.key, with the event as input, acting as a Service subject (spec 3.2 §7.4).
queue_wake_ingress
Builds the ingress that turns each message of source into a kernel.wake run keyed keys::queue (spec 3.2 §7.4); the kernel runs it with QueueIngress::run.
vision_payload
The payload of wake from the stream source, as compact JSON within WAKE_PAYLOAD_LIMIT bytes: kind (vision), source, session, condition, event, label, score, track, frames, frame (index, capturedAt, digest, width, height, artifact), regions (each box, label, score, track) and moreRegions, the count of regions left out.
webhook_wake_hookwebhooks
Builds the webhook hook served at /hooks/{name} whose verified deliveries become kernel.wake runs keyed keys::webhook by the ingress (spec 3.2 §7.4, feature webhooks). Register it with WebhookIngress::with_hook.

Type Aliases§

Result
Result of a fallible kernel operation (spec 3.2 §7.1).