Skip to main content

Agentic Scraper Provider SDK for Python

Server-side SDK for event-driven MCP Market monetization. Use it inside the MCP or API service you publish as a provider. It is separate from the Agentic Scraper client SDK used by consumers.

pip install agentic-scraper-provider-sdk

How charging works

For a Marketplace entry configured with provider_event pricing, the Agentic Scraper proxy forwards a signed x-agentic-charge-token header to your service. Report a configured event and count with charge(). Always use the returned chargedCount; it may be lower than requested when the buyer's remaining run budget is limited.

FastAPI / async example

import os

from fastapi import FastAPI, Request
from agentic_scraper_provider import AsyncAgenticProviderClient

provider = AsyncAgenticProviderClient(api_key=os.environ["AGENTIC_PROVIDER_API_KEY"])
app = FastAPI()

@app.post("/mcp")
async def mcp(request: Request):
    records = await load_records()
    result = await provider.charge(
        charge_token=request.headers["x-agentic-charge-token"],
        event_name="record-returned",
        count=len(records),
        idempotency_key=f"record-export:{request.headers.get('x-request-id')}",
        metadata={"requestedCount": len(records)},
    )
    return records[:result["chargedCount"]]

Flask / sync example

import os

from flask import Flask, request
from agentic_scraper_provider import AgenticProviderClient

provider = AgenticProviderClient(
    api_key=os.environ["AGENTIC_PROVIDER_API_KEY"],
)
app = Flask(__name__)

@app.post("/summarize")
def summarize():
    summary = create_summary(request.json["text"])
    result = provider.charge(
        charge_token=request.headers["x-agentic-charge-token"],
        event_name="summary-created",
        idempotency_key=f"summary:{request.headers.get('x-request-id')}",
    )
    return {"summary": summary} if result["chargedCount"] == 1 else {"summary": None}

Reliability rules

  • Use a stable idempotency_key for every logical event.
  • Return or process at most result["chargedCount"] units.
  • Both clients retry transport failures, HTTP 429, and 5xx responses while preserving the same idempotency key.
  • Validation and other 4xx errors are not retried.
  • Verification and production use the same charge() method. Verification returns verification: true and creates no billing activity.
  • Keep the provider API key and charge token on the server. Never expose or log them.

AgenticProviderClient is synchronous for Flask and other WSGI applications. AsyncAgenticProviderClient is intended for FastAPI and other ASGI services. The default API base URL is https://api.agenticscraper.com/api/v1.

Full REST and SDK documentation is available at https://docs.agenticscraper.com.

Metadata

Release files for agentic-scraper-provider-sdk 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agentic-scraper-provider-sdk 0.2.0
File Size Uploaded
agentic_scraper_provider_sdk-0.2.0.tar.gz 3.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agentic-scraper-provider-sdk 0.2.0
File Interpreter ABI Platform
agentic_scraper_provider_sdk-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 6.8 kB

Release files / agentic_scraper_provider_sdk-0.2.0.tar.gz

Download URL agentic_scraper_provider_sdk-0.2.0.tar.gz
Size 3.0 kB
Tags Source
SHA-256 checksum
How to use checksums
171804981d25d6970b821bb047f150e3e901fef81a41ee2b04def2c61dcfe2cf
BLAKE2b-256 checksum
How to use checksums
634dea528b75e59b0ba4a2b19452a1f79bc3d988d91ae5917a8404d05bf2a93b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 27, 2026.

Transparency log

Release files / agentic_scraper_provider_sdk-0.2.0-py3-none-any.whl

Download URL agentic_scraper_provider_sdk-0.2.0-py3-none-any.whl
Size 3.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3ce47840a51abc923e346471b77c007c70d89399e0907f656655a21c34a9b736
BLAKE2b-256 checksum
How to use checksums
cf6e8301e29a4ce307118f63a78557260f9a5f6908bd6b4a94db408e9227a940
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 27, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page