hermes-agent/agent/transports
bobashopcashier b49a1b71a7 fix(agent): accept empty content with stop_reason=end_turn as valid anthropic response
Anthropic's API can legitimately return content=[] with stop_reason="end_turn"
when the model has nothing more to add after a turn that already delivered the
user-facing text alongside a trivial tool call (e.g. memory write). The transport
validator was treating that as an invalid response, triggering 3 retries that
each returned the same valid-but-empty response, then failing the run with
"Invalid API response after 3 retries."

The downstream normalizer already handles empty content correctly (empty loop
over response.content, content=None, finish_reason="stop"), so the only fix
needed is at the validator boundary.

Tests:
- Empty content + stop_reason="end_turn" → valid (the fix)
- Empty content + stop_reason="tool_use" → still invalid (regression guard)
- Empty content without stop_reason → still invalid (existing behavior preserved)
2026-04-22 14:26:23 -07:00
..
__init__.py feat: add BedrockTransport + wire all Bedrock transport paths 2026-04-21 20:58:37 -07:00
anthropic.py fix(agent): accept empty content with stop_reason=end_turn as valid anthropic response 2026-04-22 14:26:23 -07:00
base.py feat: add transport ABC + AnthropicTransport wired to all paths 2026-04-21 01:27:01 -07:00
bedrock.py feat: add BedrockTransport + wire all Bedrock transport paths 2026-04-21 20:58:37 -07:00
chat_completions.py feat: add ChatCompletionsTransport + wire all default paths 2026-04-21 20:50:02 -07:00
codex.py feat: add ResponsesApiTransport + wire all Codex transport paths 2026-04-21 19:48:56 -07:00
types.py feat: add transport types + migrate Anthropic normalize path 2026-04-20 23:06:00 -07:00