agent-zero/python
Frank Hurt a129a576d7 fix: Skip empty AI messages in output_langchain to prevent API rejection
Empty or whitespace-only AI messages cause API validation errors with strict
providers (OpenAI, Z.ai, GLM):
  "Assistant messages must have either content or tool_calls"

This is a companion fix to PR #927 (response.py KeyError fix). When that fix
returns an empty string instead of crashing, the empty string can become an
empty AIMessage that fails API validation.

Changes:
- Pre-compute content before creating message objects
- Skip AI messages where content is None, empty, or whitespace-only
- Human messages are not filtered (they can be empty per spec)

Tested on 4 production A0 instances.
2026-02-01 03:26:24 +00:00
..
api clean error msgs in file browser 2026-01-31 16:14:23 +01:00
extensions ui: welcome screen, queue input, interverntions 2026-01-31 19:37:39 +01:00
helpers fix: Skip empty AI messages in output_langchain to prevent API rejection 2026-02-01 03:26:24 +00:00
tools Merge branch 'pr/842' into development 2026-01-30 16:31:20 +01:00
__init__.py Docker + SSH, AgentConfig class 2024-07-05 22:58:16 +02:00