Problem
A text question about a collection of images needs two things: find the right image, and say something true about it. Retrieval alone picks images that look close in embedding space but can be wrong. I wanted an agent that decides which tools to use and shows the evidence for every answer.
Approach
- Index: 100 images embedded with CLIP ViT-B/32 into normalized 512-dimensional vectors, searched by cosine similarity.
- Grounding: BLIP captions turn retrieved images into text evidence. The final answer is built only from that evidence.
- Routing: the agent skips retrieval when the query names an image, captions just the top hit for simple lookups, and captions and re-ranks several candidates for harder queries.
- Trace: every answer comes with the list of tool calls it made.

Result
15 queries in three categories, 35 tool calls in total, each outcome checked by hand against the images:
| Category | Example | Outcome |
|---|---|---|
| Retrieval | “Find me a picture of a dog.” | 5 of 5 |
| Direct inspection | “Describe image_044.jpg in one sentence.” | 5 of 5, retrieval skipped |
| Retrieval + grounding | “Find an image of a person riding something.” | 4 of 5 |
14 of 15 (93%) returned a relevant, grounded answer.
Captioning beat raw retrieval. For “a person riding something”, CLIP’s top hit was a skier. After re-ranking on captions, the agent picked a photo BLIP described as “a person riding a horse across a field”.

What I’d do next
- Replace keyword-overlap re-ranking with an embedding or LLM re-ranker.
- Guard against degenerate captions with a repetition penalty or a fallback to the next candidate.
- Benchmark with recall@k on a labeled set such as COCO captions instead of 15 hand-judged queries.