Skip to content

feat: populate ToolCallingRecord.images when tool returns ToolResult#3981

Open
KIA-Er wants to merge 2 commits intocamel-ai:masterfrom
KIA-Er:feat/3964-populate-tool-calling-record-images
Open

feat: populate ToolCallingRecord.images when tool returns ToolResult#3981
KIA-Er wants to merge 2 commits intocamel-ai:masterfrom
KIA-Er:feat/3964-populate-tool-calling-record-images

Conversation

@KIA-Er
Copy link
Copy Markdown

@KIA-Er KIA-Er commented Apr 2, 2026

Address #3964

When a tool returns ToolResult with images, populate the ToolCallingRecord.images field with the image list. This ensures consistency across sync, async, and streaming execution paths.

Changes:

  • Extract images from ToolResult in _record_tool_calling
  • Populate ToolCallingRecord.images in all execution paths
  • Maintain consistency with existing ToolResult handling

Note: Only ToolResult type is supported for images field population, keeping the API boundary clear as suggested by maintainers.

Question: I noticed that in sync path (_record_tool_calling), when a tool returns ToolResult with images, the images are injected into memory via visual_msg (lines 4214-4269). However, in streaming paths, the images are only populated in ToolCallingRecord.images but not injected into memory. Is this intentional, or should streaming paths also inject images into memory for consistency?

Related Issue

Closes #3964

Description

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Checklist

  • I have read and agree to the AI-Generated Code Policy (required)
  • I have linked this PR to an issue (required)
  • I have checked if any dependencies need to be added or updated in pyproject.toml and run uv lock
  • I have updated the tests accordingly (required for a bug fix or a new feature)
  • I have updated the documentation if needed
  • I have added examples if this is a new feature

If you are unsure about any of these, don't hesitate to ask. We are here to help!

Address camel-ai#3964

When a tool returns ToolResult with images, populate the
ToolCallingRecord.images field with the image list. This ensures
consistency across sync, async, and streaming execution paths.

Changes:
- Extract images from ToolResult in _record_tool_calling
- Populate ToolCallingRecord.images in all execution paths
- Maintain consistency with existing ToolResult handling

Note: Only ToolResult type is supported for images field population,
keeping the API boundary clear as suggested by maintainers.

Question: I noticed that in sync path (_record_tool_calling), when
a tool returns ToolResult with images, the images are injected into
memory via visual_msg (lines 4214-4269). However, in streaming paths,
the images are only populated in ToolCallingRecord.images but not
injected into memory. Is this intentional, or should streaming paths
also inject images into memory for consistency?
Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 2, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 5da9fd78-8a37-4e67-a3dd-59e81b615006

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@fengju0213 fengju0213 self-requested a review April 3, 2026 04:16
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.

[Question] Populate the images field in ToolCallingRecord for Multi-modal Agent Loops

2 participants