`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 摘要。