feat(adk): migrate to REASONING events and add encrypted value support - #1411
Merged
Conversation
…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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Python Preview PackagesVersion
Install with uvAdd the TestPyPI index to your [[tool.uv.index]]
name = "testpypi"
url = "https://test.pypi.org/simple/"
explicit = trueThen 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 testpypiInstall with pippip install \
--index-url https://test.pypi.org/simple/ \
--extra-index-url https://pypi.org/simple/ \
ag-ui-protocol==0.0.0.dev1775110154
Commit: 93b1900 |
@ag-ui/a2a-middleware
@ag-ui/a2ui-middleware
@ag-ui/mcp-apps-middleware
@ag-ui/middleware-starter
@ag-ui/a2a
@ag-ui/adk
@ag-ui/ag2
@ag-ui/agno
@ag-ui/aws-strands
@ag-ui/claude-agent-sdk
@ag-ui/crewai
@ag-ui/langchain
@ag-ui/langgraph
@ag-ui/langroid
@ag-ui/llamaindex
@ag-ui/mastra
@ag-ui/pydantic-ai
@ag-ui/server-starter
@ag-ui/server-starter-all-features
@ag-ui/vercel-ai-sdk
create-ag-ui-app
@ag-ui/client
@ag-ui/core
@ag-ui/encoder
@ag-ui/proto
commit: |
@ag-ui/a2a-middleware
@ag-ui/a2ui-middleware
@ag-ui/mcp-apps-middleware
@ag-ui/middleware-starter
@ag-ui/a2a
@ag-ui/adk
@ag-ui/ag2
@ag-ui/agno
@ag-ui/aws-strands
@ag-ui/claude-agent-sdk
@ag-ui/crewai
@ag-ui/langchain
@ag-ui/langgraph
@ag-ui/langroid
@ag-ui/llamaindex
@ag-ui/mastra
@ag-ui/pydantic-ai
@ag-ui/server-starter
@ag-ui/server-starter-all-features
@ag-ui/vercel-ai-sdk
create-ag-ui-app
@ag-ui/client
@ag-ui/core
@ag-ui/encoder
@ag-ui/proto
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #1406
THINKING_*events toREASONING_*events in the ADK middleware, aligning with the Claude Agent SDK and LangGraph integrations which already use the newer event typesREASONING_ENCRYPTED_VALUEsupport — extractsthought_signaturebytes from Google GenAI SDKPartobjects and emits them as base64-encoded encrypted value events, enabling zero-data-retention workflows with Gemini/adk-reasoning-chat) using Gemini 2.5 Flash withinclude_thoughts=TrueEvent mapping
THINKING_STARTREASONING_STARTTHINKING_TEXT_MESSAGE_STARTREASONING_MESSAGE_STARTTHINKING_TEXT_MESSAGE_CONTENTREASONING_MESSAGE_CONTENTTHINKING_TEXT_MESSAGE_ENDREASONING_MESSAGE_ENDTHINKING_ENDREASONING_ENDREASONING_ENCRYPTED_VALUETest plan
GOOGLE_API_KEY)gemini-2.5-flash+include_thoughts=True/adk-reasoning-chatendpoint🤖 Generated with Claude Code