Skip to content

One progress reminder rule for every Python Bot - #2443

Merged
davidmckayv merged 1 commit into
mainfrom
refactor/one-progress-reminder
Nov 29, 2026
Merged

davidmckayv merged 1 commit into
mainfrom
refactor/one-progress-reminder

Conversation

@davidmckayv

Copy link
Copy Markdown
Contributor

What

The progress reminder (after five silent tool steps, the model is reminded to say a line) was written out four times in the Python engines: shared/progress_reminder.py (Pydantic AI, Microsoft Agent Framework, Strands), shared/silent_steps.py (AG2, Langroid), shared/litellm_progress_reminder.py (CrewAI, Agno, Google ADK) and agent-langgraph-agui/src/progress_reminder.py. Each had the same words, the threshold of five, and the same counting and reset rules.

Now the words, the threshold, the count and the decision of where a reminder goes live once, in shared/progress_reminder.py. Each engine keeps only its bridge to its framework: how its messages read as steps, and how the reminder goes into what its model is sent (middleware, capability, hook). The LiteLLM reader the CrewAI, Agno and Google ADK engines share lives in the same module (with_litellm_reminders).

  • shared/litellm_progress_reminder.py is deleted; shared/silent_steps.py keeps only a re-export of the words, because the AG2 and Langroid tests import them by that name. No image copies it.
  • The LangGraph engine's src/progress_reminder.py keeps what is LangGraph's own (the form per LangChain chat model, the refused-system fallback, keeping the reminder out of the RAW events) and takes the rule and words from shared/.
  • Dockerfiles: adk, ag2, agno, crewai and langroid copy shared/progress_reminder.py in place of the deleted files; langgraph-agui now copies it too.

TypeScript engines are not touched.

No behaviour change

The four copies were not quite the same, and each engine keeps exactly what it had, as options on the one rule:

Engines Step's words and calls in two messages Reminder after a call never answered System row after the results
Pydantic AI, Microsoft, Strands one step allowed reminder goes before it
AG2, Langroid one step not allowed reminder goes before it
CrewAI, Agno, Google ADK two steps allowed reminder goes before it
LangGraph (Python) two steps not allowed reminder dropped

Harmonising these would change what some Bots send, so it is left for a separate decision.

Checked old against new, outside the repo: the three old shared modules and the old LangGraph module, from main, run side by side with the new code.

  • Words and threshold: identical strings and value in every copy.
  • Places: 300,000 random threads for each of the two kinds-based rules, 100,000 random LiteLLM message lists (whole output compared, across 14 model ids), 40,000 random LangChain threads (with and without shown progress updates, chunks and dict messages included): identical in every case.
  • Form: is_openai_model with and without a provider prefix on 30 ids, the LiteLLM form on 14 ids, the LangGraph form on 10 chat models: identical.

Tests

No test file is changed. Each engine's suite, run as CI runs it (python -m pytest "$HARNESS/tests" -q), on main and on this branch:

Engine Reminder tests, main Reminder tests, branch Whole suite, main Whole suite, branch
agent-adk 5 passed 5 passed 41 passed 41 passed
agent-ag2 4 passed 4 passed 30 passed 30 passed
agent-agno 5 passed 5 passed 39 passed 39 passed
agent-crewai 5 passed 5 passed 32 passed 32 passed
agent-langgraph-agui (with test_tool_protocol.py) 45 passed 45 passed 233 passed, 2 failed 233 passed, 2 failed
agent-langroid 5 passed 5 passed 33 passed 33 passed
agent-microsoft 5 passed 5 passed 18 passed 18 passed
agent-pydantic-ai 5 passed 5 passed 21 passed 21 passed
agent-strands 5 passed 5 passed 28 passed 28 passed
agent-claude-sdk n/a n/a 170 passed 170 passed

The two LangGraph failures are the two ChatGPT token-file tests that need a Docker daemon, which was not running on the machine; they fail the same way on main and run in CI.

Images: each of the nine engines was laid out as its Dockerfile lays it out (/app/src and only the shared files its COPY names) and src.main imported there, then a reminder place worked out through the copied module. CI's Dockerfile builds run on this PR as well.

The reminder to say a line after five silent tool steps lived four times
over: shared/progress_reminder.py, shared/silent_steps.py,
shared/litellm_progress_reminder.py and the LangGraph engine's own copy.
Each had the same words, the same threshold of five and the same
counting and reset rules, written out again.

They now live once, in shared/progress_reminder.py, which the image of
every Python engine that reminds copies. The engines keep only what bridges to their
framework: how its messages read as steps and where the reminder goes in.
The CrewAI, Agno and Google ADK engines share the LiteLLM reader there.

No behaviour changes. The copies differed in small ways, and each engine
keeps its own: whether a step's words and calls in two messages count as
one step, whether a reminder may follow a call that was never answered,
and whether a system row after the results drops it. These are options
on the one rule. An old-against-new run over several hundred thousand
random threads gives the same places, words and forms for every engine.

shared/silent_steps.py stays as a name the AG2 and Langroid tests import
the words by; no image carries it.
@davidmckayv davidmckayv added the full-ci Run the slow image builds on this PR label Nov 29, 2026
@davidmckayv davidmckayv reopened this Nov 29, 2026
@davidmckayv
davidmckayv merged commit de22d44 into main Nov 29, 2026
59 of 77 checks passed
@davidmckayv
davidmckayv deleted the refactor/one-progress-reminder branch November 29, 2026 02:25
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

full-ci Run the slow image builds on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant