Skip to content

Feat/go sdk#1279

Open
chenman9226 wants to merge 6 commits intogoogle:mainfrom
acoder-ai-infra:feat/go-sdk
Open

Feat/go sdk#1279
chenman9226 wants to merge 6 commits intogoogle:mainfrom
acoder-ai-infra:feat/go-sdk

Conversation

@chenman9226
Copy link
Copy Markdown

Description

Summary of Changes

This pull request introduces a Go implementation of the A2UI agent SDK, addressing #539. An earlier attempt was made in #579, but that PR appears to be stale and now conflicts with the current codebase. This is a fresh implementation ported from the current Python SDK, fully aligned with the v0.9 specification and the latest conformance test suite.

Our team has been adopting A2UI for building agent-powered applications in production, and since Go is our primary technology stack, we implemented a native Go SDK to better integrate A2UI into our Go-based services. We hope this contribution is useful to the growing A2UI ecosystem and welcome any feedback.

Highlights

  • Schema Management: JSON Schema loading from embedded assets, catalog pruning, topology analysis, common type modifiers, and $ref resolution — fully aligned with the Python SDK's SchemaManager and A2uiValidator.
  • Streaming Parser: Incremental A2UI JSON parsing with partial payload fixing, delta streaming, multi-surface support, and built-in deduplication — matching the Python A2uiStreamParser behavior.
  • Basic Catalog: Out-of-the-box basiccatalog.GetConfig() for standard A2UI components (Button, Text, Row, Column, etc.), mirroring Python's BasicCatalog.get_config().
  • Conformance Tests: Full alignment with the cross-language conformance test suite.
  • Unit Tests: Comprehensive coverage for parser, schema, validator, catalog, and common modifiers.
  • Sample: Complete Go rizzcharts.
  • CI Workflow: GitHub Actions pipeline with build, vet, and test steps, scoped to Go SDK and specification changes.

Acknowledgments

Huge thanks to the A2UI team and existing contributors — particularly the authors of the Python SDK, whose clean architecture and thorough conformance test suite made this port straightforward. We hope this Go implementation is a useful addition to the community.

Note
The adk and a2a extension packages are not included in this initial PR, as our current use case focuses on the core SDK capabilities. We may add adk and a2a integration in a follow-up contribution.

The sample agent includes a minimal A2A JSON-RPC endpoint for demonstration purposes rather than depending on the full a2a-go SDK, to keep the example self-contained and easy to follow.

Pre-launch Checklist

If you need help, consider asking for advice on the discussion board.

…er, and basic catalog

Implement the A2UI agent SDK for Go, including:
- Schema management: JSON Schema loading, validation, catalog pruning,
  topology analysis, and common type modifiers
- Streaming parser: incremental A2UI JSON parsing with partial payload
  fixing, delta streaming, and multi-surface support
- Basic catalog: out-of-the-box configuration for standard A2UI components
- Conformance tests: full alignment with the cross-language test suite
- Unit tests: comprehensive coverage for parser, schema, and validator
- Add Go SDK README with installation, usage examples, and test instructions
- Update agent_sdk_guide.md to reference Go ecosystem (encoding/json)
- Add Go BasicCatalog entry to the SDK guide
- Add GitHub Actions workflow for Go SDK build, vet, and test
Add a complete Go implementation of the rizzcharts demo agent, including:
- Gemini LLM integration with function calling for chart generation
- A2UI streaming parser for real-time UI rendering
- Minimal A2A JSON-RPC endpoint for message/send
- Regex-based a2ui-json tag parsing for LLM output tolerance
- Environment-based configuration with .env.example
@google-cla
Copy link
Copy Markdown

google-cla Bot commented Apr 25, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

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 the Go implementation of the A2UI Agent SDK, providing core functionality for schema management, validation, and both synchronous and streaming response parsing. It includes a bundled basic catalog and a sample agent implementation. Feedback focuses on enhancing the SDK's robustness and performance, specifically by completing the inline catalog merging logic, using json.Number to avoid numeric validation mismatches, and optimizing the validator to eliminate redundant serialization cycles. Additionally, corrections were suggested for the streaming parser's buffer management and placeholder heuristics, along with a recommendation to implement buffer size limits to prevent memory exhaustion from malformed LLM output.

Comment thread agent_sdks/go/schema/manager.go
Comment thread agent_sdks/go/parser/streaming.go Outdated
Comment thread agent_sdks/go/schema/validator.go
Comment thread agent_sdks/go/parser/streaming.go
Comment thread agent_sdks/go/parser/streaming.go Outdated
Comment thread agent_sdks/go/parser/streaming.go
chenman9226 and others added 3 commits April 25, 2026 20:02
- Merge $defs from inline catalogs to preserve local $ref references
- Use json.Decoder with UseNumber() to avoid float64 numeric mismatches
- Unify buffer cleanup logic to correctly handle non-zero startIdx
- Add 10MB JSON buffer size limit to prevent memory exhaustion
- Add clarifying comments for toJSONSchemaValue and placeholder heuristic
@chenman9226
Copy link
Copy Markdown
Author

Hi @jacobsimionato Could you please review this PR? Thanks!

@jacobsimionato
Copy link
Copy Markdown
Collaborator

chenman9226 thank you for preparing this PR and sorry that we missed the last one!

I don't believe a Go SDK is on our roadmap for SDKs within the core repository at the moment. We have some plans to revisit the agent SDK design, and we're eager to not accumulate too many ports within our repository before we stabilize the shared architecture. Would you mind creating this in a separate repository and publishing it yourself? We aim for A2UI to be a decentralized ecosystem, with only a few core packages in small number of languages maintained centrally.

@nan-yu does this match your understanding re Go?

@chenman9226
Copy link
Copy Markdown
Author

chenman9226 thank you for preparing this PR and sorry that we missed the last one!

I don't believe a Go SDK is on our roadmap for SDKs within the core repository at the moment. We have some plans to revisit the agent SDK design, and we're eager to not accumulate too many ports within our repository before we stabilize the shared architecture. Would you mind creating this in a separate repository and publishing it yourself? We aim for A2UI to be a decentralized ecosystem, with only a few core packages in small number of languages maintained centrally.

@nan-yu does this match your understanding re Go?

Thanks for the context, that makes a lot of sense, and I'm happy to maintain this as a separate repository in my organization.

A couple of follow-up questions while I have your attention:

  1. Both the ADK and the A2A protocol already have official Go implementations, so Go feels like a natural fit for the agent SDK layer too. Is Go on the radar when you revisit the shared architecture, or is the plan still Python/TypeScript-first for now?

  2. Since there's no firm timeline on stabilization, would you be open to adding a link to the Go SDK in the ecosystem or community section of the docs? I'd also like to avoid a situation where multiple independent Go implementations emerge in the wild — a single listed reference would help the community converge.

Happy to discuss any of this in a separate Discussion thread if that's easier. Thanks again for the quick response!

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.

2 participants