fix: prevent re-entrant agent.step() in ScreenshotToolkit.read_image#3911
fix: prevent re-entrant agent.step() in ScreenshotToolkit.read_image#3911atian8179 wants to merge 2 commits intocamel-ai:masterfrom
Conversation
Langfuse v3 removed langfuse.decorators.langfuse_context, causing NameError when configuring tracing. Update to detect Langfuse version and use environment variables for v3+ (which @observe() reads automatically) while maintaining backward compatibility with v2. Fixes camel-ai#3876
ScreenshotToolkit.read_image() called self.agent.step() to analyze images, creating a re-entrant step() call when the tool is invoked by the same agent. This corrupts the tool-call message sequence, causing 400 errors from the API. Replace with a lightweight separate ChatAgent instance using the same model backend, avoiding re-entrancy while preserving the image analysis capability. Fixes camel-ai#3869
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). 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. Comment |
Problem
ScreenshotToolkit.read_image()callsself.agent.step()to analyze images. When this tool is invoked by the same agent, it creates a re-entrantstep()call during tool execution, corrupting the tool-call message sequence:Solution
Replace
self.agent.step()with a separate lightweightChatAgentinstance that uses the same model backend. This avoids re-entrancy while preserving image analysis capability.Fixes #3869