Skip to content

LiteLLM Bots: one rule for steps with no words, and no placeholder lines on Langroid - #2449

Merged
davidmckayv merged 1 commit into
mainfrom
fix/litellm-empty-turns-shared
Nov 29, 2026
Merged

davidmckayv merged 1 commit into
mainfrom
fix/litellm-empty-turns-shared

Conversation

@davidmckayv

@davidmckayv davidmckayv commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

What

No LiteLLM Bot sends Claude a step with no words as words any more, and the rule that makes sure of it lives in one place.

LiteLLM sends Claude every empty user or assistant turn as "[System: Empty message content sanitised to satisfy protocol]" (BerriAI/litellm#24498). When a Bot writes a step that only called a tool with "" for its words, Claude reads that line as its own, says it to the person, and each copy restarts the progress reminder's count. Agno (#2442) and LlamaIndex (#2441) were fixed today, each with its own copy of the rule.

  • Which Bots had it. Checked live on every Bot that reaches its model through LiteLLM: Google ADK, CrewAI, Strands and Langroid (Agno and LlamaIndex already fixed; Antigravity talks to Gemini directly). Only Langroid showed the placeholder, and only when the thread it is handed gives a step that only called a tool "" for its words: Langroid passes "" on as an empty turn (and leaves the turn's words out when they are absent). OpenBot's own server sends such a step with no content at all, live and after a reload (recorded on the box below), so in the web app main's Langroid Bot did not show it; a caller that sends "", as the engine-level drive below does, gets 4 or 5 placeholder lines a job. ADK, CrewAI and Strands showed none either way. No Bot showed a line twice.
  • One rule, shared/empty_turns.py. A step that only called a tool is sent as just that call (None), a message of the model's with neither words nor calls is left out, and the placeholder in a thread from before is taken out. Same behaviour as Agno's sent.py, now shared.
  • Every LiteLLM Bot uses it. Agno, ADK and CrewAI apply it to the chat messages before the progress reminder is placed, Strands on the request its LiteLLM model formats, Langroid on the request it prepares for every route (this is the fix), and LlamaIndex reads each step's words through it. Each Dockerfile copies the new file. Only what each model call sends changes: threads, events and what the person sees are as before.

Tests

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

  • Langroid test_a_silent_step_reaches_claude_as_its_tool_call_and_nothing_said: a 7-step job reaches Claude with each silent step as just its tool_use, no placeholder in any request, and the stretch is still reminded once.
  • ADK, CrewAI and Strands test_a_step_with_no_words_reaches_claude_as_its_tool_call_and_nothing_said: the same job after an earlier step saved with the placeholder; that step and each silent step reach Claude as just their calls.

Red on main (all four fail on the placeholder in a request), green with this change. Full suites: ADK 42, CrewAI 33, Strands 29, Langroid 34, Agno 42, LlamaIndex 20, all passing; Agno's and LlamaIndex's tests are unchanged.

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

Each step a run of its own, its call handed back and answered, the whole thread sent back, with a step that only called a tool sent back with "" for its words. L = a real line, . = a silent step, J = a step whose only words were the placeholder.

Bot real lines placeholder lines lines shown twice pattern
Langroid main, run 1 5 4 0 L.....L.....L...JJ.J...JLL....
Langroid main, run 2 3 5 0 L.....L....J.....L....JJJ...J.
Langroid this change, run 1 5 0 0 L.....L.....L.....L.....L.....
Langroid this change, run 2 5 0 0 L.....L.....L.....L.....L.....
ADK main, 2 runs 5, 5 0, 0 0, 0 L..... every sixth step
ADK this change 5 0 0 L.....L.....L.....L.....L.....
CrewAI main, run 2 5 0 0 L.....L.....L.....L.....L.....
CrewAI this change 5 0 0 L.....L.....L.....L.....L.....
Strands main, 2 runs 5, 5 0, 0 0, 0 L..... every sixth step, or seventh
Strands this change 5 0 0 L.....L.....L.....L.....L.....
Agno this change 5 0 0 L.....L.....L.....L.....L.....
LlamaIndex this change 5 0 0 L.....L.....L.....L.....L.....

In the web app

A full OpenBot stack on a throwaway box (back end and app at main, local Intelligence), with one Bot on main's Langroid engine and one on this branch's, each given a 25-page job.

  • WebKit: both jobs run side by side. Each line showed once, during the run and after a reload, with no placeholder, on both Bots; the fixed Bot said a short line every few pages ("Five pages done. Next batch.", "Ten pages done. Montenegro is next.") and ended with the full table.
  • Chrome: the fixed Bot's job, then a reload and a follow-up question in the restored thread: 20 lines, none twice, no placeholder, and the follow-up answered from the thread.
  • What the server sends: both engines were put behind a recorder of the AG-UI bodies they receive. Every step that only called a tool arrived with no content, in a live job and in the thread restored after the reload, which is why main's Langroid Bot shows no placeholder in the app.

…nes on Langroid

LiteLLM sends Claude every empty user or assistant turn as "[System: Empty message content
sanitised to satisfy protocol]" (BerriAI/litellm#24498). When a Bot writes a step that only called
a tool with "" for its words, Claude reads that line as its own, says it to the person, and each
copy restarts the progress reminder's count.

Checked live on every Bot that reaches its model through LiteLLM, on the 30-step ledger job with
Claude Sonnet 5.5. Langroid had it: 4 and 5 placeholder lines shown in two runs. Google ADK, CrewAI
and Strands showed none, and no Bot showed a line twice.

The rule Agno and LlamaIndex each carried now lives once, in shared/empty_turns.py: a step that
only called a tool is sent as just that call, a message of the model's with neither words nor calls
is left out, and the placeholder in a thread from before is taken out. Every LiteLLM Bot sends its
model calls through it: Agno, ADK and CrewAI before the progress reminder is placed, Strands on
the request it formats, Langroid on the request it prepares (which fixes it), and LlamaIndex reads
each step's words through it. Only what each call sends changes; threads, events and what the
person sees are left as they were.
@davidmckayv
davidmckayv merged commit f8fda5b into main Nov 29, 2026
42 checks passed
@davidmckayv
davidmckayv deleted the fix/litellm-empty-turns-shared branch November 29, 2026 03:53
lorenzejay added a commit to lorenzejay/OpenBot that referenced this pull request Dec 1, 2026
The CrewAI Bot's main.py takes this branch's side; the next commit carries main's Gemini thought
signatures (CopilotKit#2397), progress reminders (CopilotKit#2436, CopilotKit#2443) and empty-turn rule (CopilotKit#2449) into it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lorenzejay added a commit to lorenzejay/OpenBot that referenced this pull request Dec 1, 2026
…ain's Gemini and reminder rules

The conversational Agent now does what the Bot on main did:

- A tool whose name CrewAI changes for the model (`showNote`, `askApproval`, `mcp__...`) is handed
  back under the server's name. The model calls it by `sanitize_tool_name`, and the hand-back
  looked it up by the server's name, so the turn answered "Handed to the caller to run."
- A handed-back call leaves out the `null`s its own schema did not ask for. CrewAI offers tools in
  strict mode, so every optional field came back as `null`.
- A `developer` message is kept as an instruction and left out of CrewAI's session, whose messages
  have no such role. It refused the whole run.
- An empty `OPENAI_BASE_URL` or `ANTHROPIC_BASE_URL` is unset. The providers' own SDKs took `""` as
  the address, and every OpenAI run failed with `APIConnectionError`.
- The model runs on CrewAI's own client for OpenAI, Anthropic and Google, whatever it is called.
  CrewAI sent a model it has not heard of (Gemini on the model gateway, `qwen/qwen3-8b`) to
  LiteLLM, which offered it no tools.
- The words the model said in a step that called tools are the reply's content. CrewAI keeps that
  step with none, so a line on a long job never reached the person.

From main: Gemini's thought signature goes out on the handed-back call's `encryptedValue` and back
to Gemini, with Google's placeholder only for a call the thread has none for (CopilotKit#2397); the progress
reminder after five silent steps (CopilotKit#2436, CopilotKit#2443), added to the latest result where CrewAI would take
a note in the person's turn for the request; the empty-turn rule (CopilotKit#2449); `google` as `gemini/`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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