feat(adk): add structured AgentEventType taxonomy to AgentEvent - #1231
Open
Ethanz11-creat wants to merge 2 commits into
Open
feat(adk): add structured AgentEventType taxonomy to AgentEvent#1231Ethanz11-creat wants to merge 2 commits into
Ethanz11-creat wants to merge 2 commits into
Conversation
Add a reusable ADK middleware that connects the agent lifecycle hooks to an application-provided MemoryStore, so long-running agents can retrieve and inject long-term memory before a run and optionally write facts or summaries back after a run. The middleware injects memory once per run (before the first model call) to avoid re-injecting on every tool-call loop, resolves a configurable memory namespace in BeforeAgent, and delegates persistence decisions to a WritePolicy invoked in AfterAgent. Memory backend implementations stay outside eino core; the middleware only depends on the MemoryStore interface (closes cloudwego#995).
Add an explicit, stable event-type taxonomy to TypedAgentEvent so that applications can reliably distinguish agent lifecycle, model, tool, transfer, interrupt and error events for debugging, tracing (Langfuse/Cozeloop/OTel), UI rendering and durable event logs. The new AgentEvent.Type field is additive and defaults to the zero value (AgentEventUnknown), so existing consumers and persisted events are unaffected. Type is populated at the framework's central event constructors: - message events (model/tool, streaming or not) via typedEventFromMessage and EventFromAgenticMessage - interrupt actions via TypedInterrupt/StatefulInterrupt/CompositeInterrupt - action events (exit/transfer/break-loop) when the action is attached - every terminal error event Lifecycle start events (agent_start/model_start/tool_start) require new emission points and are intentionally deferred to a follow-up (closes cloudwego#997).
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.
Closes #997
Adds a stable, documented event taxonomy to ADK
AgentEventso applications can reliably distinguish event kinds for debugging, tracing, UI rendering and durable event logs — without inferring them fromOutput/Action/Err.What changed
TypedAgentEvent[M]gains an additiveType AgentEventTypefield (zero valueAgentEventUnknown, so existing consumers and persisted checkpoints are unaffected), plus the following taxonomy:AgentEventModelEnd/ModelDeltatypedEventFromMessage,EventFromAgenticMessageAgentEventToolEnd/ToolDeltaAgentEventAgentEndAgentEventTransferAgentEventBreakLoopAgentEventInterruptTypedInterrupt/StatefulInterrupt/CompositeInterrupt+ Runner reconstructionAgentEventErrorAgentEventResumeType is set at the framework's central constructors (
typedEventFromMessage,EventFromAgenticMessage) and action-attachment points (typedEventSenderToolWrapper,sendTransferEvents,Runnerinterrupt reconstruction), so it is populated uniformly across the message and AgenticMessage paths.Scope note
agent_start/model_start/tool_startare intentionally deferred: they require new emission points at lifecycle boundaries rather than tagging existing events, and are better as a follow-up so this change stays purely additive and low-risk. This PR establishes the taxonomy and metadata model the issue asks for.Tests
adk/event_type_test.gocovers message/tool/agentic type mapping, action classification (exit/transfer/interrupt/break-loop), and interrupt event typing.go test ./adk/...passes.