Give your AI agent a stock photo tool in 5 lines A developer released Pexafy, a semantic search engine over millions of free-to-use photos from Unsplash, Pexels, Pixabay and other libraries, along with integration packages for LangChain, the Vercel AI SDK and any MCP-capable framework. The toolkit exposes three tools — search by description, find similar photos, and get a single photo — and returns each result with its licence and required credit line, with an MCP server available at mcp.pexafy.com. Tested setups are also documented for the OpenAI Agents SDK, Claude Agent SDK, Google ADK, CrewAI, LlamaIndex, Mastra and Strands Agents. Agents that write blog posts, landing pages or slides end up needing pictures. Generated images are not always the answer: you may want a real street in Lisbon, a real espresso machine, and a licence you can check. Pexafy https://pexafy.com is a semantic search engine over millions of free-to-use photos from Unsplash, Pexels, Pixabay and other libraries. Your agent describes the photo it needs in plain language and gets back real photographs, each with its licence and the credit line to display. Below: the same tool in LangChain, the Vercel AI SDK and any MCP-capable framework. Every snippet was run as printed. export PEXAFY API KEY="pexafy ..." export ANTHROPIC API KEY="sk-ant-..." pip install -U langchain-pexafy langchain langchain-anthropic python from langchain.agents import create agent from langchain pexafy import PexafyToolkit agent = create agent "anthropic:claude-haiku-4-5", tools=PexafyToolkit .get tools result = agent.invoke {"messages": {"role": "user", "content": "Find a header photo for a post about remote work, with its credit line."} } print result "messages" -1 .content The toolkit has three tools: search by description, find similar photos, get one photo. create agent runs on LangGraph, and the tools also work with ToolNode or bind tools . The same package exists for LangChain.js: npm install langchain-pexafy . npm install pexafy-ai-sdk ai zod @ai-sdk/anthropic js import { anthropic } from "@ai-sdk/anthropic"; import { generateText, stepCountIs } from "ai"; import { pexafyTools } from "pexafy-ai-sdk"; const { text } = await generateText { model: anthropic "claude-haiku-4-5" , tools: pexafyTools , stopWhen: stepCountIs 5 , prompt: "Find a header photo for a post about remote work, with its credit line.", } ; console.log text ; Pexafy also runs an MCP server: https://mcp.pexafy.com/mcp , with your API key as a Bearer header. Here it is in Pydantic AI: pip install "pydantic-ai-slim mcp,anthropic " python import os from pydantic ai import Agent from pydantic ai.mcp import MCPToolset, StreamableHttpTransport pexafy = MCPToolset StreamableHttpTransport "https://mcp.pexafy.com/mcp", headers={"Authorization": f"Bearer {os.environ 'PEXAFY API KEY' }"}, .filtered lambda ctx, tool: tool.name in {"search photos", "search photos by image"} agent = Agent "anthropic:claude-haiku-4-5", instructions="Find free stock photos and give each photo's credit line.", toolsets= pexafy , result = agent.run sync "Find a header photo for a post about remote work." print result.output The filter keeps the two search tools; the others are for chat clients that show a photo grid. Tested setups for other frameworks: OpenAI Agents SDK https://docs.pexafy.com/openai-agents , Claude Agent SDK https://docs.pexafy.com/claude-agent-sdk , Google ADK https://docs.pexafy.com/google-adk , CrewAI https://docs.pexafy.com/crewai , LlamaIndex https://docs.pexafy.com/llamaindex , Mastra https://docs.pexafy.com/mastra , Strands Agents https://docs.pexafy.com/strands . With the LangChain and AI SDK packages, each photo is one record abridged : { "rank": 1, "photo id": "019e1ea7-2e82-7a34-a451-4c6c7c8250f4", "alt text": "Red bicycle parked against white wall with front wheel facing left and back wheel right", "url": "https://images.unsplash.com/photo-1520538254843-27a40bae5e3a?w=1280", "width": 4896, "height": 3264, "orientation": "landscape", "photographer": "Mitchel Lensink", "source": "Unsplash", "license": "free", "credit": "Photo by Mitchel Lensink on Unsplash https://pexafy.com/legal/licenses/ unsplash " } The agent can put url in your page, alt text in the alt attribute and credit under the photo. On the free plan, show the credit line next to each photo you publish.