feat(formats): implement Express and Elemental InferenceFormats #1982
Open
gspencergoog wants to merge 21 commits into
Open
feat(formats): implement Express and Elemental InferenceFormats #1982gspencergoog wants to merge 21 commits into
InferenceFormats #1982gspencergoog wants to merge 21 commits into
Conversation
34a0c18 to
0101648
Compare
This was referenced Jul 10, 2026
6238957 to
82bd501
Compare
89a547a to
1134c08
Compare
5266cef to
77a52dd
Compare
dd30576 to
914f571
Compare
c0e7429 to
33fc7c2
Compare
e910b3c to
090a859
Compare
…r API style(express): remove dead empty TYPE_CHECKING block in express prompt_generator.py feat(sdk): remove remaining A2UI_EXPRESS_ENABLED environment variable references feat(sdk): support complete flag on has_format_content for Express and Elemental feat(sdk): implement has_format_content for Express and Elemental parsers refactor(sdk): rename prompts directory to prompt (singular) refactor(sdk): hide Express and Elemental prompt generators from package exports refactor(sdk): expose prompt_generator on Express/Elemental formats and move to prompts/generator.py Refactor the Express and Elemental inference strategies to the new configuration.
0bbda91 to
d495ff0
Compare
InferenceFormats
…plate duplication - Promotes decompile, transform_examples, format_description, and catalog_description as abstract methods on the InferenceFormat base class. - Standardizes parameter signatures for format_description and catalog_description across Express, Elemental, and Transport formats. - Removes duplicated prompt templates and translation/compilation logic from ExpressPromptGenerator and ElementalPromptGenerator, delegating directly to the format classes. - Standardizes backwards-compatible prompt generator helpers to fallback to default format instances if initialized with raw catalog models. - Resolves all Python SDK unit tests and Kotlin conformance tests.
c7fd39d to
1cc6a6e
Compare
… clean up dataset invariant description
nan-yu
reviewed
Jul 16, 2026
…e prompt rules - Remove deprecated parse_elemental_response and parse_express_response wrapper functions. - Update all integration and compiler tests to instantiate and call ElementalParser and ExpressParser directly. - Move format-specific rules (constants) and transform_examples helper methods into ElementalPromptGenerator and ExpressPromptGenerator. - Remove format_description from InferenceFormat base class and subclasses. - Retain catalog_description on the strategy classes (ElementalFormat, ExpressFormat, TransportFormat) as requested.
… error retry context - Create custom A2uiCompilationError exception carrying error message, line, column, raw content, and partial results. - Add is_final field to ResponsePart and document all fields. - Refactor ExpressParser and ElementalParser to be stateless by tracking block truncation metadata on ResponsePart objects. - Propagate is_final metadata through compile method signatures to prevent stateful tracking on parser instances. - Wrap compiler exceptions in A2uiCompilationError and attach the preceding parsed parts. - Fix greedy tag parsing in ElementalParser's block detection. - Add comprehensive integration tests for ElementalParser.
…states - Create a shared generic state-machine BlockLexer utilizing a LexerState Enum to scan LLM responses. - Correctly handle string literals (including triple quotes), backslash escapes, and code comments to prevent premature tag detection when "</a2ui>" appears inside them. - Support open tag matching with attributes (e.g. `<a2ui id="main">`). - Handle global Markdown backticks wrapper cleaning globally inside BlockLexer for all inference formats. - Refactor ExpressParser and ElementalParser to use BlockLexer for unwrapping. - Add comprehensive unit tests validating BlockLexer.
…ag attributes loss - Implement preserve_enclosing_tags option in BlockLexer and configure it in ElementalParser to prevent losing <a2ui> start tag attributes (like id / surfaceId). - Remove circular state mutation/double-dispatch of helper/decompiler on prompt_gen in format.catalog_description. - Override __str__ on A2uiCompilationError to output formatted error locations (line, column) and help messages. - Modernize type annotations using Python 3.10 built-in generics and PEP 604 pipe unions. - Reformat modified files with pyink.
…compiler sentinel wrapping - Refactor A2UI Elemental root component tag from <a2ui> to <body>. - Unify sentinel wrapping under <a2ui>...</a2ui> across all formats (Express and Elemental). - Update ExpressDecompiler and ElementalDecompiler to return raw unwrapped DSL/HTML strings inside decompile(). - Delegate sentinel wrapping strictly to wrap_decompiled_blocks() inside decompiler classes. - Update BlockLexer to behave as a clean tag-stripping tokenizer. - Auto-append trailing </body> in ElementalParser if compiles a truncated/unclosed creation block.
…o PromptGenerator - Remove catalog_description from InferenceFormat base interface and all format subclasses. - Add catalog_description directly to PromptGenerator subclasses (Express, Elemental, Transport). - Update prompt generator internal callers to call catalog_description locally. - Move format catalog description unit tests into prompt generator tests, and update target references.
- Declare and annotate local/instance variables in BlockLexer and TransportPromptGenerator. - Refactor _clean_markdown to always return a string, updating related test assertions. - Resolve Liskov substitution violation in A2uiTemplateManager.generate_system_prompt. - Implement stub properties for abstract InferenceFormat methods inside A2uiTemplateManager. - Typecast TypedDict dictionary queries inside TransportFormat catalog resolution.
…actoring - Update mock model output payload in test_a2ui_elemental_solvers to use <body> root tag inside <a2ui> sentinels, reflecting A2UI Elemental refactoring contract.
- Make experiments parameter conditional on version == "1.0" in eval format strategy resolver. - Support resolving surface ID from both a2ui and body tags in completion solver regex. - Auto-close unclosed a2ui tags during streaming compilation in ElementalParser. - Ensure prompt generator delegates example decompilation using its pruned catalog decompiler if available. - Call _ensure_catalog before instantiating prompt generator in ExpressFormat property. - Fix prefix check for action properties in ElementalDecompiler to look for "on-".
…s and parser classes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Refactors the structured inference SDK API and evaluation harness in Python to unify the handling of different inference formats (standard JSON transport, experimental Express DSL, and experimental Elemental HTML). It does this by restructuring the formats as polymorphic implementations of the
InferenceFormatinterface and using these abstractions to consolidate system prompt generation and response parsing logic.Changes
agent_sdks/python/a2ui_agent/src/a2ui/inference_formats/experimental/.InferenceFormatclass (decompile,transform_examples,format_description,catalog_description) and implemented them acrossTransportFormat,ElementalFormat, andExpressFormat.ExpressPromptGenerator,ElementalPromptGenerator) to align with the new structure.direct.py,express.py,elemental.py) undereval/a2ui_eval/strategies/with a unifiedformat.pysolver.TransportFormat,ExpressFormat, orElementalFormat) based on config, allowing polymorphic prompt formatting and output compilation/validation.ElementalCompilerwhen multiple action properties are present.catalog_descriptionwhen called prior togenerate().ElementalParserto the module level for efficiency.eval/to fail fast.schema_manager.yamltoinference_format.yaml.Impact & Risks
InferenceFormatAPI and preserves external integration endpoints.Testing
Verify the changes by running all SDK and evaluation unit tests: