Skip to content

Add Google ADK generative-UI chat example#755

Merged
vishxrad merged 1 commit into
thesysdev:mainfrom
rabisg:add-google-adk-openui-example
Jul 13, 2026
Merged

Add Google ADK generative-UI chat example#755
vishxrad merged 1 commit into
thesysdev:mainfrom
rabisg:add-google-adk-openui-example

Conversation

@rabisg

@rabisg rabisg commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Overview

Adds examples/google-adk: a Next.js app that wires a Google Agent Development Kit (ADK, TypeScript) agent to OpenUI's generative UI frontend — alongside the existing mastra-chat / langgraph-chat agent examples.

What it demonstrates

  • A Google ADK Agent with a FunctionTool (weather) running in a Next.js API route via Runner + InMemorySessionService, with ADK sessions keyed by chat threadId so multi-turn history is preserved.
  • The integration bridge: ADK's runAsync SSE event stream is translated into OpenAI-style chat-completion chunks so OpenUI's openAIAdapter() can parse them. Partial events stream as deltas; the final aggregated event is skipped to avoid duplication.
  • Rendering the streamed OpenUI Lang with <AgentInterface /> and the built-in openuiChatLibrary. The agent is prompted with OpenUI's generated system prompt (src/generated/system-prompt.txt) so its replies are OpenUI Lang.

How to run

cd examples/google-adk
echo "GEMINI_API_KEY=your-key" > .env.local   # free key: https://aistudio.google.com/apikey
pnpm install   # from the monorepo root
pnpm dev       # http://localhost:3000

Verification

  • tsc --noEmit ✓, next build
  • Ran the dev server: GET / → 200; POST /api/chat streams text/event-stream in the exact chunk shape openAIAdapter() expects. ADK logs confirm it created the user event and issued a streaming gemini-flash-latest request. (Model call only fails on a placeholder key — the route catches it and closes the stream cleanly.)

Notes for reviewers

  • pnpm-lock.yaml gains the examples/google-adk importer plus @google/adk's dependency tree. The install was regenerated from the committed lockfile so only google-adk's footprint and the unavoidable shared peer-hash ripple (it pulls encoding into the hoisted graph) change — no other example's importer block is touched, and there are no orphaned removals (just two trivial transitive bumps: @emnapi/runtime and a postcss patch under autoprefixer).

🤖 Generated with Claude Code

Adds examples/google-adk: a Next.js app that wires a Google Agent
Development Kit (ADK, TypeScript) agent to OpenUI's generative UI
frontend, alongside the existing mastra-chat / langgraph-chat agent
examples.

What it demonstrates
- A Google ADK `Agent` with a `FunctionTool` (weather) running in a
  Next.js API route via `Runner` + `InMemorySessionService`, with ADK
  sessions keyed by chat `threadId` so multi-turn history is preserved.
- Bridging ADK's `runAsync` SSE event stream into OpenAI-style
  chat-completion chunks so OpenUI's `openAIAdapter()` can parse them
  (partial events are streamed as deltas; the final aggregated event is
  skipped to avoid duplication).
- Rendering the streamed OpenUI Lang with `<AgentInterface />` and the
  built-in `openuiChatLibrary`. The agent is prompted with OpenUI's
  generated system prompt so replies are OpenUI Lang.

Notes for reviewers
- Requires a Gemini API key (GEMINI_API_KEY) in .env.local; free key at
  https://aistudio.google.com/apikey.
- pnpm-lock.yaml gains the examples/google-adk importer plus @google/adk's
  dependency tree. The install was regenerated from the committed lockfile
  so only google-adk's footprint and the unavoidable shared peer-hash
  ripple (it pulls `encoding` into the hoisted graph) change; no other
  example's importer block is touched.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@rabisg rabisg requested a review from vishxrad July 13, 2026 08:56
@vishxrad vishxrad merged commit 936d78d into thesysdev:main Jul 13, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants