Skip to content
Β 
Β 

Latest commit

Β 

History

125 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

StellarAgent πŸ€–βš‘

AI Agent Payment Rails built on the Stellar blockchain.
The fastest, cheapest way to give AI agents autonomous payment capabilities.

CI License: MIT Stellar Soroban PRs Welcome Discord


Why StellarAgent?

AI agents need money. Today, giving an agent a wallet means dealing with:

  • πŸ”΄ Ethereum gas fees that cost more than the payment itself
  • πŸ”΄ Slow finality that breaks real-time workflows
  • πŸ”΄ No spend controls β€” agents can drain wallets
  • πŸ”΄ No audit trail for compliance

StellarAgent fixes all of this. Stellar's 2.5s finality and near-zero fees mean an agent can pay $0.001 per API call without the fee eating the payment. Our Soroban contracts add spend limits, escrow, and full audit trails on top.


What's Inside

stellaragent/
β”œβ”€β”€ contracts/        # Soroban smart contracts (Rust)
β”‚   β”œβ”€β”€ agent_wallet_factory/
β”‚   β”œβ”€β”€ payment_channel/
β”‚   β”œβ”€β”€ escrow/
β”‚   β”œβ”€β”€ rate_limiter/
β”‚   β”œβ”€β”€ circuit_breaker/
β”‚   β”œβ”€β”€ price_oracle/
β”‚   └── amm_swap/
β”œβ”€β”€ packages/
β”‚   β”œβ”€β”€ core/         # @stellaragent/core β€” the TypeScript SDK
β”‚   β”œβ”€β”€ react/        # @stellaragent/react β€” hooks
β”‚   β”œβ”€β”€ indexer/      # Audit ledger, reports, exports, delivery
β”‚   └── cli/          # @stellaragent/cli
β”œβ”€β”€ python/           # stellaragent β€” the Python SDK
β”œβ”€β”€ services/
β”‚   └── signer/       # stellaragent-signer β€” the remote signing service
β”œβ”€β”€ dashboard/        # React + Tailwind business dashboard
β”œβ”€β”€ fixtures/         # Shared TS ↔ Python ↔ Rust determinism fixtures
β”œβ”€β”€ scripts/          # Deployment and fixture tooling
β”œβ”€β”€ zk/               # Solvency-proof circuits (Rust)
└── docs/             # Documentation

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   Your AI Agent                      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                       β”‚ stellaragent SDK
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              SDK Layer (TypeScript/Python)            β”‚
β”‚  createAgentWallet() β”‚ payForAPI() β”‚ requestWork()   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                       β”‚ Soroban RPC
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚           Soroban Smart Contracts (Rust)              β”‚
β”‚  AgentWalletFactory β”‚ PaymentChannel β”‚ Escrow        β”‚
β”‚  RateLimiter        β”‚ AuditLog                       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                       β”‚ Stellar Network
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              Stellar Blockchain                       β”‚
β”‚         USDC Β· XLM Β· 2.5s finality Β· ~$0             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Quick Start

SDK (TypeScript)

npm install @stellaragent/sdk
import { StellarAgent } from '@stellaragent/sdk';

const agent = await StellarAgent.create({
  network: 'testnet',
});

await agent.createAgentWallet('research-agent');
await agent.openChannel({
  token: 'XLM',
  deposit: '10',
  limitPerPeriod: '5',
  period: 'hourly',
});

// Pay for an API call
await agent.payForAPI({
  endpoint: 'https://api.example.com/inference',
  recipient: 'G...API_PROVIDER_ADDRESS',
  amount: '0.001',
  asset: 'XLM',
});

// Agent-to-agent escrow job
const job = await agent.requestWork({
  workerAgent: 'G...AGENT_ADDRESS',
  task: 'Summarize this document',
  escrowAmount: '0.05',
  asset: 'XLM',
});

Agents can also pay from the channel asset while the recipient receives a different asset. Configure AMM/path-payment providers, call agent.quote() to preview the deterministic route and cost, then pass that quote unchanged to payForAPI(). Multi-hop execution is atomic and the TypeScript/Python selector is verified against shared fixtures. See the multi-asset routing guide.

Contract IDs must be configured through contracts or the STELLARAGENT_<NETWORK>_* environment variables described in the deployment guide. Friendly non-XLM asset codes also need an assetContracts mapping to their deployed Stellar Asset Contract ID.

Production: keep the key out of the agent process

Holding a raw secret in a long-lived process is a real risk once an agent has funds. Pass a signer instead β€” the key stays behind a network boundary and never enters this process:

import { StellarAgent, RemoteSigner } from '@stellaragent/sdk';

const agent = await StellarAgent.create({
  network: 'mainnet',
  signer: new RemoteSigner({
    url: 'https://signer.internal',
    token: process.env.SIGNER_TOKEN,
    expectedPublicKey: process.env.AGENT_ADDRESS,
  }),
});

agent.holdsSecretKey; // false

See docs/signing.md for the protocol, the hardware-wallet adapter, and why a signing service rather than Ledger.

Full API reference (generated from the SDKs' own TSDoc comments, pnpm docs:api): docs/api. For how @stellaragent/core is put together and where new code belongs, see docs/architecture/core-modules.md.

SDK (Python)

pip install stellaragent
from stellaragent import StellarAgent, SpendLimit, PayForAPIParams

agent = StellarAgent.create(
    network="testnet",
    spend_limit=SpendLimit(amount="10", asset="USDC", period="hourly"),
)

agent.pay_for_api(
    PayForAPIParams(
        endpoint="https://api.example.com/inference",
        amount="0.001",
        asset="USDC",
    )
)

The Python SDK's deterministic math is a strict semantic port of the TypeScript one β€” both are verified byte-identical against 643 shared fixtures as a required CI check, so a mixed TS/Python agent fleet cannot disagree about a bid score. See python/README.md.

Signing service

An agent with real funds should not hold a raw secret. services/signer is the server side of the RemoteSigner protocol the SDKs already speak β€” KMS-backed, policy-enforcing, and audited:

cd services/signer
cargo run -- issue-token                       # a credential
cargo run -- check --config config.toml        # validate before binding a port
cargo run -- serve --config config.toml
const agent = await StellarAgent.create({
  network: 'testnet',
  signer: new RemoteSigner({ url: 'https://signer.internal', token: process.env.SIGNER_TOKEN }),
});
agent.holdsSecretKey;  // false

It decodes every envelope before signing it, refuses anything it cannot fully understand, enforces per-key spend caps and allowlists, and writes a hash-chained audit record for every request β€” granted or refused. Runbook and threat model: docs/signer-deployment.md.

Contracts (Rust/Soroban)

There are seven contracts, and four of them need initializing in a specific order before three others can be wired to them β€” so deploy them with the script rather than by hand:

pnpm deploy:contracts --network testnet --source alice

It builds every WASM, deploys, initializes, cross-wires, and writes deployments/testnet.json plus a matching .env block. Full runbook: docs/deployment.md.

Solvency proofs (Rust)

A PaymentChannel owner can prove, without revealing individual payments, that a private payment history is a valid explanation for the channel's public limit_per_period and total_spent. The PaymentChannel contract verifies that proof on-chain through Soroban's native BLS12-381 pairing_check host function.

cd zk && cargo build --release --bin solvency-prover
./target/release/solvency-prover setup --out-dir ./keys
./target/release/solvency-prover prove --pk ./keys/pk.bin --history history.json \
    --limit 500000 --total 750000 --out proof.json
./target/release/solvency-prover verify --vk ./keys/vk.bin --proof proof.json

Step-by-step walkthrough, including the on-chain set_solvency_vk and verify_solvency_proof invocations and measured timings: docs/zk-solvency-walkthrough.md. Design and threat model: docs/zk-solvency-design.md.

Dashboard

cd dashboard
npm install
npm run dev

The Reports view builds agent/owner statements, attaches exact on-chain balance reconciliation, streams CSV/JSON Lines/IIF, drills to transaction proof, and administers schedules/dead letters. See the explicit proof limits, deployment, verification, and recovery guide in docs/audit-trail.md.

The Rate Limits view reads live on-chain ceilings through the useRateLimitStatus hook: per-transaction, hourly, daily, and hourly transaction-count limits with exact headroom, an estimate of when each rolling window resets, and a local "would this payment go through?" check. It needs contract addresses at build time:

VITE_STELLAR_NETWORK=testnet \
VITE_CONTRACT_RATE_LIMITER=C... \
VITE_CONTRACT_PAYMENT_CHANNEL=C... \
npm run build

Without them the page says so instead of showing zeros. See dashboard/src/lib/agentRuntime.tsx.


Roadmap

  • Project scaffolding & architecture
  • AgentWalletFactory Soroban contract
  • PaymentChannel Soroban contract
  • Escrow Soroban contract
  • RateLimiter Soroban contract
  • TypeScript SDK core
  • Python SDK
  • Rust SDK
  • Business dashboard (React + Tailwind)
  • Stellar Community Fund grant application
  • Mainnet deployment

Contributing

We welcome contributors! See CONTRIBUTING.md for how to get started.

Good first issues are labeled good first issue.


License

MIT Β© StellarAgent Contributors

Releases

Packages

Contributors

Languages