feat(adk): expose current messages to middleware - #1164
Open
March-77 wants to merge 1 commit into
Open
Conversation
Author
|
Revalidation update (2026-08-23): this remains mergeable against current main ( Local validation passes:
The PR still matches the first-class API direction requested in #868 and removes the skill middleware's Agentic fork-mode restriction. GitHub Actions have never started for this fork PR (CLA is passing), so the blocked state is required review rather than a failing check. A maintainer review/workflow approval when convenient would be appreciated. |
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.
What type of PR is this?
feat
Check the PR title.
(Optional) Translate the PR title into Chinese.
feat(adk): 向中间件开放当前消息列表
(Optional) More detailed description for this PR(en: English/zh: Chinese).
en:
ChatModelAgent middleware hooks that do not receive
TypedChatModelAgentStatecurrently have no first-class way to inspect the current message list. Consumers must reach intocompose.ProcessStateand the deprecated concreteadk.State; this is impossible forAgenticMessagebecause its internal state type is intentionally unexported.This change adds:
GetMessages(ctx)for the standard*schema.MessagepathTypedGetMessages[M](ctx)for both supported message typesThe skill middleware now consumes the public API instead of deprecated/internal state details, which also removes its message-state access restriction for the Agentic path.
User impact: middleware and tool hooks can inspect current messages without depending on compose internals. Existing APIs and behavior are unchanged.
Compatibility/risk: additive public API only. Message objects are intentionally shared and documented as read-only; only the returned slice is copied.
Validation:
go test ./adk -run "TestGetMessages|TestAgenticChatModelAgentRun_WithMiddleware" -count=10go test -race ./adk -run "TestGetMessages|TestAgenticChatModelAgentRun_WithMiddleware" -count=1go test ./adk/middlewares/skillgo test ./adkgo test ./...go vet ./...golangci-lintcould not be completed locally because the pinned runner repeatedly stalled while downloadinggithub.com/MirrexOne/unqueryvet v1.5.4.(Optional) Which issue(s) this PR fixes:
Fixes #868