Skip to content

Stripe for AI Agents + Agent LinkedIn on-chain Bring x402 micro-payments and ERC-8004 identity/receipts to any agent in minutes.

License

Notifications You must be signed in to change notification settings

veithly/AutonomyX

Repository files navigation

AutonomyX — Payment & Identity Layer for AI Agents

AutonomyX Logo

Stripe for AI Agents + Agent LinkedIn on-chain

Bring x402 micro-payments and ERC-8004 identity/receipts to any agent in minutes.

QuickstartArchitectureFeaturesAPI

Why AutonomyX

  • Agents can act, but lack cash register + identity + verifiable receipts.
  • Cross-border / micro-payments are clunky; off-chain invoices are not auditable.
  • Agents across platforms cannot trust or pay each other.
    AutonomyX solves this with x402 + ERC-8004 on a high-TPS EVM (Story), plus a full console & marketplace.

Features

  • x402-native payment loop: HTTP 402 negotiation, pay-then-retry, per-call & tiered pricing.
  • ERC-8004 identity/receipts: Identity NFT per agent; every paid call writes an InteractionReceipt (caller, agentId, amount, paymentTxHash).
  • Story-first: High-TPS EVM, low gas, fast confirmation; native IP token. Chainless fallback via DISABLE_ONCHAIN=true.
  • Console: Wallet-sign login (AuthGate), org auto-provision, pricing, budgets, payouts, analytics, CSV export, webhook.
  • Debugger: JSON invoke → 402 pay prompt → auto-retry; shows latency & tx hashes; replay & cURL copy.
  • Marketplace: Search/filter/sort (price/score/revenue/success), detail with sample I/O, on-chain info, recent receipts, one-click trial.
  • FinOps: Platform fee PLATFORM_FEE_BPS, payout state machine (REQUESTED→PROCESSING→SENT/FAILED/CANCELED), budgets & blocklists.
  • Observability: /api/v1/invocations exposes payment/receipt tx hashes + request payload; health check /api/healthz.

Architecture & Components

flowchart LR
    U[Caller / Upstream Agent] -->|POST /agent/:id/invoke| GW[Invoke Gateway]
    GW -->|HTTP 402 price,token,chainId,sessionId,paymentTarget| U
    U -->|On-chain pay: Story / IP| CHAIN[(Story)]
    CHAIN -->|txHash event| PAY[Payment Watcher]
    PAY --> GW
    GW --> AE[Agent Endpoint / Hosted Runtime]
    AE --> GW
    GW -->|result| U
    GW --> RECEIPT[ERC-8004 Receipt Writer]
    RECEIPT --> CHAIN
    CHAIN --> DB[(PostgreSQL)]
    GW --> OBS[/Invocations API & Console/]
Loading

Data

  • Primary DB: PostgreSQL via Prisma.
  • On-chain: ERC-8004 Identity + InteractionReceipt on Story; fallback stub when disabled.

Packages

  • packages/nextjs — Console, Marketplace, Invoke Gateway (Next.js App Router, RainbowKit/Wagmi, Viem, Prisma).
  • packages/hardhat — Contracts (Identity/Receipt), Hardhat for local chain.
  • doc/ — PRD, design, API, TODO.

Payment Loop (x402) — Sequence

sequenceDiagram
    participant Caller
    participant Gateway
    participant Wallet
    participant Story
    participant Agent
    Caller->>Gateway: POST /agent/:id/invoke (payload)
    Gateway-->>Caller: 402 Payment Required {price, token, chainId, sessionId, paymentTarget}
    Caller->>Wallet: Initiate pay
    Wallet->>Story: Transfer price to paymentTarget (sessionId memo)
    Story-->>Gateway: txHash observed (Payment Watcher)
    Gateway->>Agent: Forward original payload
    Agent-->>Gateway: Result
    Gateway-->>Caller: Result + paymentTxHash/receiptTxHash
    Gateway->>Story: Write ERC-8004 InteractionReceipt
Loading

Quickstart

Prereqs

  • Node ≥ 20.18.3
  • Yarn (v1 or v2+)
  • Git
  • PostgreSQL running locally (set DATABASE_URL accordingly)

Install

yarn install

Generate Prisma Client

cd packages/nextjs
npx prisma generate

Local Chain (Hardhat, port 31337)

cd packages/hardhat
yarn chain

Run Console

cd packages/nextjs
yarn dev

Env Notes

  • DISABLE_ONCHAIN=true to stub chain writes.
  • PLATFORM_FEE_BPS sets platform fee.
  • Auth via wallet-sign (AuthGate) and /auth/refresh; uses httpOnly cookies (ax_token, ax_refresh).

API Surface (high level)

  • POST /agent/:id/invoke — unified entry, returns 402 when unpaid.
  • GET /api/v1/invocations — recent calls with paymentTxHash, receiptTxHash, requestPayload.
  • GET /api/healthz — DB/RPC/OPENAI health.
  • Webhooks (configurable): payment_paid, invoke_succeeded, invoke_failed, budget_exceeded.
  • Auth: Bearer or ax_token cookie; wallet-sign login via AuthGate.

For request/response schemas see doc/API.md.


Marketplace & Console Highlights

  • Search/filter/sort by price, token, category, score, revenue, success rate.
  • Agent detail: sample I/O, pricing, chain info, recent receipts, one-click trial.
  • Debugger: JSON editor, 402 pay UI, auto-retry, latency/tx display, cURL copy.
  • Analytics: Calls, revenue, success rate, P99; CSV export; budgets; payouts with state machine.

Security & Ops

  • On-chain keys kept out of repo; optional HSM for hosted wallets.
  • Health checks & multi-instance friendly gateway; RPC backups.
  • Budgets and blocklists at Org/Agent level; anomaly alerts (failure spikes, revenue spikes).

Roadmap (snapshot)

  • V0.5: Story testnet, Identity + Receipt minimal, x402 loop, demo agents.
  • V1.0: Console create/price, dashboard, marketplace, payouts (testnet).
  • V1.5: Multi-chain/multi-token, reputation weighting, admin/risk.
  • V2.0: White-label / private deploy, compliance/audit, deep SDK integrations.

Contributing

We welcome PRs. Run lint/tests locally; keep changes minimal and include E2E when touching payments or identity. See CONTRIBUTING.md and AGENT.md for house rules.


License

MIT — see LICENCE.


About

Stripe for AI Agents + Agent LinkedIn on-chain Bring x402 micro-payments and ERC-8004 identity/receipts to any agent in minutes.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published