Skip to content

Conversation

@fengju0213
Copy link
Collaborator

@fengju0213 fengju0213 commented Jan 16, 2026

Description

Problem
When using ChatAgent with stream=True and external tools (tools defined in external_tools but not executable by the agent), the Assistant's tool call request message was not being recorded in the chat_history.

  • In non-streaming mode, the agent records the tool call request before exiting the step.
  • In streaming mode, the agent skipped both the execution and the recording of the message for external tools, resulting in missing conversation history.

Solution
Modified _execute_tool_from_stream_data in camel/agents/chat_agent.py to:

  1. Check if a tool call corresponds to an external tool.
  2. If yes, explicitly record the Assistant's message (containing the tool call arguments) to chat_history.
  3. Maintain the existing behavior of NOT executing the external tool and returning None.

Effect
This ensures consistency between streaming and non-streaming modes, guaranteeing that the chat history correctly reflects the model's intent to call an external tool regardless of the streaming configuration.

Checklist

Go over all the following points, and put an x in all the boxes that apply.

  • I have read the CONTRIBUTION guide (required)
  • I have linked this PR to an issue using the Development section on the right sidebar or by adding Fixes #issue-number in the PR description (required)
  • I have checked if any dependencies need to be added or updated in pyproject.toml and 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!

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 16, 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.

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


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.

@github-actions github-actions bot added the Review Required PR need to be reviewed label Jan 16, 2026
@Wendong-Fan
Copy link
Member

hey @fengju0213 , seems this pr contains change from other commits, please clean the pr

@waleedalzarooni
Copy link
Collaborator

Hey @fengju0213, in case this got lost in your inbox would you mind removing the unnecessary file changes so we can review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Review Required PR need to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants