Repository navigation
feat(agent-sdk): add two-stage layout planner, synthesizer, and v1.0 decision format - #4155
gspencergoog wants to merge 6 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces the experimental 'decision' inference format for protocol v1.0, which separates data from interface design by using a decision model to select layouts from catalog patterns. It adds several new modules, comprehensive documentation, and tests, while also updating the Hatch build configuration to bundle catalog assets. The review feedback suggests two key improvements: using setdefault in hatch_build.py to safely access build_data["force_include"] and avoid a potential KeyError, and optimizing the recursive _stamp_function_calls function in synthesizer.py to skip primitive values and reduce overhead.
6858249 to
3a4e608
Compare
🧹 Docs Site Preview RemovedThe preview for PR #4155 has been cleaned up because the pull request is closed. |
…decision format Squashed from the stacked branch history (backup: refs/backups/pre-squash-20261118/feat/decision-planner-format). PR: #4155
779498d to
4b99023
Compare
…decision format Squashed from the stacked branch history (backup: refs/backups/pre-squash-20261118/feat/decision-planner-format). PR: #4155
4b99023 to
bca993a
Compare
…decision format Squashed from the stacked branch history (backup: refs/backups/pre-squash-20261118/feat/decision-planner-format). PR: #4155
bca993a to
83f5dfc
Compare
…decision format Squashed from the stacked branch history (backup: refs/backups/pre-squash-20261118/feat/decision-planner-format). PR: #4155
83f5dfc to
dfa64bc
Compare
…decision format Squashed from the stacked branch history (backup: refs/backups/pre-squash-20261118/feat/decision-planner-format). PR: #4155
…ference_formats Remove the decision, Atom, and Elemental re-exports from the top-level a2ui.inference_formats barrel so importing the barrel never loads experimental formats or httpx. Update eval/a2ui_eval/runner.py to import AtomFormat and ElementalFormat from their experimental packages, tighten the isolated CI assertion, update READMEs and proposal docs, and record the breaking change under Unreleased in CHANGELOG.md. Signed-off-by: Greg Spencer <gspencer@google.com>
…and parser Signed-off-by: Greg Spencer <gspencer@google.com>
… docs - Reject pointers containing braces in $text/$format interpolation and stop doubling literal backslashes in _escape_format_string_literal. - Verify TemplateChildList.componentId during pruning and clean up dead optional slots / required-slot drops on multi-slot containers. - Export extract_decision_blocks in parser.__all__ and call public extract_blocks internally. - Fix CHANGELOG.md list indentation and align decision_inference_format.md $format and plan_shape_signature docs. Signed-off-by: Greg Spencer <gspencer@google.com>
dfa64bc to
a049845
Compare
Resolve Unreleased CHANGELOG.md conflict in python/a2ui_agent/CHANGELOG.md by preserving breaking changes and entries from both branches.
Summary
Adds
LayoutPlanner,PatternExpander,DecisionSynthesizer,LayoutLinter, and theDecisionFormat(a2ui-decision),DecisionParser, andDecisionRenderToolentry points undera2ui.inference_formats.experimental.decisionina2ui-agent-sdk, along with the architecture proposal indocs/proposals/decision_inference_format.md. Also removes all experimental format re-exports (decision,Atom*, andElemental*) from the top-levela2ui.inference_formatsbarrel so importing the barrel never loads experimental modules.Reviewer Focus
python/a2ui_agent/src/a2ui/inference_formats/__init__.pyand.github/workflows/python_ci.yml: check thata2ui.inference_formatsexports only stable formats (direct_json,express, and_sharedhelpers), and that the isolated CI check asserts noa2ui.inference_formats.experimental*orhttpxmodules load on barrel import.docs/proposals/decision_inference_format.md: review the end-to-end architecture, block contract, two-stage question batching, three-level surface lifecycle, fallback hierarchy, and held-out benchmark scorecard.python/a2ui_agent/src/a2ui/inference_formats/experimental/decision/decision_block.pyandprompt_generator.py: check that the block contract (surfaceId,intent,payload,actions,mutablePaths,exclude,labels,region,replace,layout,title,summary,fallbackDsl) matches prompt rules.python/a2ui_agent/src/a2ui/inference_formats/experimental/decision/layout_planner.pyandpatterns.py: inspect Stage 1 and Stage 2 batching,no_fitabstention routing,fit_scorediagnostic threshold,excludepointer filtering,labelsoverrides,event.name == action.idpreservation, and$actionContextbindings. Two planner rules deserve a close look: acollectionbound to a grouped section array (menuSections[i].items) expands into one section heading plus one collection per section, reusing the singlecollectiongate and anatomy answers; andleading: iconor picture-based layouts degrade tononeorrowswhen the bound items have no icon or picture field, so noImageis emitted without aurl.python/a2ui_agent/src/a2ui/inference_formats/experimental/decision/patterns.py(_eval_format_directive): check that$formatresolves toformatCurrency,formatNumber, orformatStringonly when the owning catalog declares that function, and falls back to a plain binding otherwise, so recipes stay catalog-agnostic.python/a2ui_agent/src/a2ui/inference_formats/experimental/decision/parser.pyandsynthesizer.py: checkRendererStateoperations (create, root update, blockregionreplacement,PlanCacheupdateDataModel-only fast path, andreplace: truedeleteSurface+createSurface) and the fallback chain (fallbackDsl, host callback, minimalfactssurface, explicit error).python/a2ui_agent/hatch_build.pyandpyproject.toml: check howcatalogs/decision/v1/*.json,catalogs/basic/v1/patterns.json, andcalibration_profiles.jsonare bundled intoa2ui/inference_formats/experimental/decision/assets/for sdist and wheel builds.Changes
archetypes.py,layout_planner.py,patterns.py,layout_lint.py, andsynthesizer.pyto compile JSON payloads,ActionSpecmaps, andlabelsoverrides into linted A2UI v1.0 messages.PlanCachedata-only updates (plan_cache_hit=True), block-levelregionreplacement (updateComponents+updateDataModelwithout rewriting the page root), andno_fit/fit_scoreabstention routing.prose) andcollectionblocks with distinctid_prefixvalues, and propagateSlotBinding.format_hintsso$formatdirectives in a catalog'spatterns.jsonrender currency, number, and string formatting through the catalog's declared functions.decision_block.py,prompt_generator.py,parser.py,format.py, andtool.pyimplementingDecisionFormat(chat mode) andDecisionRenderTool(tool mode) on A2UI v1.0.DecisionFormat,DecisionParser,DecisionSynthesizer, andDecisionRenderToolare decorated with@experimental(a2ui.utils._experimental), matchingAtomFormatandElementalFormat.AtomFormat,AtomFormatFactory,AtomParser,ElementalFormat,ElementalFormatFactory,ElementalParser, and all decision symbols) froma2ui.inference_formats/__init__.py, updateeval/a2ui_eval/runner.pyto importAtomFormatandElementalFormatfrom their experimental packages, and tighten.github/workflows/python_ci.ymlto assert barrel isolation.docs/proposals/decision_inference_format.mddocumenting the design, data flows, custom catalog integration,[decision]extra, and evaluation results.hatch_build.pyfor wheel asset bundling, and updatepython/a2ui_agent/CHANGELOG.md(under## Unreleased, including the breaking-change note for Atom and Elemental barrel removal),python/a2ui_agent/README.md, andinference_formats/README.md.$formatevaluation, multi-turnRendererStateupdates,PlanCachehits,regionupdates, action round-trips, custom catalogs, and wheel packaging.Impact & Risks
AtomFormat,AtomFormatFactory,AtomParser,ElementalFormat,ElementalFormatFactory, andElementalParserare no longer exported froma2ui.inference_formats. Callers must import them froma2ui.inference_formats.experimental.atomanda2ui.inference_formats.experimental.elementaldirectly.a2ui.inference_formats.experimental.decision(not the top-level barrel). InstantiatingDecisionFormat,DecisionParser,DecisionSynthesizer, orDecisionRenderToolemits an[EXPERIMENTAL]UserWarning; setA2UI_SUPPRESS_EXPERIMENTAL_FEATURE_WARNINGS=1to silence it.PlanCachedata-only hits rely on callers retaining a conversation-scopedRendererState; stateless callers continue to receivecreateSurfacemessages.Testing
uv run pytest python/a2ui_agent/tests eval/tests -qto execute all decision, agent SDK, and eval suites.uv build --package a2ui-agent-sdkand check that built wheels include all bundled JSON assets and listhttpxonly underextra == 'decision'.uv run --all-packages mypy .anduv run pyink --check python/a2ui_agent eval.Benchmark Results
Frozen scorecard from
eval/bin/decision_scorecard.py(reported indocs/proposals/decision_inference_format.md), with per-model temperatures fromcalibration_profiles.json:none)jev/jev-1.14.0(T = 1.0)gemini/gemini-decision-1(T = 0.25)jev/jev-1.14.0(T = 1.0)gemini/gemini-decision-1(T = 0.25)