OpenAI Agents SDK
Use Scrape.ly tools in agents built with the OpenAI Agents SDK.
Give agents built with the OpenAI Agents SDK Scrape.ly tools: search the Store, run Actors, wait for their runs, and read the results. Agents connect to the hosted MCP server, so there is no Scrape.ly package to install.
pip install openai-agentsCreate an API token in the dashboard under Settings → API & Integrations and set it as SCRAPELY_TOKEN. The agent can do anything the token can, including starting paid runs, so give it a scoped key: actors:run, runs:read, and datasets:read, with a Max charge per day. See API keys & permissions.
Give an agent Scrape.ly tools
Open the server with MCPServerStreamableHttp and add it to the agent's mcp_servers. The SDK lists the server's tools when the agent runs and calls them as the agent decides.
import asyncio
import os
from agents import Agent, Runner
from agents.mcp import MCPServerStreamableHttp
async def main():
async with MCPServerStreamableHttp(
name="Scrape.ly",
params={
"url": "https://mcp.scrape.ly",
"headers": {"Authorization": f"Bearer {os.environ['SCRAPELY_TOKEN']}"},
"timeout": 30,
},
cache_tools_list=True,
) as scrapely:
agent = Agent(
name="Web researcher",
instructions="Find the right Actor in the Scrape.ly Store, run it, and report what its results show.",
mcp_servers=[scrapely],
)
result = await Runner.run(
agent,
"Find an Actor that scrapes Google Maps, run it for 'coffee shops in Berlin' with at most 20 results, "
"and list the name, rating, and address of each place.",
)
print(result.final_output)
asyncio.run(main())The agent uses the SDK's default model unless you set model on it. See MCP in the Agents SDK for more options.
What the agent can do
The agent gets the MCP server's default tools. The ones used most:
| Tool | What it does |
|---|---|
search-actors | Find Actors in the Store by keywords. |
fetch-actor-details | Read an Actor's input schema, README, and pricing before running it. |
call-actor | Run an Actor with a JSON input, optionally with maxItems and maxTotalChargeUsd. |
get-actor-run | Wait for a run and check its status. |
get-actor-output | Read a run's results, paged and kept compact. |
The full list, including saved inputs and automations, is on the MCP server page. To run one Actor you already know, name it in the prompt, for example Run username/actor-name, so the agent skips the search.
Costs: runs started by the agent are billed like any run. Put the limits in the prompt (such as "at most 20 results"), and keep a Max charge per day on the key.