marketplace_prompt_id, and get a response (e.g., “What city is this image of?”).
You need an API key and the Python client. Get your key at swarms.world/platform/api-keys. Find marketplace prompts on swarms.world or via the Query Prompts API.
Step 1 — Set up the client and API key
Install the client and load your API key from a.env file:
.env file in your project root:
Keep your API key out of version control. Use
.env and add .env to your .gitignore.Step 2 — Encode your image and pick a marketplace prompt
Encode your image to base64 (required for the vision API). Use a local file path or replace with your own image:72021048-6f31-48b6-b624-7732e6f93437.
Step 3 — Run the agent with the image and task
Build anagent_config that uses the marketplace prompt and a vision-capable model, then call client.agent.run with your task and img:
marketplace_prompt_id is set, the API fetches the prompt from the marketplace and uses it as the agent’s system prompt; you don’t need to pass system_prompt, agent_name, or description yourself.
Complete script
Here is the full script in one place:- Python
Summary
For more details, see Vision Capabilities and Using marketplace prompts with agents.