mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
feat(api): structured run events via /v1/runs SSE endpoint
Add POST /v1/runs to start async agent runs and GET /v1/runs/{run_id}/events
for SSE streaming of typed lifecycle events (tool.started, tool.completed,
message.delta, reasoning.available, run.completed, run.failed).
Changes the internal tool_progress_callback signature from positional
(tool_name, preview, args) to event-type-first
(event_type, tool_name, preview, args, **kwargs). Existing consumers
filter on event_type and remain backward-compatible.
Adds concurrency limit (_MAX_CONCURRENT_RUNS=10) and orphaned run sweep.
Fixes logic inversion in cli.py _on_tool_progress where the original PR
would have displayed internal tools instead of non-internal ones.
Co-authored-by: Mibayy <mibayy@users.noreply.github.com>
This commit is contained in:
parent
e167ad8f61
commit
cc2b56b26a
11 changed files with 337 additions and 44 deletions
11
cli.py
11
cli.py
|
|
@ -5457,14 +5457,17 @@ class HermesCLI:
|
|||
# Tool progress callback (audio cues for voice mode)
|
||||
# ====================================================================
|
||||
|
||||
def _on_tool_progress(self, function_name: str, preview: str, function_args: dict):
|
||||
"""Called when a tool starts executing.
|
||||
def _on_tool_progress(self, event_type: str, function_name: str = None, preview: str = None, function_args: dict = None, **kwargs):
|
||||
"""Called on tool lifecycle events (tool.started, tool.completed, reasoning.available, etc.).
|
||||
|
||||
Updates the TUI spinner widget so the user can see what the agent
|
||||
is doing during tool execution (fills the gap between thinking
|
||||
spinner and next response). Also plays audio cue in voice mode.
|
||||
"""
|
||||
if not function_name.startswith("_"):
|
||||
# Only act on tool.started; ignore tool.completed, reasoning.available, etc.
|
||||
if event_type != "tool.started":
|
||||
return
|
||||
if function_name and not function_name.startswith("_"):
|
||||
from agent.display import get_tool_emoji
|
||||
emoji = get_tool_emoji(function_name)
|
||||
label = preview or function_name
|
||||
|
|
@ -5477,7 +5480,7 @@ class HermesCLI:
|
|||
|
||||
if not self._voice_mode:
|
||||
return
|
||||
if function_name.startswith("_"):
|
||||
if not function_name or function_name.startswith("_"):
|
||||
return
|
||||
try:
|
||||
from tools.voice_mode import play_beep
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue