AgentTax Python SDK
Sales tax, use tax, and capital gains for AI agents. Full docs at agenttax.io/api-docs.
Install
pip install agenttax
Quickstart — no signup required
from agenttax import AgentTaxClient
client = AgentTaxClient() # keyless: demo mode, 50 calls/day
result = client.calculate(
role="buyer", # buyer side needs no nexus setup
amount=1000.00,
buyer_state="TX",
transaction_type="compute",
counterparty_id="agent_seller_001",
)
print(result["total_tax"]) # use tax owed on the purchase
print(result["combined_rate"]) # the location's composed rate (state + local)
print(result["applied_rate"]) # the rate actually applied to compute total_tax
print(result["confidence"]) # {"score": ..., "level": ...}
Demo mode returns the tax figure, the rate and a confidence score. It omits the audit trail, jurisdiction breakdown and advisories, and it keeps no history.
API Key
Get a free API key at agenttax.io — 1,500 calls/month at no cost — for the full response plus transaction history, nexus monitoring, capital gains tracking and 1099 export.
client = AgentTaxClient(api_key="atx_live_...")
Why role="seller" returns $0.00 on a new account
A seller only has to collect tax where it has economic nexus, and a new account
has none configured — so every seller-side calculation correctly returns
total_tax 0 with final_determination: "no_nexus" until you set nexus up:
import requests
requests.post(
"https://agenttax.io/api/v1/nexus",
headers={"X-API-Key": "atx_live_..."},
json={"nexus": {"TX": {"hasNexus": True, "reason": "Economic nexus"}}},
)
Or pass nexus_override={"TX": {"hasNexus": True}} to calculate() to model a
seller position without saving it. Note the shape — a bare list of state codes
is read as "no nexus" and silently returns $0.00. Buyer-side calls need none of
this, which is why the quickstart above starts there.
Methods
calculate(**kwargs)
Calculate sales tax for a transaction.
| Parameter | Type | Required | Description |
|---|---|---|---|
role |
str | ✓ | "seller" or "buyer" |
amount |
float | ✓ | Transaction amount in USD |
buyer_state |
str | ✓ | Two-letter state code |
transaction_type |
str | ✓ | "saas", "compute", "consulting", etc. |
counterparty_id |
str | ✓ | Counterparty identifier |
work_type |
str | "compute", "research", "content", "consulting", "trading" |
|
is_b2b |
bool | Business-to-business transaction | |
use_context |
str | "enterprise_system", "individual", or "mixed" — Maryland-only in v1, declares whether the purchase is solely for commercial use in an enterprise computer system (TB-56); absent = unchanged is_b2b-proxy default |
|
buyer_zip |
str | 5-digit ZIP for local rate lookup |
get_rates(state=None, format=None, explain=False)
Fetch sales tax rates for all 51 jurisdictions. No auth required.
get_capital_gains_rates(state=None)
Fetch state capital gains rates. No auth required.
get_local_rate(zip_code)
Fetch combined local + state rate for a ZIP code.
get_transactions(limit=50, offset=0, ...)
Fetch transaction history. Auth required.
log_trade(**kwargs) / get_trades(**kwargs)
Capital gains trade tracking (FIFO/LIFO/Specific ID). Auth required.
Error Handling
from agenttax import AgentTaxClient, AuthError, RateLimitError, ValidationError
client = AgentTaxClient(api_key="atx_live_...")
try:
result = client.calculate(...)
except AuthError:
# Invalid or missing API key
pass
except RateLimitError:
# Monthly quota exceeded — upgrade tier or wait
pass
except ValidationError as e:
# Bad request parameters
print(e)
Free Tier
1,500 API calls/month at $0. Paid plans start at $25/month (10K calls). See agenttax.io/pricing.
Metadata
Release files for agenttax 0.2.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 | Provenance | Actions |
|---|---|---|---|---|
| agenttax-0.2.0.tar.gz | 13.4 kB | Without provenance | Details for agenttax-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| agenttax-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for agenttax-0.2.0-py3-none-any.whl |
Total release size: 22.9 kB
Release files / agenttax-0.2.0.tar.gz
| Download URL | agenttax-0.2.0.tar.gz |
|---|---|
| Size | 13.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b0411dee3e0c30e478f19dea4491640d90fdf031657c6a9a40b7ea6c7a3531e4
|
|
BLAKE2b-256 checksum How to use checksums |
03995466a539729acc4c41769ca081f5dd0671e250ada788c4770cc416d3aa12
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / agenttax-0.2.0-py3-none-any.whl
| Download URL | agenttax-0.2.0-py3-none-any.whl |
|---|---|
| Size | 9.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a65bfd64173bfc47aa5b363c59541dd0e4e9ea57ed37564a91801fe060a254c5
|
|
BLAKE2b-256 checksum How to use checksums |
f01d9bba8cd63659079fe9c338652b5a459a341721790f2690f7c299995705f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Security for agenttax 0.2.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.