Expand description
§adk-surface
Agent surfaces for ADK-Rust (spec 3.3): one engine under every window a person opens onto their agents — the web home, the terminal, chat, the phone, the desktop tray, voice. Nothing lives in a surface: a decision is made once, from anywhere, and every other window shows who made it.
§The engine
SurfaceEngine is always compiled. It reads a Source — an in-process kernel,
harness or runner (LocalSource), or a kernel’s control plane (ControlSource) — and
gives every surface the same three things (spec 3.3 §6):
| Part | What | Where |
|---|---|---|
| Feed | A session’s events numbered by their position in the session store, as a snapshot then a live tail, resumable after the last seq seen | SurfaceEngine::feed, SurfaceEngine::thread |
| Projection | Decision cards (§7.1), thread items, agent rows, the status line and the “While you were away” briefing, in the words of §8 | model, words |
| Commands | Decide at the version seen, send, queue, stop all, resume all, change the mode — each with its caller’s subject and Origin, audited | SurfaceEngine::execute, Command |
What each surface may decide (§7.2) and the rules on every surface (§7.4) are enforced by
the engine in rules, not left to renderers.
The live camera surface (spec 3.7 §8.2) is camera: a camera source’s facts, the hub that
drops every frame of a camera switched off or paused by Stop all, and the view model; its
routes are served with web once the engine is built with SurfaceEngineBuilder::cameras,
and with vision-camera its cameras run on adk-vision’s frame pipeline.
§Surfaces
| Feature | Surface | Stability |
|---|---|---|
web | The web home: its HTTP API under /api/surface, mounted with ServerBuilder::add_api_routes, with its OpenAPI document, and its page at /ui/, mounted with ServerBuilder::add_root_routes | Beta |
tui | The terminal (spec 3.3 §5.2): full screen, inline and JSON lines on the engine, decisions answered by key, light and dark; the adk-rust binary’s tui feature | Beta |
channels | Chat: the Telegram adapter over the kernel’s channel contract, channels::TelegramAdapter (spec 3.3 §5.3) | Beta |
whatsapp, slack, discord, matrix, teams | Chat on WhatsApp, Slack, Discord, Matrix and Microsoft Teams over the same contract, channels::WhatsAppAdapter, SlackAdapter, DiscordAdapter, MatrixAdapter, TeamsAdapter (spec 3.5 §10 X12); each implies channels | Experimental |
mobile | The phone: the web home installed on a phone, Web Push from the person’s own kernel, pairing QR codes and “Confirm it’s you”, mobile::router (spec 3.3 §5.4); implies web | Beta |
voice | Voice and video: spoken “allow once” and “deny” through the engine with a cancel window, the camera and the screen as input while their switches are on; with web, the voice view’s socket (voice::router, voice::socket_routes) (spec 3.3 §5.6) | Beta |
voice-live | voice with Gemini Live and the OpenAI Realtime API compiled in, for the live voice test and the voice_home example; a host passes its own provider models | Beta |
computer-use | Screen plans on decision cards (spec 3.7 Q8): a previewed plan of desktop actions parks as one card, decided with one answer through the harness’s computer-use pack (Harness::decide_held_screen_plan), with the plan’s binding on every step | Experimental |
vision-camera | The live camera surface on adk-vision’s frame pipeline (spec 3.7 §7.13, §8.2): camera::PipelineCameras runs each camera through StreamPipeline and reports what it measured; the voice screen’s camera through SurfaceCameraSource | Experimental |
website | The website’s views on the web home (spec 3.5 §8.2): the web editor, onboarding, the charter cards, the site view and the weekly review over adk-website’s desk, web::website::router; implies web | Experimental |
verb-ui | Screen actions people and agents share (spec 3.3 §2 item 7, §6.1): snoozing something in Coming up from the home, the terminal, voice and an agent, always through the governed path, verbs::VerbRegistry; with web, web::verbs::router | Experimental |
workflow | The workflow observer (spec 3.3 §12 developer track): a graph agent’s runs, steps and forks, card hints for its governed nodes, workflow::Workflows; with web, the Runs tab’s routes, web::workflow::router | Beta |
genui | Agent-drawn UI (spec 3.3 §6.1, §7.4 rule 5): the A2UI v0.9.1 model, the forms 1.0 catalog, the validator that keeps approval controls and secrets out of drawings, the render tools agents draw with (genui::DrawToolset), drawings in the thread and a drawn form’s Send, which asks the person first (Command::SubmitDrawn), and with web the capabilities route (web::genui::router) | Beta |
genui-apps | Apps from MCP servers in a thread (spec 3.3 §6.1): framed sandboxed on their own origin, their tool calls held for the person, never able to approve anything, genui::McpAppsHost; implies genui and web | Beta |
§Example
use std::sync::Arc;
use adk_core::{InMemoryApprovalStore, StoreApprovalService};
use adk_session::InMemorySessionService;
use adk_surface::{Caller, LocalSource, Origin, SurfaceEngine, SurfaceKind};
let source = LocalSource::builder("adk-rust")
.sessions(Arc::new(InMemorySessionService::new()))
.approvals(Arc::new(StoreApprovalService::new(Arc::new(InMemoryApprovalStore::new()))))
.build()?;
let engine = SurfaceEngine::builder(Arc::new(source)).build();
let me = Caller::human("ana", SurfaceKind::Phone, Origin::Touch);
let status = engine.status(&me, None).await?;
assert_eq!(status.decisions, 0);§Stability
Beta — new in 3.0.0; verb-ui and the WhatsApp, Slack, Discord, Matrix and Teams adapters are
Experimental. See STABILITY.md.
Re-exports§
pub use answers::AnswerLog;pub use answers::AnswerRecord;pub use answers::AnswerSummary;pub use answers::AuditAnswerLog;pub use answers::InMemoryAnswerLog;pub use answers::RECORD_LINES;pub use answers::RecordAnswerLog;pub use answers::SURFACE_AUDIT_DECIDE;pub use answers::SurfaceCount;pub use error::Result;pub use error::SurfaceError;pub use images::MAX_IMAGE_BYTES;pub use images::MAX_IMAGES;pub use images::MessageImage;pub use model::CardDetail;pub use model::AgentRef;pub use model::AgentRow;pub use model::AgentStatus;pub use model::Avatar;pub use model::Briefing;pub use model::BriefingLine;pub use model::CallView;pub use model::CardStatus;pub use model::Decided;pub use model::DecidedAnswer;pub use model::DecisionCard;pub use model::ElicitationView;pub use model::ElicitedField;pub use model::ElicitedKind;pub use model::ElicitedOption;pub use model::FeedEntry;pub use model::Mode;pub use model::ModeView;pub use model::ParkedView;pub use model::Pill;pub use model::QuietView;pub use model::Reversibility;pub use model::ScreenPlanStepView;pub use model::ScreenPlanView;pub use model::Served;pub use model::Speaker;pub use model::SpendView;pub use model::StatusLine;pub use model::ThreadItem;pub use model::TimelineStep;pub use model::CommandRun;pub use model::ImageData;pub use model::OutputLine;pub use model::RunStop;pub use model::ShellPlace;pub use model::ShellView;pub use rules::Allowed;pub use rules::Answer;pub use rules::AnswerOption;pub use rules::Risk;
Modules§
- answers
- How each answer was given (spec 3.3 §8.1 “Decided”, §11).
- camera
- The live camera surface (spec 3.7 §8.2, X12): watching a stream and acting on it, on the
web home and the phone, built to the signed-off boards (
camera-*, board choices C1–C15). - channels
- Chat channels (spec 3.3 §5.3, §6.1; feature
channels): the doorbell and the conversation, through someone else’s servers. - error
- Errors of the engine and its sources (spec 3.3 §6).
- genui
- Agent-drawn UI (spec 3.3 §6.1
genui, §7.4 rule 5): forms, cards, tables and screens an agent draws in a person’s threads, which never contain approval controls. - images
- Images a person sends with a message (spec 3.3 §5.1): a screenshot of a failing build, a photo of a receipt. They reach the agent as the message’s own parts, so a model that sees images reads them with the text.
- mobile
- The phone (spec 3.3 §5.4, §8.2; feature
mobile): the web home installed on a phone, woken by push from the person’s own kernel, approving high-risk calls after “Confirm it’s you”. - model
- The projection types every surface draws from (spec 3.3 §6, §7.1, §8).
- rules
- What each surface may decide (spec 3.3 §7.2) and the rules on every surface (§7.4), enforced by the engine rather than left to renderers.
- suggest
- Suggested replies (spec 3.3 §5.1): an agent offers the person up to four short replies they might send next. The home shows them under the agent’s latest message; tapping one fills the message box, and the person still sends it. A suggestion is the person’s own message once sent, never an answer to a decision (§7.4, S-I4).
- tui
- The terminal (spec 3.3 §5.2): the same home as the web, from the keyboard.
- verbs
- Screen actions people and agents share (spec 3.3 §2 item 7, §5.6, §6.1
verb-ui; Experimental): one way to change something a surface shows — first, snoozing something in Coming up — from the home, the terminal, voice and an agent, always through the governed path. - viewer
- The annotated viewer (spec 3.7 §8.2, X12): looking at what an agent saw.
- voice
- Voice and video (spec 3.3 §5.6; feature
voice). - web
- The web home (spec 3.3 §5.1, §6; feature
web): its HTTP API and its page. - words
- The words every surface shows (spec 3.3 §8).
- workflow
- The workflow observer and debugger (spec 3.3 §6.1
workflow, §12 developer track): a graph agent’s runs, steps and forks, for the web home’s Runs tab.
Structs§
- Agent
Card View - The definition on the decision that adds a suggested agent (spec 3.3 §5.7 “The decision that adds an agent”, S-I13): every field, from the inbox entry the kernel wrote, never from the model.
- Agent
Choices - What a person may choose for an agent on this kernel (spec 3.3 §5.7, decision 21): the models of the providers whose key the kernel has, the packs, the areas and the colours.
- Agent
Detail - One agent a person added (spec 3.3 §5.7): what Settings shows.
- Agent
Draft - An agent’s definition as Set it up yourself and Settings edit it, in the order of spec 3.3 §5.7 “The definition”.
- Agent
Preview - Here is what Finance can do (spec 3.3 §5.7): what a change lets an agent do, its risk, and the digest the change is confirmed with.
- Agent
State - An agent’s state as a source reports it, before projection into an
AgentRow(spec 3.3 §8.1). - Agent
Threads - An agent’s threads, newest first:
GET /surface/agents/{id}/threads. - Always
Allow Offer - How a source grants “Always allow” (spec 3.3 §8.2): the label it offers for a request, and the standing rule it creates.
- Area
Choice - An area a person may put an agent in.
- Caller
- The authenticated caller of an engine read or command (spec 3.3 §6, §11 S-I8).
- Card
Hint - What a feature says about one of its decisions (spec 3.3 §7.1). Every field is optional. When several hints answer the same decision, the first that sets a wording field wins, and any of them can mark money or remove Always allow.
- Card
Line - One line of an agent’s definition on a card: “Area · Home”.
- Card
Media - A held call’s images on its card (spec 3.7 §8.2, X11): what would leave, after redaction, with what was covered, where it goes, what it costs, how long it is kept and why nothing can be sent when that is so.
- Color
Choice - A colour a person may choose.
- Control
Source - The engine’s source over a kernel’s control plane (spec 3.3 §6, spec 3.2 §7.11): a terminal or a home attached to a kernel elsewhere, over its socket, named pipe or HTTP.
- Covered
Line - What was covered of one class, as a line of “Covered before it leaves”.
- Ended
Work - What removing an agent ends, counted (spec 3.3 §5.7 “Pausing and removing”).
- Evidence
Bytes - An image a surface loads for a card, after the source checked its digest.
- Evidence
Image - One image a held call would send, as its card shows it.
- Evidence
Region - A region drawn over an evidence image, in the image’s own pixels.
- GoesTo
- Where the images go, in words.
- Granted
Use - Something the home lets every agent on it do beyond its definition, because the host
gives each agent it runs the tools for it (spec 3.3 §5.7, S-I12, S-I13): shown under
“Here is what Finance can do” as “On this home it can also:”. Hosts register each with
SurfaceEngineBuilder::grant. - Held
Plan - A held call that is a step of a previewed screen plan, as a source tells the engine (spec 3.7 Q8): the plan’s first step carries the plan’s one card, and the steps held with it wait behind that card.
- Image
Change - A change to an evidence image before it leaves (board choices A7, A8): the crop can only shrink and covering can only grow, so a change never shows more than the image it changes.
- Image
Changed - What a change made: the image it replaces and the new one.
- Image
Facts - What a feature knows about one image of a call: the field it shows and why it was sent.
- Local
Source - The engine’s source for surfaces in the same process as the agents (spec 3.3 §6): the
session store the feed numbers events from, the approval service decisions go through,
and whichever of an in-process
Kernel, aHarnessand aRunnerruns the turns. - Local
Source Builder - Builds a
LocalSource. - Media
Facts - What a feature knows about the images one of its calls would send, which the evidence
alone does not say: where they go, what they are, the estimated cost and what they were cut
from (spec 3.7 §8.2). A
CardHintcarries it. - Media
Notice - A notice on the card about its images: why nothing can be sent.
- Model
View - A model an agent runs on; never a key (spec 3.3 decision 21).
- Place
- Somewhere a decision is also shown, for “Also on your phone and in Telegram” (spec 3.3 §7.1).
- Purged
View - An evidence image that is no longer kept (board choice A13).
- Removed
Agent - An agent the person removed, whose threads stay readable (spec 3.3 §5.7, §13 decision 18; owner, at the wave 3 gate: “Removed agents” at the roster’s foot).
- Removed
Thread - One thread of a removed agent, read only.
- Spend
Today - Today’s spend and the daily limit, in micro-USD (spec 3.3 §8.1 “Daily spending limit”).
- Surface
Engine - The engine every surface runs on (spec 3.3 §6): it reads a
Source, projects what it reads into cards, thread items, agent rows, the status line and the briefing, and carries out commands under the rules of §7.2 and §7.4. - Surface
Engine Builder - Builds a
SurfaceEngine. - Thread
Summary - One of an agent’s threads (spec 3.3 §5.1 “Thread history”): its session and when it last changed.
- Turn
Failure - A turn of a session that ended in an error, as a source reports it: the thread shows it
where the agent’s reply would have been (
Source::turn_failures). - Uses
Draft - What an agent can use (spec 3.3 §5.7 “What it can use”).
- Via
- Where and how an answer was given, as a decision answered elsewhere shows it (spec 3.3 §8.1 “Decided”).
Enums§
- Agent
Color - An agent’s colour: one of the eight avatar colours, never a free value (spec 3.3 §5.7).
- Agent
Life - Where an agent is in its life, as a surface shows it (spec 3.3 §5.7, §8.1).
- Agent
Preview Request - What
POST /surface/agents/previewpreviews (spec 3.3 §5.7 “Show, then confirm”). - Command
- A command from a surface (spec 3.3 §6). Every command runs as an authenticated
Caller, whose subject, surface andOriginreach its audit record. - Command
Outcome - What a command did (spec 3.3 §6).
- Cover
Class - What a region on an evidence image covers, by the class the egress gate redacted it as (spec 3.7 §7.8 step 3).
- Evidence
Kept - Whether an evidence image is still kept, as the source knows it.
- Feed
Frame - One frame of a session’s feed (spec 3.3 §6): the snapshot, then the live tail.
- FileUse
- Where an agent’s files are: none, read, or read and change (spec 3.3 §5.7).
- Media
Notice Kind - Why a card’s images cannot be sent.
- Origin
- How an input was given (spec 3.3 §6, §11): every command carries one, and it reaches the audit record, so “What your agents did” can say “from Telegram”.
- Shell
Use - Where an agent’s commands run: nowhere, in the sandbox, or on this computer.
- Steered
- What became of a message a running turn was offered (spec 3.3 §6 “steer”).
- Surface
Kind - The surface a person uses (spec 3.3 §5, §7.2).
- WebUse
- What of the web an agent reaches.
Constants§
- CALL_
TEXT_ LIMIT - How long a call’s text may be before it is shown truncated (spec 3.3 §7.1).
- DEFAULT_
POLL_ INTERVAL - How often the feed reads the session store when the source has nothing faster.
- EVIDENCE_
RETENTION_ DAYS - How many days an image held as evidence is kept, unless a feature says otherwise (spec 3.7 Q13).
- RUN_
LINES - The most lines of a run’s output a thread shows: its last ones (spec 3.3 §5.1).
- SURFACE_
AUDIT_ ANSWER - The audit action of an answer as it is given, written before it takes effect; its
surface.deciderecord says how it ended (spec 3.3 §11). - SURFACE_
AUDIT_ APP_ CALL_ AUTO_ APPROVED - The audit action of an app’s call approved by the home’s opt-in consent policy instead of
a person (spec 3.3 §6.1
genui-apps). - SURFACE_
AUDIT_ DRAWN_ SEALED - The audit action of a person’s approval of a form’s call, sealed to the drawing they saw (spec 3.3 §7.4 rule 5).
- SURFACE_
AUDIT_ DRAWN_ SUBMITTED - The audit action of a drawn form’s Send (spec 3.3 §7.4 rule 5, §11).
- SURFACE_
AUDIT_ IMAGE_ CHANGE - The audit action of a person changing an image before it leaves: the old digest, the new
one and the change, written before the call is held again (spec 3.7 §9.3
vision.edit). - SURFACE_
AUDIT_ RESUME_ ALL - The audit action of “Resume all” (spec 3.3 §11).
- SURFACE_
AUDIT_ SEND - The audit action of “Send” and “Queue” (spec 3.3 §11).
- SURFACE_
AUDIT_ SET_ MODE - The audit action of a mode change (spec 3.3 §11).
- SURFACE_
AUDIT_ STEER - The audit action of a message sent to a running turn (spec 3.3 §6 “steer”, §11): what “Steer” was refused or offered, and how a message a turn held ended.
- SURFACE_
AUDIT_ STOP_ ALL - The audit action of “Stop all” (spec 3.3 §11).
- SURFACE_
AUDIT_ STOP_ TURN - The audit action of Stop the turn (spec 3.3 §5.1), recorded before the turn stops.
- SURFACE_
AUDIT_ VISION_ EXAMPLE - The audit action of a labelled example saved from the annotated viewer (spec 3.7 §8.2): the session, the answer, the image’s digest, the file, the case and the region kept.
Traits§
- Card
Hints - A feature’s hints for the decisions its tools ask (spec 3.3 §7.1), read by the engine wherever it draws a card.
- Rule
Commit - A standing rule prepared for “Always allow”, granted only once the decision it belongs to was recorded.
- Source
- The seam between the engine and what it shows (spec 3.3 §6).
Functions§
- short_
digest sha256:c52ca5…ce7550: the scheme, the first six and the last six hex digits (board choice S4).
Type Aliases§
- Steering
- The wait for what became of a message a running turn holds (
Source::steer).