Skip to content

Add AgentTax action provider#1098

Open
AgentTax wants to merge 2 commits intocoinbase:mainfrom
AgentTax:feat/agenttax-action-provider
Open

Add AgentTax action provider#1098
AgentTax wants to merge 2 commits intocoinbase:mainfrom
AgentTax:feat/agenttax-action-provider

Conversation

@AgentTax
Copy link
Copy Markdown

@AgentTax AgentTax commented Apr 9, 2026

Summary

Adds AgentTaxActionProvider so AgentKit agents can handle US sales tax compliance end-to-end on Base. The new remit_tax_onchain action appends the AgentTax Base Builder Code (bc_626v2pr2) to USDC transfer calldata via ERC-8021 for attribution in the Base developer dashboard.

Why

Agent marketplaces, x402 micropayment services, and autonomous commerce platforms on Base have a shared unsolved problem: who collects and remits sales tax on these transactions? As agent-to-agent commerce grows, more of the AgentKit ecosystem is accepting USDC for digital goods and services — but none of it currently has a compliance layer.

AgentTax is a compliance API purpose-built for the agent economy (51-jurisdiction sales tax engine, ~43,000 zip-level local rates, IRS 1099-DA export, nexus monitoring). This action provider lets any AgentKit agent use it natively.

Actions

Action Auth Onchain
calculate_tax Optional No
get_local_rate Optional No
check_nexus_status Optional (demo mode without) No
export_1099_da Optional (demo mode without) No
remit_tax_onchain Optional (audit log if set) Yes — Base

Public actions work without an API key. Authenticated actions fall back to AgentTax demo data without a key and return real data for the configured entity when a key is provided.

Base Builder Code integration

The remit_tax_onchain action appends the ERC-8021 suffix

0x62635f36323676327072320b0080218021802180218021802180218021

to the USDC transfer calldata. Decoded: bc_626v2pr2 (ASCII) + length byte (0x0b) + 8021 magic pattern. Gas overhead is ~450 gas per transaction (16 gas per non-zero byte). Smart contracts ignore the trailing bytes, so the transfer behaves normally.

Attribution can be opted out via builderCodeEnabled: false in the provider config. Registered via https://dashboard.base.org.

Testing

  • 37 unit tests, all passing
    • Schema validation including the real transaction_type enum, state code normalization, ZIP format, required counterparty_id
    • ERC-8021 Builder Code encoding round-trip test (decodes [ascii code][length byte][magic pattern])
    • All 5 actions: happy path, HTTP error, success: false body handling, and network failure paths
    • remit_tax_onchain assertions: USDC transfer selector, correct per-network USDC address, Builder Code suffix presence, opt-out behavior, audit log on/off, recipient validation, non-Base network rejection
    • supportsNetwork across EVM/non-EVM
  • Full suite: 901 / 901 passing (no regressions)
  • E2E smoke tested against the live AgentTax API — verified request body shape matches the /api/v1/calculate contract and response parses cleanly
  • Type-check, ESLint, and Prettier all clean

Usage

import { AgentKit, agentTaxActionProvider } from "@coinbase/agentkit";

const agentKit = await AgentKit.from({
  walletProvider,
  actionProviders: [
    agentTaxActionProvider({
      apiKey: process.env.AGENTTAX_API_KEY,    // optional
      reserveWallet: "0xYourTreasuryWallet",   // default recipient for remit
    }),
  ],
});

// Typical agent flow:
// 1. calculate_tax        - determine collection amount
// 2. collect payment      - via erc20 / x402 / your payment flow
// 3. remit_tax_onchain    - transfer collected tax (Builder Code attached)

Full README with per-action docs: typescript/agentkit/src/action-providers/agenttax/README.md

Links

Checklist

  • Provider added under typescript/agentkit/src/action-providers/agenttax/
  • Registered export in src/action-providers/index.ts
  • Added .changeset/add-agenttax-action-provider.md
  • Added README with usage examples
  • 37 unit tests cover all actions, schemas, and Builder Code encoding
  • Full suite passes (901 / 901)
  • Type-check passes
  • ESLint + Prettier clean
  • E2E smoke tested against live AgentTax API

Adds the @coinbase/agentkit AgentTaxActionProvider so AgentKit agents can
handle US tax compliance end-to-end on Base:

- calculate_tax           — sales tax calculation (AgentTax engine v1.5,
                            51 jurisdictions, zip-level local rates)
- get_local_rate          — zip-level combined state + local rate lookup
- check_nexus_status      — per-state sales tax nexus status
- export_1099_da          — IRS Form 1099-DA draft data export
- remit_tax_onchain       — tax-compliant USDC remittance on Base that
                            appends the AgentTax Base Builder Code
                            (bc_626v2pr2) to transaction calldata via
                            ERC-8021 for attribution in the Base
                            developer dashboard.

Public actions (calculate_tax, get_local_rate) work without an API key.
Authenticated actions fall back to demo data without a key and return real
data for the configured entity when a key is provided. The remit action
optionally logs the onchain transaction to the AgentTax audit trail when
a key is configured.

Includes 37 unit tests covering schemas, Builder Code encoding, all five
actions, builder-code opt-out, demo-mode behavior, and error paths.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@AgentTax AgentTax requested a review from murrlincoln as a code owner April 9, 2026 14:40
@cb-heimdall
Copy link
Copy Markdown

cb-heimdall commented Apr 9, 2026

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 1
Sum 2

@github-actions github-actions bot added documentation Improvements or additions to documentation action provider New action provider typescript labels Apr 9, 2026
check_nexus_status and export_1099_da now surface AgentTax API validation
errors (HTTP 200 with {success: false, error}) as clean error strings,
matching the pattern already used by calculate_tax and get_local_rate.

Adds 3 new tests (40 total, 903/903 suite passing).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action provider New action provider documentation Improvements or additions to documentation typescript

Development

Successfully merging this pull request may close these issues.

2 participants