Skip to content

Rizzcharts kotlin#1014

Open
jgindin wants to merge 11 commits intogoogle:mainfrom
jgindin:rizzcharts-kotlin
Open

Rizzcharts kotlin#1014
jgindin wants to merge 11 commits intogoogle:mainfrom
jgindin:rizzcharts-kotlin

Conversation

@jgindin
Copy link
Copy Markdown
Collaborator

@jgindin jgindin commented Mar 27, 2026

Description

New Kotlin version of the rizzcharts sample using the Kotlin version of the A2UI SDK.

Pre-launch Checklist

Copy link
Copy Markdown
Contributor

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

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 a new Kotlin SDK for A2UI, providing core utilities for schema management, validation, and A2A protocol handling, along with a Kotlin implementation of the Rizzcharts sample agent. The review identifies a critical Kotlin version mismatch between the SDK and the sample project that causes build failures. Additionally, the agent's system prompt configuration incorrectly excludes the A2UI schema and examples, which are necessary for generating valid payloads. Further improvements suggested include using stable raw URLs for schema references and adding logging for JSON parsing failures in the A2A handler to improve debuggability.

Comment on lines +2 to +3
kotlin("jvm") version "2.1.10"
kotlin("plugin.serialization") version "2.1.10"
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.

critical

The agent_sdks/kotlin project specifies Kotlin version 2.1.10, but the samples/agent/adk/rizzcharts/kotlin project, which depends on it, specifies 2.3.0. This version mismatch leads to compilation errors, as indicated in compile_output.txt. For consistent builds and to avoid binary incompatibility issues, both projects should use the same Kotlin version.

plugins {
  kotlin("jvm") version "2.3.0"
  kotlin("plugin.serialization") version "2.3.0"

@@ -0,0 +1,49 @@
plugins {
kotlin("jvm") version "2.3.0"
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.

critical

The samples/agent/adk/rizzcharts/kotlin project specifies Kotlin version 2.3.0, but the agent_sdks/kotlin project, which it depends on, specifies 2.1.10. This version mismatch leads to compilation errors, as indicated in compile_output.txt. For consistent builds and to avoid binary incompatibility issues, both projects should use the same Kotlin version. It is recommended to align the agent_sdks/kotlin project to 2.3.0.

plugins {
    kotlin("jvm") version "2.3.0"

Comment on lines +29 to +31
ROLE_DESCRIPTION,
WORKFLOW_DESCRIPTION,
UI_DESCRIPTION,
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.

high

The generateSystemPrompt call sets includeSchema, includeExamples, and validateExamples to false. This prevents the A2UI JSON schema and examples from being included in the agent's system prompt. The WORKFLOW_DESCRIPTION explicitly states that the agent "MUST use the send_a2ui_json_to_client tool" and that the generated JSON "will be validated against the json_schema". Without the schema and examples in the prompt, the agent will struggle to generate valid A2UI JSON payloads, making it ineffective.

Suggested change
ROLE_DESCRIPTION,
WORKFLOW_DESCRIPTION,
UI_DESCRIPTION,
true,
true,
true,

"http://localhost:10002",
listOf(
"https://a2ui.org/specification/v0_8/standard_catalog_definition.json",
"https://github.com/google/A2UI/blob/main/samples/agent/adk/rizzcharts/rizzcharts_catalog_definition.json",
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.

medium

Referencing a GitHub blob URL for a schema (https://github.com/google/A2UI/blob/main/samples/agent/adk/rizzcharts/rizzcharts_catalog_definition.json) is not ideal. Blob URLs are meant for viewing files in the repository and are not stable or reliable for programmatic access, as their content type might not be application/json and they can change or become inaccessible. It's best practice to use a raw content URL or a properly hosted schema URL.

Suggested change
"https://github.com/google/A2UI/blob/main/samples/agent/adk/rizzcharts/rizzcharts_catalog_definition.json",
"https://raw.githubusercontent.com/google/A2UI/main/samples/agent/adk/rizzcharts/rizzcharts_catalog_definition.json",

parsedParts.add(dataPart)
}
} catch (e: Exception) {
// Parse error handled silently, might add error part
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.

medium

The comment indicates that JSON parsing errors are handled silently. While the code catches the exception, it doesn't log the error or propagate it in a way that would be visible to the caller or for debugging. Silent failures can make it difficult to diagnose issues when the LLM generates malformed JSON. It's better to log the exception at a warning or error level.

                    } catch (e: Exception) {
                      logger.warning("Failed to parse A2UI JSON from function call: ${e.message}")
                    }

}
return@flatMap parsedParts
} catch (e: Exception) {
// Parse error handled silently, fallback to standard raw text propagation
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.

medium

Similar to the previous point, JSON parsing errors are handled silently here. This can obscure problems with the LLM's output or the parsing logic. Logging the error would greatly assist in debugging.

                  } catch (e: Exception) {
                    logger.warning("Failed to parse A2UI JSON from text: ${e.message}")
                    // Fallback to standard raw text propagation
                  }

jgindin and others added 10 commits March 27, 2026 15:00
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Decompose the `handleA2aPost` method into smaller ones.

Also, fix the previous commit, which Github messed up.
Directly ported from the Python sample.
@jgindin jgindin force-pushed the rizzcharts-kotlin branch from a3a64de to 1ebd6d5 Compare March 27, 2026 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant