Build and monetize an Archer intent from Python: typed envelope builders, embeds, caller context, effect inference, and a one-call FastAPI handler.
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file archerprotocol_sdk-0.1.0.tar.gz.
File metadata
- Download URL: archerprotocol_sdk-0.1.0.tar.gz
- Upload date:
- Size: 16.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50d8dcdac35070e6c14526485fbacdeadf7b99fbeb7e22a096fba18bc50d3a87
|
|
| MD5 |
449d53e59fb5d3b957c0cab4d244ad4e
|
|
| BLAKE2b-256 |
bd42dfa88311b896d431e9aaa8101b0ca318f88abbf25cd5727b1a66e04eaaa0
|
File details
Details for the file archerprotocol_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: archerprotocol_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f5611893aeed318802902271ce1c4d391c0001870d421f82aa97b80f2ab03b6
|
|
| MD5 |
3a05dac20702e49de3f7b20895dfa804
|
|
| BLAKE2b-256 |
7af795bd96a1a48fa275946a682a20c49bc94e85f86493670bd5b50808c3b35d
|