Skip to content

Agno Bot: no "[System: Empty message content sanitised]" lines, and each line once - #2442

Merged
davidmckayv merged 2 commits into
mainfrom
fix/agno-empty-content-sanitised
Nov 29, 2026
Merged

davidmckayv merged 2 commits into
mainfrom
fix/agno-empty-content-sanitised

Conversation

@davidmckayv

@davidmckayv davidmckayv commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

What

On a long job on Claude, the Agno Bot no longer shows the person "[System: Empty message content sanitised to satisfy protocol]", and each line it says streams once.

  • A step with no words is sent as none. Agno's LiteLLM client writes a message with no words as "", and LiteLLM sends Claude an assistant turn of "" as that placeholder, as though the model had said it ([Bug]: When using claude models, litellm returns [System: Empty message content sanitised to satisfy protocol] BerriAI/litellm#24498). Claude then copied it from its own history and said it to the person, and each copy, being a line, started the progress reminder's count again. What each call sends (agent-agno/src/sent.py) now writes a step that only called a tool as just that call (None), leaves out a message with neither words nor calls (Agno's stream left one before each call, and LiteLLM fills it the same way), and sends the placeholder in threads from before as nothing. The progress reminder reads the messages as sent, so the placeholder never counts as a line. Same approach as the LlamaIndex Bot (LlamaIndex Bot: send earlier steps as real tool calls, so a long job finishes #2441), and no litellm change. Agno's run messages, events and the thread are untouched.
  • Each line once. When a run pauses on a tool call, Agno's AG-UI stream (on_run_completed) sends the run's words again, in a new message holding the paused calls, after they already streamed. The paused calls now go on the message the step already streamed, as Agno does for a call it runs itself, with no second copy of the words (agent-agno/src/said_once.py). Agno 3.2.1 is the latest release, and its main branch has the same code.

Tests

Engine-level, real Agno and LiteLLM, only the provider's HTTP scripted, driven run by run as the server drives a job:

  • test_a_silent_step_reaches_claude_as_its_tool_call_and_nothing_said: no request to Claude carries the placeholder, each silent step goes out as just its tool_use, and the stretch still counts as silent for the reminder.
  • test_a_line_said_alongside_a_tool_call_streams_once: a line said with a call streams once, and each step is one message, its words with its call.
  • test_a_thread_holding_the_placeholder_is_replayed_without_it: a thread from before, holding the placeholder and the empty messages, reaches Claude without them, and six such steps are reminded once.

Red on main (3 failed, 39 passed), green with the change (42 passed).

Live: the 30-step ledger job, Claude Sonnet 5.5, twice each

Each step a run of its own, its call handed back and answered, the whole thread sent back, as OpenBot's server drives a Bot. L = a real line, . = a silent step, J = a step whose only words were the placeholder.

real lines placeholder lines shown lines shown twice pattern
main, run 1 4 12 10 L.....L.....L...JJ.....L.JJ.JJ
main, run 2 4 10 9 L.....L.....L....J.....L..JJJJ
this change, run 1 5 0 0 L.....L.....L.....L.....L.....
this change, run 2 5 0 0 L.....L.....L.....L.....L.....

With the change Agno reaches five lines, as the other engines do, because the placeholder no longer resets the count.

In the web app

A full OpenBot stack on a throwaway box, with one Bot on main's Agno engine and one on this branch's, each given a 25-page job, in Chrome and in WebKit. On main every progress line showed twice in both browsers. With the change each line showed once, before and after a reload, and no placeholder anywhere.

…d each line once

On a long job on Claude, the Agno Bot showed the person "[System: Empty message content
sanitised to satisfy protocol]" several times a run, and every progress line twice.

The placeholder: Agno sends a step that only calls a tool with empty text, and LiteLLM before
1.109 wrote that line into every such step it sent Claude, as though the model had said it. Claude
then copied it from its own history and said it to the person, and each copy, being a line,
started the progress reminder's count again. LiteLLM 1.109 sends such a step as just its call
(BerriAI/litellm#34822), so the Bot now takes 1.109. The messages with no words Agno's stream
leaves before each call are no longer replayed (LiteLLM still fills an assistant turn that is
wholly empty), and the placeholder in threads from before is replayed as nothing.

The doubled lines: when a run pauses on a tool call, Agno's AG-UI stream sends the run's words
again in a new message holding the paused calls, after they already streamed. The paused calls now
go on the message the step already streamed, with no second copy of its words.
Same cause as the LlamaIndex Bot's, so the same fix and no litellm change: what each call sends
writes a step that only called a tool with no words (None) instead of "", which LiteLLM sends
Claude as the placeholder. A message with neither words nor calls is not sent, and the placeholder
in threads from before is sent as nothing. The progress reminder reads the messages as sent, so the
placeholder never counts as a line. All of it is in src/sent.py, in what the model is sent only.
@davidmckayv
davidmckayv force-pushed the fix/agno-empty-content-sanitised branch from 47a06a7 to fabe2d3 Compare November 29, 2026 02:37
@davidmckayv
davidmckayv merged commit 54cbd6f into main Nov 29, 2026
35 checks passed
@davidmckayv
davidmckayv deleted the fix/agno-empty-content-sanitised branch November 29, 2026 02:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant