RestatePlugin: after_model_callback never invoked - before_model_callback returns LlmResponse causing ADK to skip post-model hooks
まだ誰も着手していません。
評価
調査の方向性
まず、RestatePlugin.before_model_callback と、Google ADK による before_model_callback の戻り値の処理を追跡します。そのフローを after_model_callback および報告されているサブクラスによる回避策と比較します。追加のプラグインが登録されている場合でも、Restate の replay セマンティクスを壊すことなく、ポストモデルフックがモデルのレスポンスと使用量メタデータを受け取れるようになれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Bug Description
When registering additional plugins, alongside Restate (in our case it was for ADK-level observability), after_model_callback is never invoked. This makes it impossible to access the model response and usage metadata in post-call hook, which is the natural place to capture $ai_generation events.
Environment
restate-sdk(version 0.16.0)google-adk(1.28.1)RestatePlugin
Root Cause
The ADK framework uses the return value of before_model_callback as a signal:
None-> proceed with the real model call, then invokeafter_model_callbackLlmResponse-> short-circuit: skip the model call and skipafter_model_callback
RestatePlugin.before_model_callback wraps the LLM call inside a Restate durable step, which means it executes the model call itself and returns a LlmResponse. This is correct for Restate's replay semantics, but it has a side effect: after_model_callback is never reached, regardless of what subclasses implement there.
Workaround
Our current workaround is to subclass (decorate) the RestatePlugin itself, so we can simulate the after_model_callback trigger inside the wrapped before_model_callback call, but we believe this is worth tracking and resolving.
- 主要言語
- Python
- スター
- 81
- フォーク
- 23
- 平均マージ
- 4日 2時間
- マージ済み PR(30日)
- 1
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
restatedev/sdk-python のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
restatedev/sdk-python#223 · コメント 1 件 ·
-
難易度 2/5 1〜2日 初心者へのやさしさ 68/100
restatedev/sdk-python#204 · コメント 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
restatedev/sdk-python#225 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
restatedev/sdk-python#222 · コメント 1 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
restatedev/sdk-python#221 ·
restatedev/sdk-python の issue をすべて見る
似ている issue
-
upstream update
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
conan-io/conan-center-index#31098 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
john-kurkowski/tldextract#382 ·
-
comp/tools duplicate P2 sweeper:risk-compatibility tool/mcp type/bug
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
NousResearch/hermes-agent#132042 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
deepset-ai/haystack#13092 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 85/100
feder-cr/invisible_playwright_mcp#1408 ·
メンテナーはふだん 1 日以内に返信