a2ui

command
v1.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2026 License: Apache-2.0 Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

This sample serves an A2UI-enabled agent over HTTP, compatible with the browser frontend in js/testapps/a2ui/web. The whole A2UI integration is the a2ui middleware in the agent's inline prompt (`ai.WithUse(&a2ui.Surfaces{})`): it injects the catalog's capabilities into the system prompt and rewrites the model's a2ui fenced blocks into a2ui data parts that the client renderer consumes.

The agent is served at POST /api/uiAgent (plus the /getSnapshot and /abort companions the `remoteAgent` client expects), the exact endpoint the web UI talks to via `remoteAgent({ url: '/api/uiAgent' })`.

To run the whole thing:

  1. Start this backend (needs a Gemini API key in the environment):

    go run .

  2. Build and preview the web UI (in js/testapps/a2ui/web):

    pnpm install pnpm build pnpm preview

    Then open the printed URL (http://localhost:4173). The Vite preview server proxies /api to this backend on :8080.

You can also drive the agent directly with curl:

curl -N -X POST 'http://localhost:8080/api/uiAgent?stream=true' \
  -H "Content-Type: application/json" \
  -d '{"data": {"message": {"role": "user", "content": [{"text": "What is the weather in Tokyo?"}]}}}'

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL