Skip to content

feat(adk): migrate to REASONING events and add encrypted value support - #1411

Merged
contextablemark merged 5 commits into
mainfrom
claude/assess-issue-1406-VPfEn
Apr 2, 2026
Merged

feat(adk): migrate to REASONING events and add encrypted value support#1411
contextablemark merged 5 commits into
mainfrom
claude/assess-issue-1406-VPfEn

Conversation

@contextablemark

Copy link
Copy Markdown
Contributor

Summary

Closes #1406

  • Migrate from deprecated THINKING_* events to REASONING_* events in the ADK middleware, aligning with the Claude Agent SDK and LangGraph integrations which already use the newer event types
  • Add REASONING_ENCRYPTED_VALUE support — extracts thought_signature bytes from Google GenAI SDK Part objects and emits them as base64-encoded encrypted value events, enabling zero-data-retention workflows with Gemini
  • Add reasoning chat example (/adk-reasoning-chat) using Gemini 2.5 Flash with include_thoughts=True

Event mapping

Before (deprecated) After
THINKING_START REASONING_START
THINKING_TEXT_MESSAGE_START REASONING_MESSAGE_START
THINKING_TEXT_MESSAGE_CONTENT REASONING_MESSAGE_CONTENT
THINKING_TEXT_MESSAGE_END REASONING_MESSAGE_END
THINKING_END REASONING_END
(not supported) REASONING_ENCRYPTED_VALUE

Test plan

  • All 62 unit tests pass (including 2 new tests for thought signature handling)
  • All 7 e2e integration tests pass against real Gemini API (GOOGLE_API_KEY)
    • Reasoning events are required (not optional) with gemini-2.5-flash + include_thoughts=True
    • Validates per-block message_id consistency, role, well-formedness, and encrypted value structure
    • Handles multi-block reasoning (thought/text interleaving during streaming)
  • Full suite: 703 passed, 5 skipped, 2 pre-existing failures (unrelated HITL/LRO issues)
  • Interactive testing via dojo with /adk-reasoning-chat endpoint

🤖 Generated with Claude Code

claude and others added 4 commits April 1, 2026 19:43
…s and add encrypted value support

Migrates the ADK middleware from deprecated THINKING_* events to the newer
REASONING_* event types, and adds support for thought signatures via
REASONING_ENCRYPTED_VALUE events. This brings the ADK integration in line
with the Claude Agent SDK and LangGraph integrations.

Changes:
- Replace ThinkingStart/End and ThinkingTextMessage* events with
  ReasoningStart/End and ReasoningMessage* events
- Extract thought_signature from Google GenAI SDK Part objects and emit
  as REASONING_ENCRYPTED_VALUE events (base64-encoded)
- Update all internal state tracking variables (_is_thinking -> _is_reasoning, etc.)
- Update comprehensive tests and integration tests to expect REASONING events
- Add new tests for thought signature / encrypted value handling

Closes #1406

https://claude.ai/code/session_01Tn74iGdv36gg9zys3yQaAz
…encrypted values, and stream ordering

Adds 5 new integration tests (requiring GOOGLE_API_KEY) that validate:
- All reasoning events in a block share the same message_id
- REASONING_MESSAGE_START carries role="reasoning"
- REASONING_ENCRYPTED_VALUE events contain valid base64 thought signatures
  with correct entity_id and subtype
- Reasoning stream is fully closed before text message events begin

https://claude.ai/code/session_01Tn74iGdv36gg9zys3yQaAz
…ng events

- Reasoning events are now required (not optional) since gemini-2.5-flash
  with include_thoughts=True always produces them
- Fix message_id consistency test to validate per-block rather than
  globally, since streaming can produce multiple reasoning blocks when
  thought/text parts interleave across partial events
- Replace stream-ordering test with well-formedness check that validates
  each block is properly opened/closed (START/END balanced, no overlap)
- Add helper _get_reasoning_blocks() to extract START-to-END blocks

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add agentic_chat_reasoning example agent using Gemini 2.5 Flash with
  include_thoughts=True, registered at /adk-reasoning-chat
- Update CHANGELOG.md unreleased section to document all changes:
  migration from THINKING to REASONING events, encrypted value support,
  and the new example

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Apr 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ag-ui-dojo Ready Ready Preview, Comment Apr 2, 2026 6:11am

Request Review

@github-actions github-actions Bot left a comment

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.

Auto-approved: PR author contextablemark has CODEOWNERS access to all changed files (excluding root rule)

@github-actions

github-actions Bot commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

Python Preview Packages

Version 0.0.0.dev1775110154 published to TestPyPI.

Warning: These packages are built from contributor code that may not yet have been vetted for correctness or security. Install at your own risk and do not use in production.

Install with uv

Add the TestPyPI index to your pyproject.toml:

[[tool.uv.index]]
name = "testpypi"
url = "https://test.pypi.org/simple/"
explicit = true

Then install the packages you need:

# Core SDK
uv add 'ag-ui-protocol==0.0.0.dev1775110154' --index testpypi

# Integrations (each already depends on the matching ag-ui-protocol preview)
uv add 'ag-ui-langgraph==0.0.0.dev1775110154' --index testpypi
uv add 'ag-ui-crewai==0.0.0.dev1775110154' --index testpypi
# NOTE: ag-ui-agent-spec depends on pyagentspec (git-only, not on PyPI).
# You will need to install pyagentspec separately from its git repo.
uv add 'ag-ui-agent-spec==0.0.0.dev1775110154' --index testpypi
uv add 'ag_ui_adk==0.0.0.dev1775110154' --index testpypi
uv add 'ag_ui_strands==0.0.0.dev1775110154' --index testpypi

Install with pip

pip install \
  --index-url https://test.pypi.org/simple/ \
  --extra-index-url https://pypi.org/simple/ \
  ag-ui-protocol==0.0.0.dev1775110154

Use --extra-index-url https://pypi.org/simple/ so pip can resolve
transitive dependencies (pydantic, fastapi, etc.) from real PyPI.


Commit: 93b1900

@pkg-pr-new

pkg-pr-new Bot commented Apr 2, 2026

Copy link
Copy Markdown

Open in StackBlitz

@ag-ui/a2a-middleware

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/a2a-middleware@1411

@ag-ui/a2ui-middleware

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/a2ui-middleware@1411

@ag-ui/mcp-apps-middleware

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/mcp-apps-middleware@1411

@ag-ui/middleware-starter

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/middleware-starter@1411

@ag-ui/a2a

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/a2a@1411

@ag-ui/adk

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/adk@1411

@ag-ui/ag2

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/ag2@1411

@ag-ui/agno

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/agno@1411

@ag-ui/aws-strands

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/aws-strands@1411

@ag-ui/claude-agent-sdk

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/claude-agent-sdk@1411

@ag-ui/crewai

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/crewai@1411

@ag-ui/langchain

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/langchain@1411

@ag-ui/langgraph

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/langgraph@1411

@ag-ui/langroid

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/langroid@1411

@ag-ui/llamaindex

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/llamaindex@1411

@ag-ui/mastra

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/mastra@1411

@ag-ui/pydantic-ai

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/pydantic-ai@1411

@ag-ui/server-starter

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/server-starter@1411

@ag-ui/server-starter-all-features

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/server-starter-all-features@1411

@ag-ui/vercel-ai-sdk

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/vercel-ai-sdk@1411

create-ag-ui-app

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/create-ag-ui-app@1411

@ag-ui/client

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/client@1411

@ag-ui/core

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/core@1411

@ag-ui/encoder

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/encoder@1411

@ag-ui/proto

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/proto@1411

commit: e6dd067

@pkg-pr-new

pkg-pr-new Bot commented Apr 2, 2026

Copy link
Copy Markdown

Open in StackBlitz

@ag-ui/a2a-middleware

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/a2a-middleware@1411

@ag-ui/a2ui-middleware

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/a2ui-middleware@1411

@ag-ui/mcp-apps-middleware

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/mcp-apps-middleware@1411

@ag-ui/middleware-starter

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/middleware-starter@1411

@ag-ui/a2a

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/a2a@1411

@ag-ui/adk

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/adk@1411

@ag-ui/ag2

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/ag2@1411

@ag-ui/agno

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/agno@1411

@ag-ui/aws-strands

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/aws-strands@1411

@ag-ui/claude-agent-sdk

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/claude-agent-sdk@1411

@ag-ui/crewai

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/crewai@1411

@ag-ui/langchain

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/langchain@1411

@ag-ui/langgraph

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/langgraph@1411

@ag-ui/langroid

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/langroid@1411

@ag-ui/llamaindex

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/llamaindex@1411

@ag-ui/mastra

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/mastra@1411

@ag-ui/pydantic-ai

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/pydantic-ai@1411

@ag-ui/server-starter

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/server-starter@1411

@ag-ui/server-starter-all-features

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/server-starter-all-features@1411

@ag-ui/vercel-ai-sdk

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/vercel-ai-sdk@1411

create-ag-ui-app

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/create-ag-ui-app@1411

@ag-ui/client

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/client@1411

@ag-ui/core

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/core@1411

@ag-ui/encoder

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/encoder@1411

@ag-ui/proto

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/proto@1411

commit: e6dd067

@contextablemark
contextablemark merged commit 0947b43 into main Apr 2, 2026
29 checks passed
@contextablemark
contextablemark deleted the claude/assess-issue-1406-VPfEn branch April 2, 2026 06:15
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.

[Feature]: [adk] Enhance support for Reasoning Messages

2 participants