Urgent.News

What's breaking now, across thousands of outlets.

AI

Give your AI agent a stock photo tool in 5 lines

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 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…

To create an AI agent capable of fetching stock photos with just five lines of code, you need a Pexafy API key and a model key. The examples in the source code use Claude Haiku 4.5 as the model, but any provider will work. Install the necessary packages using pip: langchain-pexafy, langchain, and langchain-anthropic for Python, or langchain-pexafy and ai sdk for TypeScript.

Import the required modules and create an agent using create_agent, passing in the anthropic:claude-haiku-4-5 model and the PexafyToolkit() as tools. Invoke the agent with a message requesting a header photo for a post about remote work, along with its credit line. The toolkit provides three tools: search by description, find similar photos, and get one photo.

The same package is available for LangChain.js and can be used with the Vercel AI SDK. Additionally, Pexafy can run an MCP server using your API key as a Bearer header. The package also works with Pydantic AI, enabling the creation of an MCPToolset and agent for fetching free stock photos and providing credit lines.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in AI

Earth Detective: AI That Turns the Real World Into Your Investigation

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 1: Touch Grass What I Built I built Earth Detective , an AI-powered outdoor investigation game designed to get people away from…

  • Players engage in nature, water, urban, and sustainability-themed mysteries outdoors.
  • The open-source project uses local AI inference for privacy and adaptability.

Logo Design Skill Packages SVG Checks for AI Agents

The public, MIT-licensed logo-design-skill repository packages a staged logo-design workflow for Claude Code, Gemini CLI, Codex CLI and other agents that support skills.

  • MIT-licensed repository offers staged logo-design workflow for AI agents.
  • Process includes brief, concept generation, SVG representation, and user approval checkpoint.
  • Repository provides SVG auditing tools and 1,400 real-world logo references.

More from Wednesday 7 October →