---
title: "Upsonic · Scrape.ly Docs"
description: "Give Upsonic agents tools that run Actors and read their results."
url: https://scrape.ly/docs/upsonic
markdown: https://scrape.ly/docs/upsonic.md
---

# Upsonic

> Give Upsonic agents tools that run Actors and read their results.

Give Upsonic agents Scrape.ly tools: search the Store, run Actors, wait for their runs, and read the results. Agents connect to the hosted [MCP server](https://scrape.ly/docs/mcp.md) through Upsonic's `MCPHandler`, so there is no Scrape.ly package to install.

```bash
pip install "upsonic[mcp]"
```

Create an API token in the [dashboard](https://my.scrape.ly) 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](https://scrape.ly/docs/api-keys.md).

## Give an agent Scrape.ly tools

Open the server with `MCPHandler` and add it to the task's tools. `StreamableHTTPClientParams` sends the token with every request.

```python
import os
from datetime import timedelta

from upsonic import Agent, Task
from upsonic.tools.mcp import MCPHandler, StreamableHTTPClientParams

scrapely = MCPHandler(
    server_params=StreamableHTTPClientParams(
        url="https://mcp.scrape.ly",
        headers={"Authorization": f"Bearer {os.environ['SCRAPELY_TOKEN']}"},
        timeout=timedelta(seconds=30),
        sse_read_timeout=timedelta(seconds=300),
    ),
    timeout_seconds=60,
)

task = Task(
    description=(
        "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."
    ),
    tools=[scrapely],
)

agent = Agent(name="Web researcher", model="anthropic/claude-sonnet-5-5")
agent.print_do(task)
```

Any model Upsonic supports works. See [MCP tools](https://docs.upsonic.ai/concepts/tools/mcp-tools/mcp-handler) 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](https://scrape.ly/docs/mcp.md#tools) page. To run one Actor you already know, name it in the task, 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 task (such as "at most 20 results"), and keep a **Max charge per day** on the key.

---

- Previous: [Perplexity](https://scrape.ly/docs/perplexity.md)
- Next: [JavaScript client](https://scrape.ly/docs/client-js.md)
- All docs: [Docs index](https://scrape.ly/docs.md), [llms.txt](https://scrape.ly/llms.txt)
