Skip to main content

langchain-ausca

LangChain tools that pay for HTTP 402 APIs over x402 instead of carrying API keys. A tool built here works against any x402 v2 resource; nothing in it is specific to one vendor. The model authors the request; the caller's signing key and hard per-call USD cap stay outside the model's reach, enforced by the official x402 library's spend controls before anything is signed.

Install

pip install langchain-ausca

Use

import os
from langchain_ausca import payable_tool
from pydantic import BaseModel

class LeaseBrowser(BaseModel):
    duration_seconds: int

browser = payable_tool(
    name="lease_browser",
    description="Lease a remote browser with CDP access for 10, 30, or 60 minutes. Costs $0.10 to $0.25 in USDC on Base.",
    args_schema=LeaseBrowser,
    url="https://ausca.com/v1/lease-browser",
    private_key=os.environ["WALLET_PRIVATE_KEY"],  # pays USDC on Base
    max_payment_usd=0.50,                          # hard per-call cap
)

The tool result is a JSON string with the resource result and, when the call was paid, the decoded settlement proof from the PAYMENT-RESPONSE header.

The example uses Ausca, pay-per-call agent infrastructure services with no accounts or API keys; its catalog-bound Python client is the ausca package. Any other x402 v2 resource works the same way: point url at it.

The npm sibling of this package is langchain-ausca.

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

langchain_ausca-0.1.0.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

langchain_ausca-0.1.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file langchain_ausca-0.1.0.tar.gz.

File metadata

  • Download URL: langchain_ausca-0.1.0.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.4

File hashes

Hashes for langchain_ausca-0.1.0.tar.gz
Algorithm Hash digest
SHA256 82db6d97d54b47eb8b74eeb56534e54c6a6572c7632208623bc40118d2258529
MD5 40027cb3f339808598a4bd6a9f673a7f
BLAKE2b-256 cfa660845f4d47f4518fcb193e1e1be04d44f8cb4c7b3fba5681fa013fdd0e40

See more details on using hashes here.

File details

Details for the file langchain_ausca-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_ausca-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7e2ada16c0a3d62101d517015bc2d234a5243949d01f1561e292c1dd0e077951
MD5 ebd73eb72844922f7e9e141f903375cb
BLAKE2b-256 bce3d515207b3ffcdbe36a9eb9e005f066a6439d1b2e84ae1183b6256d70dfdc

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 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