Skip to content

feat(samples): add decision_playground agent and Lit shell inspector - #4325

Closed
gspencergoog wants to merge 30 commits into
feat/decision-prose-upgradefrom
feat/decision-playground-standalone
Closed

gspencergoog wants to merge 30 commits into
feat/decision-prose-upgradefrom
feat/decision-playground-standalone

Conversation

@gspencergoog

Copy link
Copy Markdown
Collaborator

Why

The standalone decision-model stack (#4320 through #4323) implements the decision backend kernel, cascade router, zero-LLM tool pointer binder, and submit-time RPC predicates, but has no interactive sample app to exercise them together in a browser or switch between modes and backends live.

Summary

  • Port the planner-free Lit shell playground (?app=playground) and four-stage <playground-inspector> into samples/client/lit/shell/, decoupled from the planner stack.
    • Add clickable Mode (cascade, binder, rpc, express, direct) and Backend (mock, gemini, jev, step0) pills in the shell header that send /mode and /backend commands and sync active state from the returned schemaVersion: 1 trace.
    • Wire MessageProcessorOptions.outboundListener in samples/client/lit/shell/app.ts so v1.0 callAgentFunction envelopes send through A2UIClient.sendTurn, feed agentFunctionResponse back without pruning active surfaces, and update the inspector trace.
    • Widen types/inspector.ts (PlaygroundMode and 'step0' wire format) and add quick actions for /tool host, /tool resort, /form bug, /budget 300, /compare, and /help.
  • Add a standalone sample agent in samples/agent/adk/decision_playground/ registered in root pyproject.toml:
    • cascade mode driving DecisionCascadeRouter across TEXT_ONLY, TEMPLATE, and PRUNED_EXPRESS tiers with /budget <ms|off>.
    • binder mode driving ToolPointerBinder over deterministic sample tools (/tool host, resort, transfer, order) with zero UI LLM calls and secret-field redaction (apiKey).
    • rpc mode serving interactive v1.0 forms (/form bug, feedback, refund) validated by build_predicate_agent_functions and SessionRateLimiter, intercepted directly in PlaygroundAgentExecutor via RendererToAgentMessageProcessor while ignoring A2UIClient's useStreaming: false DataPart.
    • express and direct LLM baselines plus /compare, RecordingDecisionBackend proxy capturing exact DecisionBatch/DecisionAnswer tuples for the application/x-a2ui-playground-trace+json (schemaVersion: 1) trace, PlaygroundMockBackend offline heuristics, and run.sh preset launcher (mock, gemini, jev, step0, cascade, binder, rpc, express, direct).

Testing

  • A2UI_SUPPRESS_EXPERIMENTAL_FEATURE_WARNINGS=1 uv run pytest samples/agent/adk/decision_playground/tests/ -v: 10 passed (cascade tiers, /budget, /tool host apiKey redaction, /tool resort, /backend step0 rollback without A2UI_DECISION_URL, /form bug + callAgentFunction pass/fail/rate-limit, PlaygroundAgentExecutor useStreaming: false filtering + trace attachment, /compare, and RecordingDecisionBackend).
  • uv run --all-packages mypy . (227 files) and sample-level mypy (9 files): 0 issues.
  • uv run pyink samples/agent/adk/decision_playground and cognitive complexity check (-t 15): 0 functions exceeding threshold.
  • yarn --cwd samples/client/lit/shell build && yarn --cwd samples/client/lit/shell lint && yarn --cwd samples/client/lit/shell test: build clean, 0 lint errors, 54 Vitest tests passed (including header pill syncing and outboundListener callAgentFunction round-trip).

@gspencergoog
gspencergoog added this pull request to stack #4324 November 20, 2026 02:41

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the A2UI Decision Playground, a sample application featuring an interactive chat-style agent and a split-screen frontend pipeline inspector to demonstrate standalone A2UI decision-model capabilities. The review feedback identifies three key issues: a critical type mismatch in trace_adapter.py where probabilities is serialized as a dictionary instead of an array of objects (which would cause a frontend crash), a copy-paste formatting issue in inspector.ts when copying raw text, and a mathematical bug in recording_backend.py where the offline mock probability distribution fails to sum to 1.0 when only a single candidate is present.

@gspencergoog
gspencergoog force-pushed the feat/decision-playground-standalone branch from 313445e to b186882 Compare November 20, 2026 03:52
@gspencergoog
gspencergoog force-pushed the feat/decision-playground-standalone branch from 6c5ee94 to ad670aa Compare November 20, 2026 22:49
@gspencergoog
gspencergoog removed this pull request from stack #4324 November 20, 2026 22:51
@gspencergoog
gspencergoog changed the base branch from feat/decision-rpc-predicates to feat/decision-gated-templates November 20, 2026 22:51
@gspencergoog
gspencergoog added this pull request to stack #4343 November 20, 2026 22:51
@gspencergoog
gspencergoog removed this pull request from stack #4343 November 20, 2026 23:53
@gspencergoog
gspencergoog force-pushed the feat/decision-playground-standalone branch from ad670aa to 5058460 Compare November 20, 2026 23:53
@gspencergoog
gspencergoog changed the base branch from feat/decision-gated-templates to feat/decision-prose-upgrade November 20, 2026 23:53
@gspencergoog
gspencergoog added this pull request to stack #4345 November 20, 2026 23:53
gspencergoog added a commit that referenced this pull request Nov 21, 2026
…ngle-candidate probability sum

Signed-off-by: Greg Spencer <gspencer@google.com>
@gspencergoog
gspencergoog force-pushed the feat/decision-playground-standalone branch from 669cd1d to 0ceb31a Compare November 21, 2026 00:57
gspencergoog added a commit that referenced this pull request Nov 24, 2026
…ngle-candidate probability sum

Signed-off-by: Greg Spencer <gspencer@google.com>
@gspencergoog
gspencergoog force-pushed the feat/decision-playground-standalone branch from 634334d to 296e72a Compare November 24, 2026 01:36
@gspencergoog
gspencergoog marked this pull request as ready for review November 24, 2026 01:48
Signed-off-by: Greg Spencer <gspencer@google.com>
… on /tool, and sync backend pill

Signed-off-by: Greg Spencer <gspencer@google.com>
…d Lit RPC catalog registration

Signed-off-by: Greg Spencer <gspencer@google.com>
… runtime

Signed-off-by: Greg Spencer <gspencer@google.com>
Signed-off-by: Greg Spencer <gspencer@google.com>
…ut and actions

Signed-off-by: Greg Spencer <gspencer@google.com>
…vent layout jumps

Signed-off-by: Greg Spencer <gspencer@google.com>
…e to 800ms

Signed-off-by: Greg Spencer <gspencer@google.com>
…c professional feedback

Signed-off-by: Greg Spencer <gspencer@google.com>
Signed-off-by: Greg Spencer <gspencer@google.com>
…into decision playground

Signed-off-by: Greg Spencer <gspencer@google.com>
…round

Signed-off-by: Greg Spencer <gspencer@google.com>
…eld spec

Signed-off-by: Greg Spencer <gspencer@google.com>
…ngle-candidate probability sum

Signed-off-by: Greg Spencer <gspencer@google.com>
…ted mode

Signed-off-by: Greg Spencer <gspencer@google.com>
…cer/types, and update playground tests/docs

Signed-off-by: Greg Spencer <gspencer@google.com>

@jacobsimionato jacobsimionato left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran the playground locally in Chrome against the offline mock backend to check the end-to-end UX. Beyond the inline comments, the biggest question here is whether this frontend belongs inside samples/client/lit/shell at all.

Consider a dedicated v1.0 decision-model client instead of samples/client/lit/shell

samples/client/lit/shell is still the older v0.9 Restaurant Finder single-turn demo (package.json labels it Protocol v0.9, and app.ts still imports @a2ui/lit/v0_9, v0_9.MessageProcessor, and sends legacy userAction envelopes). Bolting the playground onto it more than doubled app.ts (932 to 1,879 lines), added ~3,000 lines of playground and inspector code to the shared shell, leaked v1BasicCatalog and playgroundRpcCatalog into ?app=restaurant and ?app=local, and changed --font-family globally in index.html.

More importantly, the single-prompt, single-surface shell layout fights what a decision-model workbench actually needs:

  1. Turn history and diffing. Clicking Incident (Degraded) and then Incident (Healthy) overwrites the single surface in place, so you cannot step back across turns to compare rendered output and decision traces.
  2. Multiline payload and prose editing. Testing binder, gated, and prose with custom JSON or multi-paragraph prose is awkward inside a single-line search input inherited from Restaurant Finder.
  3. Decision-specific debug views instead of the ported planner waterfall. Right now the inspector carries leftover planner concepts (PlanCache, fitScore, layoutPlan, wireRequest, 1. Block Input) rather than views tailored to these strategies: kept vs. pruned subtree diffs for gated templates, a slot-to-pointer binding table for binder and @macro, highlighted grounded spans for prose upgrade, interactive threshold and latency-budget controls, and side-by-side rendered surfaces for /compare.

Moving the frontend into its own standalone v1.0 Vite app (for example samples/client/decision_playground/) would keep samples/client/lit/shell small and untouched for v0.9 Restaurant Finder, let the playground speak native v1.0 (a2uiRendererCapabilities, { version: "1.0", action }) cleanly, and give a dedicated home for decision-model debugging tools.

Impactful UX and runtime issues observed while running ?app=playground

  1. Following README.md (cd samples/client/lit/shell && yarn build) on a fresh checkout fails with TS2307: Cannot find module '@a2ui/markdown-it' unless typescript/renderers/markdown-it is built first, because @a2ui/markdown-it is missing from samples/client/lit/shell/package.json's wireit dependencies.
  2. Clicking Incident Alert (Macro) in binder mode under the mock backend renders "Checkout 5xx Spike" three times (for Title, Summary, and Service), because _best_keyword_candidate ties every candidate pointer at 1 hit against state_low and falls back to candidates[0] ("/title").
  3. Failing boolean probability bars in #renderRecordRow plot winnerProb (for example no: 85% on gate:needs_ui or no: 82% on predicate:is_valid_refund_reason) against the 50% yes-threshold tick, filling the blue bar past the threshold line even on fail. Plotting P(yes) with distinct pass and fail styling would make the threshold tick match the verdict. Also, Stage 1 on plain-text turns and Stage 2's Raw Wire JSON tab render literal null, and when gate:needs_ui fails, route:tier and route:template still display as selected instead of pruned.
  4. The dark-mode button (.theme-toggle in app.ts) is position: fixed with no z-index, so the sticky <playground-inspector> panel paints over it completely; you cannot see or click it without closing the inspector first.

🤖 Agent-generated

Comment thread pyproject.toml
"python/a2ui_core",
"eval",
"samples/agent/adk/custom-components-example",
"samples/agent/adk/decision_playground",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new decision_playground sample is added to [tool.uv.workspace].members, but samples/agent/adk/decision_playground/tests is missing from [tool.pytest.ini_options].testpaths, so none of its 15 tests run in uv run pytest or CI. Also, once collected by workspace pytest, conftest.py mutates sys.path and os.environ["A2UI_DECISION_BACKEND"] at import time and leaks that state to subsequent test suites.

Additional details
  • .github/workflows/python_ci.yml runs bare uv run pytest, which only collects paths listed in [tool.pytest.ini_options].testpaths (pyproject.toml:70-82). Currently 0 tests from samples/agent/adk/decision_playground/tests/ are collected.
  • In samples/agent/adk/decision_playground/tests/conftest.py:57-58, _ensure_sample_imports() and os.environ.setdefault("A2UI_DECISION_BACKEND", "mock") execute unconditionally at module import time rather than inside the fixture, so adding this directory to testpaths will leak sys.path entries and env vars into other test suites.

Suggested fix:

  1. Add "samples/agent/adk/decision_playground/tests" to testpaths in pyproject.toml.
  2. Remove top-level os.environ.setdefault(...) from conftest.py:58 (or scope it via monkeypatch.setenv inside _isolate_sample_imports; _make_agent() in test_decision_playground.py:94-98 already passes PlaygroundMockBackend() explicitly).

🤖 Agent-generated

rpc_messages.append(dict(data))
return None
if "userAction" in data or "action" in data:
action = data.get("userAction") or data.get("action")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clicking action buttons on rendered surfaces currently overwrites or resets the active UI across rpc, binder, gated, and prose modes. Because userAction/action payloads are flattened to plain text and routed into _handle_render_turn, pressing "Validate & Submit" on a refund or feedback form wipes the user's input and replaces the form with a fresh /form bug card (double-incrementing the turn counter), while actions in binder, gated, or prose modes replace the card with Host Health, incident_degraded, or an abstention card.

Additional details

In agent_executor.py:60-63, incoming userAction/action parts are converted into "Action triggered: {...}" with pasted_payload=None and dispatched to PlaygroundAgent.handle_text_turn -> _handle_render_turn (agent.py:556-618):

  • RPC mode (agent.py:598-599): hits return self._cmd_form("bug", ...), discarding any feedback/refund form and the user's text, and calling next_turn() a second time (after line 543 already incremented it).
  • Binder mode (agent.py:583-596): clicking "Confirm Transfer" or "Save Preferences" falls back to TOOL_BY_ALIAS["host"].fn(), replacing the card with Host Health.
  • Gated mode (agent.py:564-582): clicking "Request Refund" on an order card replaces it with incident_degraded (checkout-api).
  • Prose mode (agent.py:556-563): clicking "Track Package" passes "Action triggered: ..." into ProseSurfaceUpgrader, which abstains and wipes out the card.
  • Also note: checking "action" in data matches arbitrary pasted JSON that happens to have a top-level "action" key (e.g. {"action": "deploy"}); narrow it to actual envelope shapes (isinstance(data.get("userAction"), Mapping) or data.get("version") == "1.0" and isinstance(data.get("action"), Mapping)).

Recommended approach: Extract a structured action_event in _extract_incoming_parts and add PlaygroundAgent.handle_action(...) to acknowledge actions (or evaluate submit_<alias> against context["note"]) via a turn-<N>-status card without overwriting main, plus add unit tests for surface action submission.

🤖 Agent-generated

fmt: Any = (
DirectJsonFormat(list(catalogs))
if mode is RenderMode.DIRECT
else ExpressFormat(list(catalogs))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Omitting surface_id=surface_id when constructing ExpressFormat leaves its default surface ID at "main", which causes /compare turns to emit duplicate createSurface("main") messages when cascade routes to PRUNED_EXPRESS. On the Lit client, MessageProcessor throws A2uiStateError on the duplicate surface ID and aborts rendering the entire /compare batch.

Additional details

ExpressFormat.__init__ (python/a2ui_agent/src/a2ui/inference_formats/express/format.py:40) defaults surface_id: str = "main".

  1. In standalone express mode (agent.py:354, 604), RenderOutcome.surface_id and wireOutput.surfaceId report turn-<N>-express, while compiled Express output without an explicit surface(...) header emits createSurface: {"surfaceId": "main"}.
  2. In /compare (agent.py:652-665), when a novel prompt routes cascade to PRUNED_EXPRESS, both cascade and express call _run_format_llm and emit createSurface("main") into the same all_msgs list, violating v1.0 surface uniqueness (specification/v1_0/json/agent_to_renderer.json:24) and throwing in app.ts:1612.
Suggested change
else ExpressFormat(list(catalogs))
else ExpressFormat(list(catalogs), surface_id=surface_id)

🤖 Agent-generated

instruction = fmt.prompt_generator.generate()
try:
turn = await self._llm(
instruction_key=f"{mode.value}:{len(catalogs[0].components)}",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keying AdkLlmCaller's runner cache only on component count (len(catalogs[0].components)) causes system prompt collisions whenever two pruned cascade turns keep the same number of components. The second turn reuses the first turn's cached system instruction with the wrong component schema, causing the LLM to emit disallowed components and fail response parsing.

Additional details

AdkLlmCaller._runner_for (__main__.py:128-159) caches the LlmAgent (and its static instruction closure) by f"{instruction_key}:{len(tools or ())}".

If turn 1 prunes the catalog to 7 components (Button, Card, Column, Row, Slider, Text, TextField) and turn 2 prunes to 7 different components (Button, Card, Column, Row, Tabs, Text, Video), both map to "cascade:7:0". Turn 2 then runs with Turn 1's system prompt, hiding Tabs/Video and teaching Slider/TextField instead, so fmt.create_parser().parse_response(...) (renderers.py:831) rejects the reply against Turn 2's catalog.

Hash the sorted (catalog_id, component_names) signature (keeping the key identifier-safe for LlmAgent.name at __main__.py:140):

comp_sig = ",".join(
    f"{cat.catalog_id}:{name}"
    for cat in catalogs
    for name in sorted(cat.components)
)
digest = hashlib.sha256(comp_sig.encode()).hexdigest()[:12]
turn = await self._llm(
    instruction_key=f"{mode.value}:{digest}",
    ...
)

🤖 Agent-generated

if [[ -f "${HOME}/.env" ]]; then
set -a
# shellcheck disable=SC1091
source "${HOME}/.env"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sourcing ~/.env and .env directly as Bash scripts executes any shell substitutions inside them and aborts under set -euo pipefail on valid dotenv syntax such as unquoted spaces or KEY = value. In addition, __main__.py loads ~/.env before .env with override=False, so ~/.env silently takes precedence over a project-local .env.

Additional details
  1. run.sh:23-35 runs set -a; source "${HOME}/.env"; set +a and source ".env". Dotenv files are key-value data files, not executable shell scripts; source also leaks every unrelated variable from $HOME/.env into the server environment.
  2. __main__.py:42-43 calls load_dotenv(Path.home() / ".env") before load_dotenv() (default override=False), so any key present in ~/.env prevents .env in the sample directory from taking effect when running via uv run ..
  3. run.sh:100-149 also duplicates backend env resolution already handled by renderers.py:116-205, causing drift: run.sh:134 rejects STEP0_URL-only setups even though renderers.py:186 accepts STEP0_URL, and run.sh:140 omits gated and prose even though __main__.py:303 supports them.

Suggested fix: Drop source of dotenv files from run.sh, forward --backend and --mode (including gated|prose) to uv run ., and load local load_dotenv() first in __main__.py (or drop Path.home() / ".env" to match restaurant_finder and custom-components-example).

🤖 Agent-generated

instruction_key=f"{mode.value}:{len(catalogs[0].components)}",
instruction=instruction,
user_text=f"Render surface '{surface_id}' for: {prompt}",
session_id=session_id,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passing session_id=context_id into AdkLlmCaller reuses the same ADK session across turns, resending all previous prompts and full A2UI replies on every baseline or pruned-cascade render. That causes promptTokens and latency to grow every turn, skewing the /compare numbers the playground is meant to demonstrate, and leaks ADK InMemorySessionService entries when PlaygroundAgent evicts sessions beyond _MAX_SESSIONS.

Additional details

In __main__.py:161-170, AdkLlmCaller._session_for creates and reuses an ADK session per (runner, session_id) with default include_contents, and never deletes sessions (even for oneshot-* UUIDs or when PlaygroundAgent.get_settings evicts old contexts at agent.py:79-81).

Suggested fix: Set include_contents="none" on the render LlmAgent (or pass session_id=None for stateless baseline/compare renders) and clean up one-shot sessions in runner.session_service after each call.

🤖 Agent-generated

@pytest.mark.asyncio
async def test_compare_runs_cascade_express_and_direct() -> None:
fake_llm = _FakeLlmCaller(
'[{"version": "v1.0", "createSurface": {"surfaceId": "s", "catalogId":'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both LLM baseline tests (test_compare_runs_cascade_express_and_direct and test_tool_command_preserves_non_binder_mode) pass even though the express and direct candidates actually fail with ok=False (parse_error). Because _FakeLlmCaller returns bare JSON without <a2ui-json> / <a2ui> sentinel tags (and line 402 also uses "version": "v1.0" and a nonexistent catalogId), _run_format_llm's success path is never exercised.

Additional details

DirectJsonParser.unwrap() (python/a2ui_agent/src/a2ui/inference_formats/direct_json/parser.py:109-160) requires <a2ui-json>...</a2ui-json> sentinel tags, and ExpressParser requires <a2ui>...</a2ui>.

In both test_tool_command_preserves_non_binder_mode (L186-201) and test_compare_runs_cascade_express_and_direct (L400-414), parse_response emits only a TextPart, parsed is empty at renderers.py:833-836, and both tests hit the except branch (ok=False, fallback_reason="parse_error"). Neither test asserts c["ok"] is True, which allowed the missing surface_id bug on ExpressFormat to go undetected.

Suggested fix: Have _FakeLlmCaller return valid <a2ui>...</a2ui> for express:/cascade: keys and <a2ui-json>...</a2ui-json> with "version": "1.0" and BasicCatalog("v1.0").catalog_id for direct:, and assert all(c["ok"] for c in candidates) plus the expected surfaceIds.

🤖 Agent-generated

"""Serializes one `(question, answer)` pair for Stage 3 probability bars."""
is_bool = question.kind is QuestionKind.BOOLEAN
winner, winner_prob = answer.top()
passed = (winner == "yes" and winner_prob >= 0.5) if is_bool else True

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_serialize_answer_record hardcodes a 0.5 pass/fail cutoff for every boolean question and marks every categorical question as "selected" with threshold: None, ignoring the actual thresholds enforced by the underlying strategies. When a strategy abstains on a low-confidence template pick (below min_confidence=0.65) or prunes a gate with a custom threshold, Stage 3 displays misleading selected/pass badges and a wrong threshold tick that contradict the abstain_fallback banner.

Additional details
  1. Hardcoded thresholds (trace_adapter.py:68, 79-80): ToolPointerBinder, GatedTemplateEvaluator, and ProseSurfaceUpgrader enforce min_confidence=0.65 (and per-gate custom threshold values), so hardcoding 0.5 / None fabricates passing outcomes in the inspector whenever a choice lands between 0.5 and 0.65 or a gate uses a stricter threshold.
  2. Silent overwrites / drops (trace_adapter.py:100-105): answer_by_id = {ans.question_id: ans for ans in answers} silently overwrites earlier answers when a multi-call turn reuses a question ID, and if q.id in answer_by_id silently omits unanswered questions instead of surfacing missing answers.
  3. Mislabeled 0-LLM backend (trace_adapter.py:181): "backend": backend_kind if calls else "llm" labels 0-LLM status cards and /form turns as backend: llm; use "none" when not calls and outcome.llm_calls == 0.

Suggested fix: Pass actual per-question thresholds/outcomes from strategy results (e.g. GatedTemplateResult.decisions and each strategy's configured threshold) into _serialize_answer_record, pair (question, answer) per recorded batch call rather than collapsing by ID, and emit backend: "none" when neither decision calls nor LLM calls occurred.

🤖 Agent-generated

const now = Date.now();
const lastSent = this._rpcLastSent.get(key) ?? 0;
const delayMs = 800;
if (now - lastSent >= delayMs) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Firing immediately on the leading edge and then every 800ms while the user types sends up to ~75 validation calls per minute against a SessionRateLimiter capped at 20 calls/minute, tripping RATE_LIMITED after ~16 seconds of typing. Because failed RPC checks are not cached or retried, the user's final text stays unvalidated until they edit it again.

Additional details
  • app.ts:1444-1454 implements a leading+trailing 800ms throttle rather than a trailing-edge debounce, sending a request every 800ms during continuous typing (60 / 0.8 = 75 calls/min) against SessionRateLimiter(max_calls=20, window_seconds=60.0) (renderers.py:267).
  • Also note #rpcDebounceKey (app.ts:1387) keys only on ${surfaceId}:${name}, so if a surface ever binds two fields to the same predicate, edits on one field would cancel the other's call with CANCELLED.
  • In tests/smoke-test.spec.ts:473-490, the RPC test only invokes outboundListener once (and uses drifted fixture keys decisionMs/totalMs and predicate is_bug_report_complete), leaving supersede/CANCELLED, timer debounce, rate-limit toast, and transport-error settlement untested.

Suggested fix: Switch #sendOutboundRpc to a pure trailing-edge debounce (e.g. 600–800ms after typing pauses, without the leading-edge branch), and add unit tests covering debouncing and RATE_LIMITED handling.

🤖 Agent-generated

latency_ms=(time.perf_counter() - started) * 1000.0,
)

async def call_with_tools(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AdkLlmCaller.call_with_tools, _collect_tool_parts, LlmToolTurn, TOOL_BY_NAME/TOOL_NAMES/TOOL_FUNCTIONS, and the a2ui-adk dependency in decision_playground/pyproject.toml have no callers anywhere in the sample. Removing this unused scaffolding trims dead code and avoids pulling an unused package dependency.

Additional details

Verified zero references across samples/agent/adk/decision_playground/:

  • __main__.py:73-93 (_collect_tool_parts) and __main__.py:214-260 (AdkLlmCaller.call_with_tools)
  • modes.py:75-85, 100-109 (LlmToolTurn, LlmCaller.call_with_tools)
  • tools.py:160-165 (TOOL_BY_NAME, TOOL_NAMES, TOOL_FUNCTIONS)
  • samples/agent/adk/decision_playground/pyproject.toml:28 ("a2ui-adk")

If tool-calling ADK flows aren't wired in this PR, dropping these keeps the sample easier to read and maintain.

🤖 Agent-generated

@gspencergoog
gspencergoog force-pushed the feat/decision-playground-standalone branch from 296e72a to c4c29d5 Compare November 30, 2026 16:58
Move GeminiDecisionAdapter, JevDecisionAdapter, StepZeroLogprobAdapter,
create_playground_model, calibration_profiles.json, and httpx into
samples/agent/adk/decision_playground, switch RecordingDecisionBackend and
PlaygroundMockBackend to callable DecisionModel, and apply review fixes
(query-string URL routing, sanitized HTTP error details, guarded custom
auth callables, monotonic ADC expiry, and step-0 empty-match handling).

Signed-off-by: Greg Spencer <gspencer@google.com>
gspencergoog added a commit that referenced this pull request Dec 1, 2026
…i-agent-experimental

Ports the interactive decision_playground ADK sample agent and Lit shell
pipeline inspector from #4325 onto the standalone a2ui-agent-experimental
package (a2ui.experimental.decision.*) introduced in stack #4475.

- Registers samples/agent/adk/decision_playground in the root uv workspace
  and depends on a2ui-agent-experimental[adk-a2a].
- Updates all playground imports to a2ui.experimental.decision.* (kernel,
  cascade, binder, gated, prose, rpc), uses ExpressSurfaceTemplate with
  ToolPointerBinder(surface_templates=...), and reuses redact_payload from
  a2ui.experimental.decision.
- Adds the ?app=playground Lit shell config and split-screen pipeline
  inspector with unit tests.
@gspencergoog

Copy link
Copy Markdown
Collaborator Author

Closing this PR in favor of the modularized replacement stack.

@jacobsimionato: The decision_playground sample and Lit shell inspector have been moved onto a2ui-agent-experimental in #4496 (stacked on #4474), with previous review comments incorporated.

🤖 Agent-generated

gspencergoog added a commit that referenced this pull request Dec 1, 2026
…i-agent-experimental

Ports the interactive decision_playground ADK sample agent and Lit shell
pipeline inspector from #4325 onto the standalone a2ui-agent-experimental
package (a2ui.experimental.decision.*) introduced in stack #4475.

- Registers samples/agent/adk/decision_playground in the root uv workspace
  and depends on a2ui-agent-experimental[adk-a2a].
- Updates all playground imports to a2ui.experimental.decision.* (kernel,
  cascade, binder, gated, prose, rpc), uses ExpressSurfaceTemplate with
  ToolPointerBinder(surface_templates=...), and reuses redact_payload from
  a2ui.experimental.decision.
- Adds the ?app=playground Lit shell config and split-screen pipeline
  inspector with unit tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants