Skip to content

[tool] fix: handle empty image inputs in ToolAgentLoop#5420

Merged
wuxibin89 merged 1 commit intoverl-project:mainfrom
denismegerle:public/tool-agent-downstream-image-processing-compat
Feb 27, 2026
Merged

[tool] fix: handle empty image inputs in ToolAgentLoop#5420
wuxibin89 merged 1 commit intoverl-project:mainfrom
denismegerle:public/tool-agent-downstream-image-processing-compat

Conversation

@denismegerle
Copy link
Contributor

@denismegerle denismegerle commented Feb 26, 2026

What does this PR do?

Fixes a compatibility issue in ToolAgentLoop, downstream image-processing pipelines require passing passing images=None (instead of an empty list) when a tool call returns no new images.

Checklist Before Starting

  • Search for similar PRs. Paste at least one query link here: https://github.com/verl-project/verl/pulls?q=is%3Apr+ToolAgentLoop+images+None
  • Format the PR title as [{modules}] {type}: {description} (This will be checked by the CI)
    • {modules} include fsdp, megatron, veomni, sglang, vllm, rollout, trainer, ci, training_utils, recipe, hardware, deployment, ray, worker, single_controller, misc, perf, model, algo, env, tool, ckpt, doc, data, cfg, reward
    • If this PR involves multiple modules, separate them with , like [megatron, fsdp, doc]
    • {type} is in feat, fix, refactor, chore, test
    • If this PR breaks any API (CLI arguments, config, function signature, etc.), add [BREAKING] to the beginning of the title.
    • Example: [BREAKING][fsdp, megatron] feat: dynamic batching

Test

Not covered by an existing upstream test in this PR. Change is a narrow input-normalization to apply_chat_template(images=...) when no images are produced.

API and Usage Example

No API change.

# No API changes. Behavior change: images passed to chat template is None when empty.

Design & Code Changes

  • In verl/experimental/agent_loop/tool_agent_loop.py, normalize images to None when new_images_this_turn is empty.

Checklist Before Submitting

Important

Please check all the following items before requesting a review, otherwise the reviewer might deprioritize this PR for review.

  • Read the Contribute Guide.
  • Apply pre-commit checks: pre-commit install && pre-commit run --all-files --show-diff-on-failure --color=always
  • (not required) Add / Update the documentation.
  • (not required) Add unit or end-to-end test(s) to the CI workflow to cover all the code. If not feasible, explain why: not feasible quickly here because current agent-loop tests stub the tokenizer and don't assert image/video kwargs flow; can be added if maintainers want it.
  • Once your PR is ready for CI, send a message in the ci-request channel in the verl Slack workspace. (If not accessible, please try the Feishu group (飞书群).)
  • (not related) If your PR is related to the recipe submodule, please also update the reference to the submodule commit via git submodule update --remote or cd recipe && git pull origin main.

…ntLoop

- Updated ToolAgentLoop to handle cases where no new images or videos are available by passing None, maintaining compatibility with downstream processing logic.
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request addresses a compatibility issue in ToolAgentLoop by ensuring that None is passed for the images argument to apply_chat_template when no new images are returned from a tool call, instead of an empty list. The change is correct and directly implements the described fix. This prevents potential issues in downstream image processing pipelines that may handle None and empty lists differently. The implementation is clear and confined to the intended scope.

@denismegerle denismegerle marked this pull request as ready for review February 26, 2026 20:35
@wuxibin89 wuxibin89 merged commit 9dd447e into verl-project:main Feb 27, 2026
61 of 74 checks passed
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