Skip to content

Implement interactive CLI with prompt-toolkit - #3

Merged
jx-qiu merged 57 commits into
RLinf:mainfrom
jx-qiu:feature/interactive-cli
Jul 23, 2026
Merged

Implement interactive CLI with prompt-toolkit#3
jx-qiu merged 57 commits into
RLinf:mainfrom
jx-qiu:feature/interactive-cli

Conversation

@jx-qiu

@jx-qiu jx-qiu commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

This pull request introduces an interactive mode to the RPent CLI, allowing users to steer the agent in real-time by typing messages during execution. The implementation adds a new --interactive flag, a terminal UI for user input, and integrates interactive input handling into the agent loop for both the api and claude/codex backends.

liushb9 and others added 15 commits July 18, 2026 16:55
Signed-off-by: Jiaxing Qiu <jx.qiu@outlook.com>
Signed-off-by: Jiaxing Qiu <jx.qiu@outlook.com>
Signed-off-by: Jiaxing Qiu <jx.qiu@outlook.com>
Signed-off-by: Jiaxing Qiu <jx.qiu@outlook.com>
Signed-off-by: liujiyuan <lliiuu66@outlook.com>
Signed-off-by: Jiaxing Qiu <jx.qiu@outlook.com>
Signed-off-by: Jiaxing Qiu <jx.qiu@outlook.com>
Signed-off-by: Jiaxing Qiu <jx.qiu@outlook.com>
Signed-off-by: Jiaxing Qiu <jx.qiu@outlook.com>
Signed-off-by: Jiaxing Qiu <jx.qiu@outlook.com>
@jx-qiu
jx-qiu force-pushed the feature/interactive-cli branch from 6428ff0 to bb53af2 Compare July 20, 2026 04:37
@jx-qiu
jx-qiu requested review from qurakchin and wilburx813 July 21, 2026 08:33
wilburx813 and others added 2 commits July 21, 2026 17:13
Count unique top-level assistant message IDs instead of text blocks or ResultMessage.num_turns. Keep consuming after finish so final result usage and cost are retained.

Signed-off-by: liujiyuan <lliiuu66@outlook.com>
Signed-off-by: Hao Lin <linhaomails@gmail.com>
@wilburx813

wilburx813 commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Curious about what “/default” is for, seems the default prompt is already pre-filled and can be submitted by pressing Enter.

@wilburx813

wilburx813 commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator
image

maybe there are some bugs? it seems doesn't react to my messages.

my command:

  /mnt/public/ljy/.venv-opi-libero/bin/python \
    rpent/cli/main.py \
    --interactive \
    --suite libero_spatial_task \
    --task 0 \
    --seed 0 \
    --libero-type pro \
    --cerebrum claude_code \
    --model claude-opus-4-7 \
    --claude-code-max-budget-usd 30 \
    --max-turns 100 \
    --cerebrum-timeout-s 2400 \
    --cuda-device 1 \
    --vla-endpoint http://127.0.0.1:45665

liushb9 and others added 5 commits July 21, 2026 21:16
feat: support different cerebrums in dashboard mode
Signed-off-by: Hao Lin <linhaomails@gmail.com>
Co-authored-by: user <user@userdeMacBook-Air.local>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
liushb9 and others added 12 commits July 22, 2026 22:42
The Pi0.5 checkpoint URL in the README and docs pointed at
huggingface.co/datasets/..., which returns 401 -- the checkpoint is a
model repo, not a dataset.

  broken:  https://huggingface.co/datasets/RLinf/rlinf-pi05-libero-130-fullshot-sft
  correct: https://huggingface.co/RLinf/RLinf-Pi05-LIBERO-130-fullshot-SFT

Also switches to the repo's canonical casing. The all-lowercase form
307-redirects correctly, so that part is cosmetic, but it avoids
depending on the redirect.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
update readme, add link and fix table
Fix: correct broken HuggingFace checkpoint URL in README and documentation
…nf#38)

Signed-off-by: catr1xLiu <75480109+catr1xLiu@users.noreply.github.com>
Signed-off-by: Jiaxing Qiu <jx.qiu@outlook.com>
Signed-off-by: Jiaxing Qiu <jx.qiu@outlook.com>
Signed-off-by: Jiaxing Qiu <jx.qiu@outlook.com>
…ed prompt

Signed-off-by: Jiaxing Qiu <jx.qiu@outlook.com>
Copilot AI review requested due to automatic review settings July 23, 2026 03:30

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds an interactive mode to the RPent CLI so users can type messages during agent execution to steer subsequent turns, and wires that interactive input into the api, claude_code, and codex planners via a shared TUI helper.

Changes:

  • Add --interactive/-i CLI flag and a prompt-toolkit-based terminal UI that streams user lines into a queue.
  • Integrate queued user steering into planner loops (pydantic-ai loop injection, Claude session continuation, Codex steer/interrupt thread).
  • Document interactive mode in both English and Chinese READMEs and add prompt-toolkit as a dependency.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
rpent/planner/codex.py Adds optional interactive input queue handling for Codex via a steering thread and renders userMessage events.
rpent/planner/claude_code.py Adds optional interactive queue loop to continue a stateful Claude SDK client session one user line per turn.
rpent/planner/base.py Extends the Planner protocol with an optional input_queue for interactive steering.
rpent/planner/api_loop.py Adds interactive steering support by draining queued user messages into an active pydantic-ai run and looping between runs.
rpent/cli/tui.py New prompt-toolkit TUI module for interactive input, help/quit tokens, and queue helpers.
rpent/cli/main.py Adds --interactive/-i, starts the interactive reader, and passes the queue to the selected planner.
README.md Documents interactive mode usage and provides an example command.
README.zh-CN.md Documents interactive mode usage in Chinese and provides an example command.
pyproject.toml Adds prompt-toolkit dependency needed for the interactive TUI.
Comments suppressed due to low confidence (1)

rpent/planner/api_loop.py:264

  • The outer interactive loop currently continues after a run ends even if turns has reached max_turns, allowing another run to start and exceed the intended budget. Add an explicit turns >= max_turns check after the run closes to stop the session once the limit is hit.
                # finish => end the whole session immediately (chosen behavior).
                if finish_result is not None or quit_requested or not interactive:
                    break

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread rpent/planner/api_loop.py Outdated
Comment thread rpent/cli/tui.py Outdated
Comment thread rpent/cli/main.py
Comment thread README.md Outdated
Comment thread README.zh-CN.md Outdated
Comment thread rpent/planner/codex.py
…ed mid-read

Signed-off-by: Jiaxing Qiu <jx.qiu@outlook.com>
@jx-qiu

jx-qiu commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator Author

Curious about what “/default” is for, seems the default prompt is already pre-filled and can be submitted by pressing Enter.

Removed the /default command.

jx-qiu added 4 commits July 23, 2026 03:46
Signed-off-by: Jiaxing Qiu <jx.qiu@outlook.com>
Signed-off-by: Jiaxing Qiu <jx.qiu@outlook.com>
Signed-off-by: Jiaxing Qiu <jx.qiu@outlook.com>
Signed-off-by: Jiaxing Qiu <jx.qiu@outlook.com>
@jx-qiu
jx-qiu force-pushed the feature/interactive-cli branch from 6ca8e0f to b8d34fa Compare July 23, 2026 04:04
…-cli

# Conflicts:
#	README.md
#	README.zh-CN.md
#	docs/source-en/rst_source/installation.rst
#	docs/source-zh/rst_source/installation.rst
#	pyproject.toml
#	rpent/cli/main.py
#	rpent/planner/api_loop.py
#	rpent/planner/base.py
#	rpent/planner/claude_code.py
#	rpent/planner/codex.py
jx-qiu added 2 commits July 23, 2026 07:40
…ls from codex proxy

Signed-off-by: Jiaxing Qiu <jx.qiu@outlook.com>
Signed-off-by: Jiaxing Qiu <jx.qiu@outlook.com>
@jx-qiu
jx-qiu merged commit 4b3e749 into RLinf:main Jul 23, 2026
@jx-qiu
jx-qiu deleted the feature/interactive-cli branch July 23, 2026 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.