agentharbor (Python)
Client for Agent Harbor's pay-per-call business-website API at
https://x402.agentharbor.agency, paid per request in USDC on Base with x402.
No account or API key. A client-side budget guard vets every quote before signing, and failed calls
are not charged.
pip install "agentharbor[x402]" # client + x402 payment support
pip install "agentharbor[x402,langchain]" # + LangChain tools
The base install (pip install agentharbor, only httpx) can read the free /catalog and shows
you the vetted price of a paid route (WalletRequired.quote) without paying.
Usage
import asyncio, os
from agentharbor import AgentHarbor, NotCharged, PriceTooHigh
async def main():
client = AgentHarbor(private_key=os.environ["AGENTHARBOR_PRIVATE_KEY"], max_price_usd=0.05)
try:
card = await client.company("mailchimp.com")
except NotCharged as e:
print("not charged:", e.status_code, e.detail)
return
print(card["business_name"], card["generic_email"], card["platforms"])
print(card.payment, card.request_id) # settlement receipt and gateway request id
asyncio.run(main())
| Method | Route | Price |
|---|---|---|
company(domain) |
/company |
$0.005 |
scrape(domain) |
/scrape |
$0.01 |
ai_crawlers(domain) |
/ai-crawlers |
$0.01 |
enrich(domain) |
/enrich |
$0.05 |
audit(domain) |
/audit |
$0.05 |
catalog() |
/catalog |
free |
Paid methods return a Result: the JSON body as a plain dict, plus .payment (decoded
PAYMENT-RESPONSE: transaction hash, network, payer), .quote (the vetted price) and .request_id.
/scrape, /enrich and /company bodies include a free content_safety prompt-injection scan.
AgentHarborSync takes the same arguments and has the same methods, without await.
Constructor
AgentHarbor(private_key=None, account=None, base_url="https://x402.agentharbor.agency",
max_price_usd=0.05, timeout=150, *, pay_to=PAY_TO)
private_key: hex EVM key of the paying wallet (USDC on Base). Turned into aneth_accountaccount immediately; the string is not kept or logged. Or passaccount=(aneth_accountLocalAccount or any x402 EVM signer).max_price_usd: the most one call may cost. Each method also takesmax_price_usd=per call.pay_to: the only address the client will pay. Defaults to Agent Harbor's0x840C829530DF7B4CCF700Fa3A0060cF2C80b014e.
Budget guard
Each paid call is sent unpaid first. The 402 PAYMENT-REQUIRED header is decoded and checked by
agentharbor.check_payment_required (a pure function): amount at most max_price_usd, payee equal
to pay_to, x402 v2 exact USDC on Base mainnet. A failing quote raises PriceTooHigh,
UnexpectedPayee or UnsupportedNetwork before the x402 SDK can sign. The same check is
registered as an x402 client policy.
Errors
All errors subclass AgentHarborError and carry .charged (False, or None when unknown).
InvalidDomain: not a bare public hostname (checked client-side with the gateway's rules).PaymentRefused(PriceTooHigh,UnexpectedPayee,UnsupportedNetwork,MalformedPaymentRequired): the quote failed the guard; nothing signed.WalletRequired: no wallet configured;.quoteholds the price.NotCharged: the gateway answered 4xx/5xx;.status_code,.detail.PaymentFailed: the payment was rejected or could not be built; not charged.RequestFailed: no answer and no payment sent.OutcomeUnknown: a signed payment was sent but no answer arrived; check the payer address on basescan.org before retrying.
LangChain
from agentharbor import AgentHarbor
from agentharbor.langchain import get_tools
tools = get_tools(AgentHarbor(private_key=..., max_price_usd=0.01), include=["company", "ai_crawlers"])
One StructuredTool per route (agentharbor_company, agentharbor_scrape,
agentharbor_ai_crawlers, agentharbor_enrich, agentharbor_audit), each with a description that
states its price. Tools return the JSON body as a string; failures become tool errors that say
whether anything was charged.
Links
API docs (llms.txt) · OpenAPI · Source · MIT License, Agent Harbor LLC
Metadata
Release files for agentharbor 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| agentharbor-0.1.0.tar.gz | 20.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| agentharbor-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 39.1 kB
Release files / agentharbor-0.1.0.tar.gz
| Download URL | agentharbor-0.1.0.tar.gz |
|---|---|
| Size | 20.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a1ff8406a28e6ab6d889a306a8b4f7cf070df80f4d9c3e7d70da7a762092bbe0
|
|
BLAKE2b-256 checksum How to use checksums |
98a6e92a865d3a51bde7cc43d17b2670475f6e0f85e0156bbb1bc79deda23dcc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.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 Oct 14, 2026.
Transparency logRelease files / agentharbor-0.1.0-py3-none-any.whl
| Download URL | agentharbor-0.1.0-py3-none-any.whl |
|---|---|
| Size | 18.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4d542d787e8d055493ac1ff9decb6c7e5f411c695e80ae01e9b975456080b0b7
|
|
BLAKE2b-256 checksum How to use checksums |
f7e93f76bc7a449c234c23115e8b21bf6f22f3c63c3dcf5e20ab35ece52fe550
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.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 Oct 14, 2026.
Transparency log