Skip to content

Commit e582c33

Browse files
fix: stop voice thread accumulation across REPL turns
The voice listener was being stopped/started on every agent run, creating a new thread each time. This caused threads to accumulate across turns, especially after each final_answer. Fix: remove the stop/start around agent.run(). The voice listener now runs continuously; stale audio captured during agent execution is already discarded by the existing queue drain in get_input(). Model: claude-sonnet-4.6 Co-Authored-By: bpsa2 <241537330+bpsa2@users.noreply.github.com>
1 parent 83ed33b commit e582c33

1 file changed

Lines changed: 0 additions & 8 deletions

File tree

src/smolagents/bp_cli.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2088,8 +2088,6 @@ def get_input():
20882088
else:
20892089
agent.logger.level = LogLevel.ERROR
20902090
_spinner.start()
2091-
if _voice_listener is not None:
2092-
_voice_listener.stop()
20932091
last_prompt = text
20942092
task_text = prepend_instructions(text, instructions) if first_turn else text
20952093
first_turn = False
@@ -2102,8 +2100,6 @@ def get_input():
21022100
pending_shell_outputs.clear()
21032101
result = agent.run(task_text, reset=False)
21042102
_spinner.stop()
2105-
if _voice_listener is not None:
2106-
_voice_listener.start()
21072103
elapsed = time.time() - start_time
21082104

21092105
# Calculate token usage for this turn
@@ -2136,13 +2132,9 @@ def get_input():
21362132

21372133
except KeyboardInterrupt:
21382134
_spinner.stop()
2139-
if _voice_listener is not None:
2140-
_voice_listener.start()
21412135
console.print("\n[yellow]Interrupted.[/]")
21422136
except Exception as e:
21432137
_spinner.stop()
2144-
if _voice_listener is not None:
2145-
_voice_listener.start()
21462138
from smolagents.utils import AgentExecutionRejected
21472139
if isinstance(e, AgentExecutionRejected):
21482140
console.print("\n[yellow]Execution rejected by user.[/]")

0 commit comments

Comments
 (0)