[Bug] SequentialAgent live mode glues the completion instruction onto the sub-agent instruction with no separator
メンテナーはふだん 3 日以内に返信
評価
この issue はまだ評価されていません。
説明
[Bug] SequentialAgent live mode glues the completion instruction onto the sub-agent instruction with no separator
Describe the Bug
In live mode, SequentialAgent appends a completion instruction ("If you finished the user's request ... call the task_completed function ...") to each sub-agent's instruction so the model knows how to hand off to the next agent. The append is a bare string concatenation with no separator, so a sub-agent instruction ending in normal text gets glued to the suffix:
- sub-agent instruction:
You are helpful. - after one live run:
You are helpful.If you finished the user's request ...
The model receives a malformed sentence boundary (helpful.If) instead of two separate paragraphs. It happens on every live run whose sub-agent instruction does not already end with whitespace.
Steps to Reproduce
- Install
google-adkfrommain(2.15.0, commit2b90353). - Run:
from google.adk.agents.sequential_agent import _append_instruction
_append_instruction('You are helpful.', 'If you finished...')
# -> 'You are helpful.If you finished...'
- Or run a live session: a
SequentialAgentwith a singleLlmAgentsub-agent whoseinstructionis'You are helpful.', then callrun_live. After the run starts,sub_agent.instructionis'You are helpful.If you finished the user's request ...'.
Expected Behavior
The completion instruction starts its own paragraph:
You are helpful.\n\nIf you finished the user's request ...
Edge cases: an empty base instruction needs no separator ('' + suffix = suffix), and a base instruction that already ends with whitespace should not gain an extra blank line.
Observed Behavior
You are helpful.If you finished the user's request ... — no space, no newline between the two instructions. The same gluing happens for InstructionProvider (callable) instructions, since the provider path concatenates the resolved string the same way.
Environment Details
- ADK Library Version (pip show google-adk): 2.15.0 (
main@2b90353) - Desktop OS: Linux
- Python Version (python -V): 3.12
Model Information
- Are you using LiteLLM: No
- Which model is being used: N/A (no model call is needed to reproduce; the instruction string is malformed before any model call)
Regression
Unknown — not checked against earlier releases.
How often has this issue occurred?
- Always (100%)
Root Cause
_append_instruction in src/google/adk/agents/sequential_agent.py joins with plain + in both paths:
return instruction + suffix(plainstrinstruction)return resolved + suffix(insidecombined(), theInstructionProviderpath)
Its only caller is SequentialAgent._run_live_impl, which appends the task_completed completion instruction. The codebase convention elsewhere is to separate instructions with a blank line — LlmRequest.append_instructions concatenates with \n\n — so the fix is to join the two parts with \n\n, skipping the separator when the base is empty or already ends with whitespace.
Additional Context
Two open PRs touch the same function but do not collide with this fix: #8285 ("keep live sequential completion tool off shared sub-agents") and #8286 ("keep the live task_completed out of the shared child agent", closes #8282) both only re-site the _append_instruction call to stop mutating shared sub-agent objects — neither changes how the two strings are joined. All three touch sequential_agent.py and test_sequential_agent.py, so whichever lands first, the others will need a rebase.
Minimal Reproduction Code
from google.adk.agents.sequential_agent import _append_instruction
assert _append_instruction('You are helpful.', 'If you finished...') == \
'You are helpful.\n\nIf you finished...' # fails on main: got 'You are helpful.If you finished...'
- 主要言語
- Python
- スター
- 22.3k
- フォーク
- 4.4k
- 平均マージ
- 1日 2時間
- マージ済み PR(30日)
- 6
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
google/adk-python のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
google/adk-python#8360 ·
メンテナーはふだん 3 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
google/adk-python#8359 ·
メンテナーはふだん 3 日以内に返信
-
Can pin to litellm version be changed?対応中かも @llalitkumarrr が 10 日前に担当しました。 オープンmodels
難易度 1/5 1時間未満 初心者へのやさしさ 65/100
google/adk-python#8129 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 3 日以内に返信
-
OpenAPI tools ignore operation- and path-level server overrides対応中かも @sanketpatil06 が 14 日前に担当しました。 オープンtools
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
google/adk-python#8064 · コメント 4 件 · 担当者 1 名 ·
メンテナーはふだん 3 日以内に返信
-
Two docstrings in openapi_tool document parameters the signatures do not accept対応中かも @surajksharma07 が 17 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
google/adk-python#8024 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 3 日以内に返信
google/adk-python の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
vllm-project/vllm#70030 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
TigreGotico/tugaphone#408 ·
メンテナーはふだん 1 日以内に返信
-
needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
gke-labs/kube-agents#7308 ·
メンテナーはふだん 1 日以内に返信
-
t: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 3 日以内に返信
-
chore
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
lugassawan/swe-workbench#841 ·