hermes-agent/gateway/platforms
Teknium b2a6b012fe
fix(api_server): streaming breaks when agent makes tool calls (#2985)
* fix(run_agent): ensure _fire_first_delta() is called for tool generation events

Added calls to _fire_first_delta() in the AIAgent class to improve the handling of tool generation events, ensuring timely notifications during the processing of function calls and tool usage.

* fix(run_agent): improve timeout handling for chat completions

Enhanced the timeout configuration for chat completions in the AIAgent class by introducing customizable connection, read, and write timeouts using environment variables. This ensures more robust handling of API requests during streaming operations.

* fix(run_agent): reduce default stream read timeout for chat completions

Updated the default stream read timeout from 120 seconds to 60 seconds in the AIAgent class, enhancing the timeout configuration for chat completions. This change aims to improve responsiveness during streaming operations.

* fix(run_agent): enhance streaming error handling and retry logic

Improved the error handling and retry mechanism for streaming requests in the AIAgent class. Introduced a configurable maximum number of stream retries and refined the handling of transient network errors, allowing for retries with fresh connections. Non-transient errors now trigger a fallback to non-streaming only when appropriate, ensuring better resilience during API interactions.

* fix(api_server): streaming breaks when agent makes tool calls

The agent fires stream_delta_callback(None) to signal the CLI display
to close its response box before tool execution begins. The API server's
_on_delta callback was forwarding this None directly into the SSE queue,
where the SSE writer treats it as end-of-stream and terminates the HTTP
response prematurely.

After tool calls complete, the agent streams the final answer through
the same callback, but the SSE response was already closed — so Open
WebUI (and similar frontends) never received the actual answer.

Fix: filter out None in _on_delta so the SSE stream stays open. The SSE
loop already detects completion via agent_task.done(), which handles
stream termination correctly without needing the None sentinel.

Reported by Rohit Paul on X.
2026-03-25 09:56:20 -07:00
..
__init__.py Enhance CLI with multi-platform messaging integration and configuration management 2026-02-02 19:01:51 -08:00
ADDING_A_PLATFORM.md docs: finish cron terminology cleanup 2026-03-14 19:20:58 -07:00
api_server.py fix(api_server): streaming breaks when agent makes tool calls (#2985) 2026-03-25 09:56:20 -07:00
base.py fix: media delivery fails for file paths containing spaces (#2621) 2026-03-23 06:59:59 -07:00
dingtalk.py fix(dingtalk): requirements check passes with only one credential set 2026-03-17 03:50:45 -07:00
discord.py fix(discord): ignore system messages in on_message handler (#2618) 2026-03-23 06:50:09 -07:00
email.py fix(email): guard against IndexError when IMAP search returns empty list 2026-03-22 04:38:17 -07:00
homeassistant.py fix: Home Assistant event filtering now closed by default (#1169) 2026-03-13 07:40:38 -07:00
matrix.py fix(matrix): duplicate messages, image caching for vision support (#2520) 2026-03-22 09:27:25 -07:00
mattermost.py Merge pull request #2443 from NousResearch/hermes/hermes-31d7db3b 2026-03-22 03:50:35 -07:00
signal.py fix(signal): use id instead of attachmentId in getAttachment RPC 2026-03-21 17:56:12 -07:00
slack.py refactor: centralize slash command registry (#1603) 2026-03-16 23:21:03 -07:00
sms.py fix(gateway): SMS persistent HTTP session + Matrix MIME media types 2026-03-17 04:35:14 -07:00
telegram.py feat(gateway): configurable Telegram reply threading mode (#2907) 2026-03-24 19:56:00 -07:00
webhook.py feat(gateway): add webhook platform adapter for external event triggers 2026-03-20 06:33:36 -07:00
whatsapp.py fix(whatsapp): download documents, audio, and video media from messages (#2978) 2026-03-25 08:37:28 -07:00