`adk run` does not support arrow keys or input history

未關閉 適合新手
#8,022 2 則留言 0 個 reaction 已指派 1 人 在 GitHub 檢視

維護者通常 3 天內回覆

@llalitkumarrr 已經在處理了。

開始於 2026年11月9日。

  • #8023 來自 @Stephnn0 —— 未關閉

評估

難度
1/5
預估耗時
1-3 小時
新手友好度
84/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
python
領域
cli

研究方向

從 src/google/adk/cli/cli.py 中的 run_interactively 開始,這裡的 [user]: 提示字元使用 Python 內建的 input()。檢查 CLI 如何處理無法使用 readline 的平台,接著執行 adk run 並確認方向鍵可以編輯輸入內容,向上鍵可以叫出上一則訊息,而且不會將跳脫序列傳送給代理程式。

由索引模型根據 Issue 內容生成。

描述

cli

🔴 Required Information

Describe the Bug:
In adk run, the arrow keys don't work at the [user]: prompt. Pressing arrow up prints ^[[A instead of recalling the previous message, and left/right arrows can't move the cursor to edit a line.

Steps to Reproduce:

  1. pip install google-adk
  2. Create any agent folder and run adk run my_agent
  3. Send a message, e.g. hello
  4. At the next [user]: prompt, press arrow up

Expected Behavior:
Arrow up recalls hello, like in most terminal programs (and the Python REPL).

Observed Behavior:
^[[A is printed. If you press Enter, the raw escape sequence '\x1b[A' is sent to the agent as the message.

Environment Details:

  • ADK Library Version (pip show google-adk): 2.14.0
  • Desktop OS: macOS
  • Python Version (python -V): 3.12

Model Information:

  • Are you using LiteLLM: No
  • Which model is being used: gemini-3.5-flash (not model-specific)

🟡 Optional Information

Additional Context:
run_interactively in src/google/adk/cli/cli.py reads input with the built-in input(). input() only provides line editing and history after the readline module has been imported, and the CLI never imports it. Importing readline (when available; it is not on Windows) fixes it. I'm happy to send a PR.

How often has this issue occurred?:

  • Always (100%)
主要語言
Python
星號
22.3k
分支
4.4k
平均合併
1 天 2 小時
30 天內合併 PR
6

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

google/adk-python 的其他 Issue

查看 google/adk-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。