Skip to content

fix: multiple control flow tools same llm call#673

Merged
cotovanu-cristian merged 1 commit intomainfrom
fix/multiple-control-flow-tools
Mar 9, 2026
Merged

fix: multiple control flow tools same llm call#673
cotovanu-cristian merged 1 commit intomainfrom
fix/multiple-control-flow-tools

Conversation

@cotovanu-cristian
Copy link
Copy Markdown
Collaborator

@cotovanu-cristian cotovanu-cristian commented Mar 6, 2026

Summary

Fixes handling of multiple control flow tool calls (end_execution, raise_error) returned in a single LLM response.

The previous filter in _filter_control_flow_tool_calls was designed to strip control flow tools from mixed responses (e.g. [regular_tool, end_execution]). When the LLM returned only control flow tools (e.g. [end_execution, raise_error]), all of them got filtered out, leaving an empty
tool call list and causing a routing error — "No control flow tool call found" — in the terminate node.

Changes

_filter_control_flow_tool_calls (llm_node.py)

When the LLM response contains only control flow tools:

  • If raise_error is present, keep only the first raise_error — it takes precedence over end_execution, and duplicates are collapsed
  • If only end_execution calls are present, keep them as-is (single call, no filtering needed)

@cotovanu-cristian cotovanu-cristian force-pushed the fix/multiple-control-flow-tools branch from 365a4f5 to 9d8a4e4 Compare March 9, 2026 09:41
@cotovanu-cristian cotovanu-cristian marked this pull request as ready for review March 9, 2026 10:56
@cotovanu-cristian cotovanu-cristian force-pushed the fix/multiple-control-flow-tools branch from 9d8a4e4 to d4116d6 Compare March 9, 2026 11:00
@cotovanu-cristian cotovanu-cristian force-pushed the fix/multiple-control-flow-tools branch from d4116d6 to e4fb2c3 Compare March 9, 2026 11:05
@cotovanu-cristian cotovanu-cristian enabled auto-merge (squash) March 9, 2026 11:07
@cotovanu-cristian cotovanu-cristian merged commit ee34d32 into main Mar 9, 2026
39 checks passed
@cotovanu-cristian cotovanu-cristian deleted the fix/multiple-control-flow-tools branch March 9, 2026 11:29
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.

2 participants