Skip to content

feat(samples): add multi-turn ADK format playground sample and Lit shell config - #4158

Closed
gspencergoog wants to merge 5 commits into
feat/decision-evalfrom
feat/decision-playground
Closed

gspencergoog wants to merge 5 commits into
feat/decision-evalfrom
feat/decision-playground

Conversation

@gspencergoog

@gspencergoog gspencergoog commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds an ADK format_playground sample (samples/agent/adk/format_playground/, depending on a2ui-agent-sdk[decision]) and a playground Lit shell configuration (samples/client/lit/shell/) with a split-screen <playground-inspector> side panel. Developers can compare decision, express, direct, and zero-LLM tool rendering interactively while inspecting every stage of the pipeline on each turn.

Reviewer Focus

  • samples/agent/adk/format_playground/renderers.py and agent.py: inspect how Renderers keeps a session RendererState across turns (including PlanCache), routes multi-turn surface updates on main, and dispatches user actions and quick-action tool examples by action.id.
  • samples/agent/adk/format_playground/inspector_trace.py and samples/client/lit/shell/types/inspector.ts: check the in-band application/x-a2ui-playground-trace+json DataPart payload contract, backend URL credential redaction (sanitize_endpoint_url), PlanCache hit question reconstruction (_reconstruct_batch_and_key), and A2UI Express decompilation (ExpressDecompiler).
  • samples/client/lit/shell/ui/inspector.ts, client.ts, and app.ts: check A2UIClient session contextId persistence (sendTurn and resetSession), the responsive split-screen <playground-inspector> four-stage waterfall, and the clearSurfacesOnResponse: false and inspector: true options in configs/playground.ts.
  • samples/client/lit/shell/theme/playground-theme.ts and the cssOverrides handling in app.ts: <a2ui-surface> renders inside the shell's shadow root, so the shell now adopts config.cssOverrides onto its own adoptedStyleSheets rather than only document. Confirm the restaurant and local configs, which set no overrides, are unaffected.
  • samples/agent/adk/format_playground/tests/conftest.py: the sample uses flat top-level module names (agent, tools, ...). When the repo-wide pytest run collects tools/build_catalog/tests first, the repository's tools/ directory wins as a namespace package, so the fixture pins the sample directory on sys.path and evicts shadowed modules around each test.

Changes

  • Add samples/agent/adk/format_playground/ (declaring a2ui-agent-sdk[decision] in pyproject.toml) with ADK agent orchestration, multi-format Renderers, slash commands, quick-action tool example buttons, a 1000-token Stage 1 thinking budget, JSONL ratings, demo tools, and run.sh.
  • Add samples/agent/adk/format_playground/inspector_trace.py to build a four-stage turn trace (blockInput, decisionInput, decisionOutput, wireJson, plus llmStage2 and /compare candidates) and omit inline footer cards when a2uiPlaygroundInspector: true is present in A2A request metadata.
  • Add samples/client/lit/shell/types/inspector.ts and samples/client/lit/shell/ui/inspector.ts (<playground-inspector>) to render the collapsible four-stage pipeline waterfall (1. Block Input, 2. Decision Input, 3. Decision Output & Plan, 4. A2UI JSON with Decompiled Express and Raw Wire JSON views).
  • Add samples/client/lit/shell/theme/playground-theme.ts (card spacing, list padding, equal-height stat cards, icon overflow clipping, non-italic captions) and load Inter for body text alongside Outfit for titles in index.html, applied only by the playground config.
  • Update samples/client/lit/shell/client.ts, app.ts, configs/types.ts, and configs/playground.ts to persist A2A contextId across turns, support resetSession(), adopt cssOverrides in the shell's shadow root, and mount the responsive split-screen inspector layout when config.inspector is enabled.
  • Register the sample package in root pyproject.toml and uv.lock, add Python unit tests under samples/agent/adk/format_playground/tests/ (96 cases), and add Vitest suites under samples/client/lit/shell/tests/ (inspector.spec.ts and an extended smoke-test.spec.ts); package.json's test:vite-compilation now runs every spec in the shell rather than the smoke test alone.

Impact & Risks

  • Sample-only additions under samples/agent/adk/format_playground/ plus opt-in clearSurfacesOnResponse, inspector, and cssOverrides behavior in samples/client/lit/shell/ that preserve existing behavior (clearSurfacesOnResponse: true, inspector: false, no overrides) for restaurant and local configurations.
  • The sample imports the decision format from a2ui.inference_formats.experimental.decision; running it emits the format's [EXPERIMENTAL] warning unless A2UI_SUPPRESS_EXPERIMENTAL_FEATURE_WARNINGS=1 is set.

Testing

  • Run uv run pytest samples/agent/adk/format_playground/tests -q (96 passed), and uv run pytest -q from the repository root to exercise the conftest.py module isolation alongside tools/build_catalog/tests.
  • Build, lint, and test the Lit shell with yarn --cwd samples/client/lit/shell build && yarn --cwd samples/client/lit/shell lint && yarn --cwd samples/client/lit/shell test.

@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 Format Playground, a sample agent and client configuration for exploring A2UI inference formats and tool rendering workflows. The feedback focuses on improving asynchronous performance and robustness: refactoring set_backend to be asynchronous to properly await backend cleanup, offloading synchronous file I/O in _rate_turn and _show_ratings to separate threads using asyncio.to_thread to prevent blocking the main event loop, and defensively verifying that extracted text attributes are strings in call_with_tools to avoid runtime errors.

@gspencergoog
gspencergoog force-pushed the feat/decision-playground branch from abe7cf1 to d6b1138 Compare November 13, 2026 22:50
@gspencergoog
gspencergoog marked this pull request as ready for review November 16, 2026 21:59
@gspencergoog
gspencergoog added this pull request to stack #4287 November 18, 2026 17:45
gspencergoog added a commit that referenced this pull request Nov 18, 2026
…ell config

Squashed from the stacked branch history (backup: refs/backups/pre-squash-20261118/feat/decision-playground).

PR: #4158
@gspencergoog
gspencergoog force-pushed the feat/decision-playground branch from 88bfbfa to 40cc57e Compare November 18, 2026 17:49
gspencergoog added a commit that referenced this pull request Nov 18, 2026
…ell config

Squashed from the stacked branch history (backup: refs/backups/pre-squash-20261118/feat/decision-playground).

PR: #4158
@gspencergoog
gspencergoog force-pushed the feat/decision-playground branch from 40cc57e to 76f7a89 Compare November 18, 2026 20:44
gspencergoog added a commit that referenced this pull request Nov 19, 2026
…ell config

Squashed from the stacked branch history (backup: refs/backups/pre-squash-20261118/feat/decision-playground).

PR: #4158
@gspencergoog
gspencergoog force-pushed the feat/decision-playground branch from 76f7a89 to 9d5754b Compare November 19, 2026 02:24
gspencergoog added a commit that referenced this pull request Nov 19, 2026
…ell config

Squashed from the stacked branch history (backup: refs/backups/pre-squash-20261118/feat/decision-playground).

PR: #4158
@gspencergoog
gspencergoog force-pushed the feat/decision-playground branch from 9d5754b to 5f381fb Compare November 19, 2026 04:21
…ell config

Squashed from the stacked branch history (backup: refs/backups/pre-squash-20261118/feat/decision-playground).

PR: #4158
Request the optional [decision] extra from a2ui-agent-sdk in the format playground sample so httpx is declared explicitly, and update uv.lock.

Signed-off-by: Greg Spencer <gspencer@google.com>
…ks, and Lit shell

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

- Share guarded sanitize_url between renderers.py and inspector_trace.py so malformed bracketed hosts never raise ValueError inside exception handlers.

- Exclude longer sibling block prefixes in _serialize_planned_block so prose_ does not absorb prose_group_0_* components.

Signed-off-by: Greg Spencer <gspencer@google.com>
@gspencergoog
gspencergoog force-pushed the feat/decision-playground branch from 5f381fb to 9b91f56 Compare November 24, 2026 18:01
@gspencergoog
gspencergoog marked this pull request as draft November 30, 2026 23:51
@gspencergoog

Copy link
Copy Markdown
Collaborator Author

Superseded by #4517 (synthesizer mode folded into decision_playground on top of #4496 in stack #4501).

🤖 Agent-generated

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.

1 participant