Skip to main content

archerprotocol-sdk

Build, monetize, and publish an Archer intent from Python. This package mirrors the Node @archerprotocol/sdk builder surface; both are held to the same shared test vectors, so an envelope built here is byte-identical to one built in TypeScript.

pip install "archerprotocol-sdk[fastapi]"

One-call handler (FastAPI)

from fastapi import FastAPI
from archer_sdk import archer, require_archer_caller, BadInputError
from archer_sdk.fastapi import mount_archer_tools

app = FastAPI()

async def deposit(ctx):
    caller = require_archer_caller(ctx.args)
    amount = ctx.args.get("amount")
    if not amount:
        raise BadInputError('amount is required (e.g. "1.5")')
    return archer.envelope(
        cost=archer.cost(model="embedded", archer_fee_micro=200),
        authorizations=[
            archer.authorization(
                type="tx",
                namespace="evm",
                label=f"Deposit {amount} USDC",
                payload={"chainId": 8453, "to": "0x...", "data": "0x...", "value": "0x0"},
            )
        ],
        record=archer.record(
            record_kind="position",
            basis_micro=1_000_000,
            disclosure={"custody": "SELF", "exitModel": "PERMISSIONLESS"},
        ),
    )

mount_archer_tools(app, {"/deposit": deposit})

The handler verifies the signed Archer envelope (via archer-verify), hands you ctx.args / ctx.caller / ctx.request_id / ctx.intent_definition_id / ctx.user_id, and wraps your return in the partner response envelope. Raise BadInputError (400) or UpstreamError (503) for clean failures.

Reads

Return the flat render payload instead of an envelope:

from archer_sdk import archer

async def price_chart(ctx):
    return archer.render(
        text="ETH, last 30 days",
        embed=archer.embed.chart(chart_type="line", data=[{"x": "2026-01", "y": 3000}]),
    )

Effect inference (pre-flight)

infer_effects is the same function the platform runs server-side to decode a sign authorization into a verified, bounded confirmation. Run it locally against your descriptors to see exactly what the user's confirmation screen will derive; the platform always re-derives its own report.

from archer_sdk import infer_effects

report = await infer_effects(auth, descriptors=my_descriptors, price=my_price_fn)
assert report["verdict"] == "DECODED_BOUNDED"

Publishing

Publishing and lifecycle management use the Node CLI, which works without a Node project: npx @archerprotocol/sdk gives you archer init / publish / activate / stats.

Download files

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

Source Distribution

archerprotocol_sdk-0.3.0.tar.gz (17.2 kB view details)

Uploaded Source

Built Distribution

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

archerprotocol_sdk-0.3.0-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file archerprotocol_sdk-0.3.0.tar.gz.

File metadata

  • Download URL: archerprotocol_sdk-0.3.0.tar.gz
  • Upload date:
  • Size: 17.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.12

File hashes

Hashes for archerprotocol_sdk-0.3.0.tar.gz
Algorithm Hash digest
SHA256 d710aafd49ddd80042a3ef5b9ce1017a8920837f947033b8c8195eb6d5395b3c
MD5 bd0b77a134b256c339171ed6ed6452f7
BLAKE2b-256 2aacfa989561670e19c56ad4ca1a41c52549fc01ea548c942044b0b6716f2fb2

See more details on using hashes here.

File details

Details for the file archerprotocol_sdk-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for archerprotocol_sdk-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8860739fa5f81c13163e73b9eca1341084d0fc683543b6a3d2db0e33eb77d909
MD5 b1f29af326c10ed3b6e904c35541c7ec
BLAKE2b-256 532a644cfb4eefa580ccbf29cac345d8e394076d0e1ff4499099e02d80de6227

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 files

0.1.0

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