feat(tools): add analyze_image vision tool for charts and screenshots#464
Merged
Conversation
Images received through IM channels (or uploaded) could previously only
be processed by read_document's OCR path, which returns nothing useful
for candlestick charts, account screenshots and photos - even though
multimodal providers (e.g. the OpenAI Codex adapter's input_image
conversion) can already accept images.
Add an analyze_image tool that base64-encodes a local image and asks the
configured chat model about it directly:
- path validation reuses resolve_safe_path + allowed_file_roots (same
policy as read_file)
- jpg/png/gif/bmp/webp, 10 MB cap, 120 s vision timeout
- standard {"ok": ..., "data"/"error": ...} envelope
Tests mock ChatLLM and cover path safety, unsupported/missing files,
the data-URL message shape, and empty-answer handling.
Signed-off-by: fei-moss <fei@moss.site>
warren618
added a commit
that referenced
this pull request
Jul 10, 2026
- manifest guard test: ignore __pycache__ when counting zoo modules - analyze_image: state the vision-capable-model requirement in the tool description; point the example path at the new uploads media root - turnover_aware: drop the mathematically inert risk_free knob (additive constant on the simplex), fix the max-Sharpe docstring mislabel, document realized_turnover as class-API-only - skills: surface turnover_aware in asset-allocation + strategy-generate so the agent can actually propose it
OXOOOOX
pushed a commit
to OXOOOOX/Vibe-Trading
that referenced
this pull request
Jul 12, 2026
…HKUDS#464) Read-only tool that sends a local image to the session model as a multimodal message. Path-validated against the allowed file roots; complements read_document's OCR with semantic vision analysis. Requires a vision-capable model.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Users naturally send chart screenshots (K-line, positions, statements) to the bot through IM channels. Today the agent's only option is
read_document, whose image path is OCR-only — for a candlestick chart it returns nothing, and the agent has to apologize:Meanwhile the provider layer already supports multimodal input (the OpenAI Codex adapter converts
image_urlcontent toinput_image), it just isn't reachable from any tool.What this adds
A new auto-discovered
analyze_imagetool:ChatLLM().chat(...)and returns the model's answerresolve_safe_path+allowed_file_roots— exactly the same policy asread_file, no new read surface{"ok": …}envelopeTesting
ChatLLM): path safety, missing/unsupported files, message shape (text + data-URL image part), empty-answer error🤖 Generated with Claude Code
https://claude.ai/code/session_01YEshFSpjkW7EFuPCMGE64A