A2UIResponseParser
autogen.agents.experimental.a2ui.response_parser.A2UIResponseParser #
A2UIResponseParser(version_string, delimiter=A2UI_DEFAULT_DELIMITER, server_to_client_schema=None, schema_registry=None, component_schemas=None, catalog_id=None)
Parses and validates A2UI JSON from agent responses.
Looks for a delimiter in the agent's response text, extracts the JSON array after it, and optionally validates against the A2UI schema.
Source code in autogen/agents/experimental/a2ui/response_parser.py
parse #
Extract text and A2UI operations from an agent response.
| PARAMETER | DESCRIPTION |
|---|---|
response | The full agent response string. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
A2UIParseResult | An A2UIParseResult with the text, operations, and any errors. |
Source code in autogen/agents/experimental/a2ui/response_parser.py
format_validation_error #
Format validation errors as feedback for the LLM to self-correct.
| PARAMETER | DESCRIPTION |
|---|---|
parse_result | The parsed response that failed validation. TYPE: |
validation_result | The validation result with error details. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
str | A feedback message instructing the LLM to fix the errors. |
Source code in autogen/agents/experimental/a2ui/response_parser.py
validate #
Validate A2UI operations against the server_to_client schema.
| PARAMETER | DESCRIPTION |
|---|---|
operations | List of A2UI operation dicts to validate. |
| RETURNS | DESCRIPTION |
|---|---|
A2UIValidationResult | An A2UIValidationResult indicating validity and any errors. |