Scenarios

Each phase of agent surfaces ships when its scenario passes end to end on SQLite and on one shared store (spec 3.3 §12). Every scenario below runs on SQLite, and on PostgreSQL in a database of its own. Every pass condition is read from the kernel's stores and routes, or from what left the machine, never from what a model wrote.

PhaseScenarioSQLitePostgreSQL
1. Decisions reach youApprove it tomorrow, A stranger writesexamples/surface_approve_tomorrow--store postgres
2. While you were awayThe morning afterexamples/surface_morning_after--store postgres
3. Memory and rulesCorrect me, then checkadk-cli/tests/correct_me_then_check.rscorrect_me_then_check_on_postgres
4. Areas and rosterWork stays at workadk-harness/tests/work_stays_at_work.rswork_stays_at_work_on_postgres
4. Areas and rosterHire a helperadk-cli/tests/hire_a_helper.rshire_a_helper_on_postgres
5. Presence and voiceSpeak, glance, stopadk-cli/tests/speak_glance_stop.rsspeak_glance_stop_on_postgres
Developer trackApprove, rewind, forkadk-surface/tests/workflow_scenario_tests.rs, and scripted_workflow in the browserapprove_rewind_fork_on_postgres
Developer trackGoverned form, Hostile appadk-surface/tests/genui_scenario_tests.rs, genui_apps_tests.rsa_drawn_form_is_sent_held_and_runs_once_on_postgres
ExperimentalOne verb, three originsadk-surface/tests/verbs_scenario_tests.rs; on adk-rust up, adk-cli/tests/verbs_added_agent.rsone_verb_three_origins_on_up_on_postgres

The PostgreSQL legs are #[ignore]d and run by hand against the server DATABASE_URL names, each in a database of its own. Each section below, or the test's module docs, gives its command.

Running the examples

The phase 1 and 2 scenarios are programs you can run and watch: each starts the adk-rust up binary as a real child process in a private home, plays one night, prints what happened in plain words, and exits non-zero when any pass condition fails. Both run the adk-rust binary with the scripted model, the terminal, the PostgreSQL store and the phone compiled in. Build it once from the repository root:

cargo build -p adk-cli --bin adk-rust --features scripted-model,tui,postgres,mobile
RunCommand
SQLite, scripted model (no key)cargo run --manifest-path examples/surface_approve_tomorrow/Cargo.toml
PostgreSQL, scripted modelDATABASE_URL=postgres://postgres@127.0.0.1:5432/postgres cargo run --manifest-path examples/surface_approve_tomorrow/Cargo.toml -- --store postgres
Live, gemini-3.5-flash-litecargo run --manifest-path examples/surface_approve_tomorrow/Cargo.toml -- --live
Live, claude-sonnet-5-5cargo run --manifest-path examples/surface_approve_tomorrow/Cargo.toml -- --provider anthropic
The same for phase 2cargo run --manifest-path examples/surface_morning_after/Cargo.toml [-- --store postgres | --live | --provider anthropic]

--store postgres creates a database for the run on the server DATABASE_URL names and drops it afterwards. --live reads GOOGLE_API_KEY or GEMINI_API_KEY from the repository's .env, and --provider anthropic reads ANTHROPIC_API_KEY. --bin PATH runs another adk-rust binary; --keep keeps the run's folder and database.

Note: adk-rust up runs on the system clock, so each night is compressed: quiet time is set with seconds ([kernel] quiet_hours = "HH:MM:SS-HH:MM:SS") to a window a little ahead, routines fire inside it (adk-rust wake --cron with seconds), and each run takes about two minutes. Every transcript line names the time of the story it stands for and the real time.

Approve it tomorrow

Quiet time 22:00–07:00. At 18:00 a routine prepares to email an invoice and waits for a decision. Nobody answers; the kernel is killed with kill -9 and started again. At 07:30 the person taps Allow once in the Telegram thread. A stranger who writes to the bot gets a pairing code and starts nothing.

Pass conditionRead from
Nothing runs before the tap, and the email is sent exactly onceThe mail driver's outbox
Nothing notifies during quiet timeEvery message the Telegram adapter sent, with its time, from a fake Bot API on loopback
The web home shows "You said yes in Telegram"GET /api/surface/decisions/{id}
The phone's card shows the sameGET /api/surface/decisions/{id}?surface=phone with the phone's device token
Nothing wakes the phone during quiet timeEvery Web Push wake-up, with its time, from a push service on loopback the phone subscribed to (up --push-to-localhost)
The terminal shows the sameThe decided line of adk-rust --output json
The record names the channelGET /api/kernel/record: how chat, channel Telegram
A stranger gets a pairing code and starts nothingThe bot's reply, the process table and the inbox

The morning after

Over one night two routines finish, one fails, an agent suggests a payment, the person allows a call from their phone, and the kernel restarts.

Pass conditionRead from
One briefing when quiet time endsGET /api/kernel/away with the phone's device token; once marked seen it does not come back, across another restart
No briefing before quiet time endsJust before the end the phone's page holds the night while the quiet time GET /api/kernel/settings/default serves still holds, so the home's rule for the morning briefing holds it back
Its counts match exactly across the restartThe process table, the agenda and the inbox
Its spending matches exactly across the restart, and is not zeroThe kernel's daily spend total (GET /api/kernel/settings/default); each scripted reply names its price ("cost" in --model-script)
Every line links to its recordGET /api/kernel/away/lines/{seq} for each line

Work stays at work

Home asks first; Work goes ahead with a 09:00 weekday routine (spec 3.3 §12 phase 4). One run of a kernel hosting both areas' harnesses on a scripted model and a manual clock.

StoreCommand
SQLitecargo nextest run -p adk-harness --features kernel,memory --test integration -E 'test(/^work_stays_at_work::/)'
PostgreSQLDATABASE_URL=postgres://postgres:postgres@localhost:5432/postgres cargo nextest run -p adk-harness --features kernel,memory,postgres --test integration -E 'test(/^work_stays_at_work::/)' --run-ignored only
Pass conditionRead from
A Work agent reading the Home calendar waits, even in Go aheadThe inbox, and what reaches Work
The routine runs on weekdays and skips Saturday and SundayThe process table on a manual clock
Spending per agent sums to the areas' and the day's totalsThe spend ledger

Hire a helper

In the terminal the person asks ADK-Rust for a Finance agent (spec 3.3 §12 phase 4, §5.7). The test runs adk-rust up as a child process with a scripted model, killed with kill -9 and started again halfway through.

StoreCommand
SQLitecargo nextest run -p adk-cli --features scripted-model,audit-sql --test hire_a_helper
PostgreSQLDATABASE_URL=postgres://postgres:postgres@localhost:5432/postgres cargo nextest run -p adk-cli --features scripted-model,audit-sql,postgres --test hire_a_helper --run-ignored only
Pass conditionRead from
Before any answer nothing is added, and the chat card offers only Don't addThe roster, the process table, GET /api/surface/decisions/{id}?surface=chat
After Add this agent, Finance is Ready in the terminal's roster on the kernel event that announces it, and in the web home's, in one colourThe engine over the kernel's control plane, following GET /api/kernel/events; GET /api/surface/agents
After kill -9 and a restart, Finance keeps its id, acts as urn:adk:agent:adk-rust/finance, and ADK-Rust refuses its threadThe roster, the record line of Finance's call, the refused run
Renamed "Bills" in the web home, the terminal shows it on the event that announces it; in Suggest its next turn changes nothingThe terminal's roster, the workspace, the inbox
A page asking for an agent with a shell on this computer is refused; Bills cannot suggest agentskernel.agent.refused, the inbox
Removed in the terminal, its waiting decision ends without an answer and the phone's late answer changes nothing; at its routine's time nothing of Bills runs, while ADK-Rust's routine at the same time does; a new Finance is finance-2 with no ruleThe inbox, the process table, the rules
The record holds proposed, created, changed, removing and removed in order, each naming its surface, and adk-rust audit verify passesGET /api/kernel/record, adk-rust audit export and verify

Speak, glance, stop

With work in flight, the person speaks, glances at the tray and stops everything (spec 3.3 §12 phase 5). adk-rust up serves the phone (--home-url, an operator token) with the voice pack, a scripted model, a scripted realtime provider, and a press driver whose publish_post is publish_public, so it is high risk.

StoreCommand
SQLitecargo nextest run -p adk-cli --features voice,mobile,scripted-model --test speak_glance_stop
PostgreSQLDATABASE_URL=postgres://postgres:postgres@localhost:5432/postgres cargo nextest run -p adk-cli --features voice,mobile,scripted-model,postgres --test speak_glance_stop --run-ignored only
The tray's shell on WebKitGTK, against adk-rust up on SQLite and PostgreSQL.github/workflows/desktop.yml (adk-surface/desktop/e2e.sh store_gate), on Linux with a display
Pass conditionRead from
A spoken "allow once" runs an everyday call once, after the cancel windowThe voice socket's updates, the call's side effect
A high-risk call is refused by voice and approved in the web home with Confirm it's youneedsScreen, the card's "High risk", a passkey answering POST /api/surface/decisions/{id}/confirm, the call's side effect
The tray changes within one eventThe tray's status read after each frame of GET /api/kernel/events: the waiting call shows on its held event
Stop all from the tray stops a running turn, a voice call and a held call within about a secondThe running turn's steps and run state, the voice socket's "All agents are stopped", the held call's side effect after it is allowed

A turn already inside a tool call finishes that call and parks at its next model or tool boundary (spec 3.2 §7.2, K-I8), so the running turn takes at most the step it was in.

One verb, three origins

Ana snoozes News digest by typing /snooze News digest in the terminal, by clicking Snooze in the home and by saying "Snooze news digest"; then Finance, an agent she added, asks to snooze it (spec 3.3 §12, Experimental). The legs run as tests on an in-process kernel: the person's in adk-surface/tests/verbs_scenario_tests.rs, Finance's in adk-surface/tests/verbs_tests.rs, and adk-rust up on SQLite through a restart in adk-cli/tests/verbs_added_agent.rs.

cargo nextest run -p adk-surface --features verb-ui,web,tui,voice --test verbs_scenario_tests --test verbs_tests
cargo nextest run -p adk-cli --features verb-ui,scripted-model --test verbs_added_agent

On adk-rust up the person's three origins run again on SQLite and on PostgreSQL, and the signed records adk-rust audit export reads back differ only in where and how each was given:

cargo nextest run -p adk-cli --features verb-ui,voice,scripted-model,audit-sql --test verbs_added_agent
StoreCommand
PostgreSQLDATABASE_URL=postgres://postgres:postgres@localhost:5432/postgres cargo nextest run -p adk-cli --features verb-ui,voice,scripted-model,audit-sql,postgres --test verbs_added_agent --run-ignored only
Pass conditionRead from
Each origin moves the wake by an hour and writes one surface.verb record and one tool_call allowed under urn:adk:agent:adk-rust/surface.verbsThe agenda, the audit log
The three records are equal but for where and how; the voice record carries the transcript's digest and never the wordsThe audit log
Finance's request waits in Go ahead with a matching standing rule: one inbox entry, origin verbs:adk-rust, low risk, never Always allow on any surfaceThe inbox, GET /api/surface/decisions?surface=…
The card waits through a restart and reads the same in the terminal attached to the kernel; Allow once on the phone moves the item exactly once, and a second answer reads "already decided"The agenda, the inbox, the record
"/snooze" typed in the home's message box or written by an agent, and the model's own audio, change nothingThe agenda, the audit log
While everything is stopped, Ana's snooze runs and Finance asks nothingThe agenda, the inbox

Approve, rewind, fork

The graph agent invoice-run drafts an invoice with a model step, charges it with a governed HTTP POST that asks first and spends money, and files a receipt. The charge goes to a loopback provider that counts every charge it receives. The scenario runs in-process on memory and on SQLite, where the runner, the engine and the routes are rebuilt over the same files halfway through; the PostgreSQL leg runs by hand.

RunCommand
Memory and SQLitecargo nextest run -p adk-surface --features web,workflow --test workflow_scenario_tests
PostgreSQLDATABASE_URL=postgres://postgres:postgres@localhost:5432/postgres cargo nextest run -p adk-surface --features web,workflow --test workflow_scenario_tests --run-ignored only
In the browsercargo run -p adk-surface --features web,workflow --example scripted_workflow -- 8795 /tmp/workflow, then npx playwright test --project workflow in adk-surface/web
StepPass conditionRead from
StartOne card for pay, with the full POST, money, Confirm it's you and approve · Edit · Deny, no Always allow and "From the invoice-run workflow · Open in Runs"; draft done, pay waiting with that decision; no chargeGET /api/surface/decisions, GET /api/surface/workflow/sessions/{session}/run, the provider's count
Approve from the Runs tabThe run is done; one charge; surface.decide recorded with surface web; one completed action-ledger record under graph/<agent id>/<thread>/pay/1/<digest>; the charge's writes in the effect logThe run view, the provider, the audit records, the ledger, adk_graph::governed::effect_log
Restart (SQLite)The run view is the sameThe run view, rebuilt over the same files
RewindThe step before the charge holds no charge; the thread's checkpoints are unchangedGET …/checkpoints/{id}, the checkpointer
Fork, call unchangedDone with no decision; pay "Not sent again" with the original charge; still one charge; the lineage names the thread, the checkpoint and note; surface.workflow.fork recorded with surface webThe fork's run view and checkpoints, the provider, the audit records
Fork, call changedA new decision for 5000; denied, pay not run and the run failed; a sibling, approved, charges once, and the next sibling is answered from the effect logThe fork's run view, the provider
Stop allA fork is made and not started; started after Resume all, it is answered from the record; a freeze before a changed call's charge leaves no ledger record and no chargeThe fork's run view, the ledger, the provider

The original thread's checkpoints never change. The provider counts one charge per distinct approved call: the 4200 charge once and the 5000 charge once.

Governed form

An agent draws a form, a person sends it, and the call waits for them however the agent is configured (spec 3.3 §12 "Governed form", §7.4 rule 5). It runs as tests over the real kernel, durable worker, approval service, session store and audit trail on SQLite, and on PostgreSQL by hand, with a scripted model driving the harness agent Finance in "Ask first".

RunCommand
The scenario, the projection and the terminal over the control planecargo nextest run -p adk-surface --features genui,web,tui --test genui_scenario_tests --test genui_projection_tests
PostgreSQL, on an empty databasecreatedb genui_form, then DATABASE_URL=postgres://postgres:postgres@localhost:5432/genui_form cargo nextest run -p adk-surface --features genui,web,tui --test genui_scenario_tests --run-ignored only -E 'test(/on_postgres/)', then dropdb genui_form
Another area's and an added agent's formscargo nextest run -p adk-cli --features genui,scripted-model --test genui_up
The web home, light and darknpx playwright test --project genui --project genui-states, from adk-surface/web
Live, claude-sonnet-5-5: the model draws the form, and its next turn reads the call as the person'scargo test -p adk-surface --features genui,web --test genui_scenario_tests -- --ignored --nocapture
Live, gemini-3.5-flash-liteGENUI_LIVE_PROVIDER=gemini GENUI_LIVE_MODEL=gemini-3.5-flash-lite cargo test -p adk-surface --features genui,web --test genui_scenario_tests -- --ignored --nocapture

The live runs read ANTHROPIC_API_KEY, or GEMINI_API_KEY and then GOOGLE_API_KEY, from the repository's .env or the file ADK_ENV_FILE names; GENUI_LIVE_MODEL picks another model.

Pass conditionRead from
One drawing by Finance reading "Sending runs send_invoice and asks you first"; a drawn "Allow once" button is a plain refused notice; the inbox is emptyThe thread and the inbox
A send makes one waiting card for send_invoice with the typed to and amount and invoice INV-10 from the stored drawing; nothing runsThe card and the tool's count
Its timeline starts "You pressed Send on a form Finance drew", no surface offers Always allow, and the chat card carries no argumentsThe cards on the web home, the phone, the terminal and chat
An old version (surface.drawn_changed), a forged constant, an undeclared action, another user's session (404) and a chat or agent origin (surface.not_here) are refusedPOST /api/surface/commands and the inbox
Go ahead, a standing rule, a confirmation handler and a stored approval of the identical call answer nothing: it still waitsThe inbox and the tool's count
After the engine and kernel are rebuilt over the same stores, the form says "Sent at 10:03 · waiting for you"GET /api/surface/genui/sessions/{session}/forms
Allow once on the phone runs send_invoice exactly once in Finance's own target; a denied twin never runs and says "Sent · you said no"The tool's count and the forms route
A rule that refuses the tool refuses a send before it is held, and again when a held one resumesThe thread
A form sent from the terminal over the control plane waits as one cardThe inbox
A form drawn in the Home area and one drawn by the added agent Bookkeeper are each held and run in their own target; none is answered "not run"The process table and each agent's workspace
surface.drawn.submitted and surface.decide each name their own surface and originThe audit trail

Hostile app

An MCP server's app shown in a thread can never approve anything (spec 3.3 §12, §6.1 genui-apps). The Weather server is an in-process MCP server; the kernel, worker, harness, approval service and sessions are real, on SQLite.

RunCommand
Both legscargo nextest run -p adk-surface --features genui-apps,tui --test genui_apps_tests
The client side: the extension, _meta.ui and app resourcescargo nextest run -p adk-tool --features mcp,mcp-apps --test mcp_apps_tests
The web home's frame and bridge, light and darknpx playwright test --project genui-apps, from adk-surface/web
Pass conditionRead from
weather_show's HTML carries an "Approved ✓ Allow once" card: "This app was blocked: it shows approval buttons", no frame, a surface.app.blocked recordGET /api/surface/genui/sessions/{session}/apps/{call} and the audit trail
An innocent-looking app asks for transfer_funds (model-only) and send_invoice (another server's): both refused and recorded; an app-only tool is "This app needs a tool this home can't run yet"The app's answers and the audit trail
A tool the app may call waits as the agent's card, "The app from Weather asked", never Always allow; nothing runsThe inbox and the tool's count
A decide POST from the apps origin answers 403 under default and development security, recorded as surface.app.origin_refused; the card's version is unchangedPOST /api/surface/commands, the audit trail and the card
ui/message "Approved" is only a suggestion; Send it sends it as the person's message, marked as the app's: the model reads it in an untrusted-content block, the thread and the queue show "Approved" and "Suggested by the Weather app"The thread, the queue and the session
A CSP declaring http://127.0.0.1 is blockedThe app's open answer
The frame is labelled "it can't approve anything", sandboxed with scripts only, and outside the decision backgroundThe Playwright screenshots
Scenarios - ADK-Rust Documentation | ADK-Rust