Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion libs/deepagents-cli/deepagents_cli/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,22 @@
class SessionState:
"""Holds mutable session state (auto-approve mode, etc)."""

def __init__(self, auto_approve: bool = False):
def __init__(self, auto_approve: bool = False, show_thinking: bool = False):
self.auto_approve = auto_approve
self.show_thinking = show_thinking
self.show_tool_outputs = False
self.exit_hint_until: float | None = None
self.exit_hint_handle = None

def toggle_auto_approve(self) -> bool:
"""Toggle auto-approve and return new state."""
self.auto_approve = not self.auto_approve
return self.auto_approve

def toggle_tool_outputs(self) -> bool:
"""Toggle tool output visibility and return new state."""
self.show_tool_outputs = not self.show_tool_outputs
return self.show_tool_outputs


def get_default_coding_instructions() -> str:
Expand Down
17 changes: 14 additions & 3 deletions libs/deepagents-cli/deepagents_cli/execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,14 @@ def flush_text_buffer(*, final: bool = False) -> None:
tool_content = format_tool_message_content(message.content)
record = file_op_tracker.complete_with_message(message)

# Display tool output if toggle is enabled
if session_state.show_tool_outputs and tool_content:
if spinner_active:
status.stop()
spinner_active = False
console.print(f" ↳ {tool_content}", style="dim cyan", markup=False)
console.print()

# Reset spinner message after tool completes
if spinner_active:
status.update(f"[bold {COLORS['thinking']}]Agent is thinking...")
Expand Down Expand Up @@ -399,12 +407,15 @@ def flush_text_buffer(*, final: bool = False) -> None:
elif block_type == "reasoning":
flush_text_buffer(final=True)
reasoning = block.get("reasoning", "")
if reasoning:
if reasoning and session_state.show_thinking:
if spinner_active:
status.stop()
spinner_active = False
# Could display reasoning differently if desired
# For now, skip it or handle minimally
if not has_responded:
console.print("●", style=COLORS["agent"], markup=False, end=" ")
has_responded = True
# Display reasoning in dim style
console.print(reasoning, style="dim")

# Handle tool call chunks
elif block_type == "tool_call_chunk":
Expand Down
17 changes: 17 additions & 0 deletions libs/deepagents-cli/deepagents_cli/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,13 @@ def toolbar() -> list[tuple[str, str]]:

parts.append((base_class, base_msg))

# Show tool output toggle state
parts.append(("", " | "))
if session_state.show_tool_outputs:
parts.append(("class:toolbar-blue", "tool outputs ON (CTRL+O to toggle)"))
else:
parts.append(("class:toolbar-dim", "tool outputs off (CTRL+O to toggle)"))

# Show exit confirmation hint if active
hint_until = session_state.exit_hint_until
if hint_until is not None:
Expand Down Expand Up @@ -227,6 +234,14 @@ def _(event):
session_state.toggle_auto_approve()
# Force UI refresh to update toolbar
event.app.invalidate()

# Bind Ctrl+O to toggle tool outputs
@kb.add("c-o")
def _(event):
"""Toggle tool output visibility."""
session_state.toggle_tool_outputs()
# Force UI refresh to update toolbar
event.app.invalidate()

# Bind regular Enter to submit (intuitive behavior)
@kb.add("enter")
Expand Down Expand Up @@ -293,6 +308,8 @@ def _(event):
"toolbar-green": "bg:#10b981 #000000", # Green for auto-accept ON
"toolbar-orange": "bg:#f59e0b #000000", # Orange for manual accept
"toolbar-exit": "bg:#2563eb #ffffff", # Blue for exit hint
"toolbar-blue": "bg:#06b6d4 #000000", # Cyan for tool outputs ON
"toolbar-dim": "bg:#6b7280 #000000", # Gray for tool outputs off
}
)

Expand Down
12 changes: 10 additions & 2 deletions libs/deepagents-cli/deepagents_cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ def parse_args():
action="store_true",
help="Auto-approve tool usage without prompting (disables human-in-the-loop)",
)
parser.add_argument(
"--show-thinking",
action="store_true",
help="Show agent's reasoning/thinking process",
)

return parser.parse_args()

Expand Down Expand Up @@ -123,7 +128,7 @@ async def simple_cli(agent, assistant_id: str | None, session_state, baseline_to
console.print()

console.print(
" Tips: Enter to submit, Alt+Enter for newline, Ctrl+E for editor, Ctrl+T to toggle auto-approve, Ctrl+C to interrupt",
" Tips: Enter to submit, Alt+Enter for newline, Ctrl+E for editor, Ctrl+T to toggle auto-approve, Ctrl+O to toggle tool outputs, Ctrl+C to interrupt",
style=f"dim {COLORS['dim']}",
)
console.print()
Expand Down Expand Up @@ -215,7 +220,10 @@ def cli_main():
reset_agent(args.agent, args.source_agent)
else:
# Create session state from args
session_state = SessionState(auto_approve=args.auto_approve)
session_state = SessionState(
auto_approve=args.auto_approve,
show_thinking=args.show_thinking
)

# API key validation happens in create_model()
asyncio.run(main(args.agent, session_state))
Expand Down
9 changes: 8 additions & 1 deletion libs/deepagents-cli/deepagents_cli/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,7 @@ def show_interactive_help():
" Ctrl+E Open in external editor (nano by default)", style=COLORS["dim"]
)
console.print(" Ctrl+T Toggle auto-approve mode", style=COLORS["dim"])
console.print(" Ctrl+O Toggle tool output visibility", style=COLORS["dim"])
console.print(" Arrow keys Navigate input", style=COLORS["dim"])
console.print(" Ctrl+C Cancel input or interrupt agent mid-work", style=COLORS["dim"])
console.print()
Expand Down Expand Up @@ -534,7 +535,8 @@ def show_help():
console.print()

console.print("[bold]Usage:[/bold]", style=COLORS["primary"])
console.print(" deepagents [--agent NAME] [--auto-approve] Start interactive session")
console.print(" deepagents [--agent NAME] [--auto-approve] [--show-thinking]")
console.print(" Start interactive session")
console.print(" deepagents list List all available agents")
console.print(" deepagents reset --agent AGENT Reset agent to default prompt")
console.print(
Expand All @@ -555,6 +557,10 @@ def show_help():
" deepagents --auto-approve # Start with auto-approve enabled",
style=COLORS["dim"],
)
console.print(
" deepagents --show-thinking # Show agent's reasoning process",
style=COLORS["dim"],
)
console.print(
" deepagents list # List all agents", style=COLORS["dim"]
)
Expand Down Expand Up @@ -589,6 +595,7 @@ def show_help():
)
console.print(" Ctrl+J Insert newline (alternative)", style=COLORS["dim"])
console.print(" Ctrl+T Toggle auto-approve mode", style=COLORS["dim"])
console.print(" Ctrl+O Toggle tool output visibility", style=COLORS["dim"])
console.print(" Arrow keys Navigate input", style=COLORS["dim"])
console.print(
" @filename Type @ to auto-complete files and inject content", style=COLORS["dim"]
Expand Down