Use Cases

Built for the Agent Economy

See how Kontext powers compliant agentic transactions across stablecoin payments, micropayment protocols, commerce platforms, and cross-chain transfers.

Primary

USDC Payments

Agents making USDC transfers on Base and Ethereum with full compliance and audit trails. The most common Kontext use case -- verify every stablecoin movement your agents make.

  • Immutable audit trail for every USDC transfer with cryptographic linking
  • Real-time anomaly detection -- velocity checks, amount thresholds, recipient analysis
  • GENIUS Act readiness with exportable compliance reports (JSON, CSV, PDF)
  • Trust scoring per transaction based on agent history and behavioral analysis
usdc-agent.tstypescript
import { Kontext } from 'kontext-sdk';

const ctx = new Kontext({ chain: 'base' });

// Log the USDC transfer for audit
await ctx.logTransaction({
  action: 'usdc_transfer',
  amount: '2500.00',
  currency: 'USDC',
  from: '0xAgent...abc',
  to: '0xVendor...def',
  agent: 'payment-agent-v2',
});

// Check compliance before execution
const compliance = await ctx.checkUsdcCompliance({
  amount: '2500.00',
  recipient: '0xVendor...def',
  chain: 'base',
});

if (compliance.approved) {
  // Proceed with on-chain transfer
  console.log('Trust score:', compliance.trustScore); // 0.96
  console.log('Audit ID:', compliance.auditId);
}
Protocol

x402 Protocol

HTTP-native micropayments where agents pay per-request. Kontext wraps x402 flows with compliance verification so every micropayment is logged and scored.

  • Per-request billing verification -- every micropayment logged and scored
  • Automated payment verification middleware that drops into any HTTP stack
  • Fraud detection across high-frequency micropayment streams
  • Audit trail linking payments to specific API resources and methods
x402-middleware.tstypescript
import { Kontext } from 'kontext-sdk';

const ctx = new Kontext();

// x402 middleware -- verify every micropayment
export function x402KontextMiddleware(handler) {
  return async (req, res) => {
    const payment = req.headers['x-402-payment'];

    if (payment) {
      const result = await ctx.verify({
        action: 'x402_payment',
        amount: payment.amount,
        currency: payment.currency,
        from: payment.payer,
        agent: payment.agent || 'unknown',
        metadata: {
          resource: req.url,
          method: req.method,
        },
      });

      if (result.flagged) {
        return res.status(402).json({
          error: 'Payment flagged for review',
          flags: result.flags,
        });
      }

      req.kontextResult = result;
    }

    return handler(req, res);
  };
}
Commerce

Stripe Agentic Commerce

Agents initiating Stripe payment intents with Kontext verification. The audit ID is embedded in Stripe metadata for end-to-end traceability between compliance logs and payment records.

  • Chargeback prevention -- verify agent identity and intent before payment creation
  • Full agent transaction audit trail linked to Stripe payment intent metadata
  • Trust scoring gates payment creation -- block low-trust agents automatically
  • Compliance-ready records mapping Kontext audit IDs to Stripe payment IDs
stripe-agent.tstypescript
import { Kontext } from 'kontext-sdk';
import Stripe from 'stripe';

const ctx = new Kontext();
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY);

async function handleAgentPayment(agentId: string, amount: number) {
  // Verify with Kontext before creating payment intent
  const result = await ctx.verify({
    action: 'stripe_payment',
    amount: String(amount / 100),
    currency: 'USD',
    agent: agentId,
    metadata: { provider: 'stripe', type: 'payment_intent' },
  });

  if (result.flagged) {
    throw new Error('Payment flagged for compliance review');
  }

  // Create Stripe payment intent with Kontext audit metadata
  const intent = await stripe.paymentIntents.create({
    amount,
    currency: 'usd',
    metadata: {
      kontext_audit_id: result.auditId,
      kontext_trust_score: String(result.trustScore),
      agent_id: agentId,
    },
  });

  return intent;
}
A2A

Google UCP / A2A

Agent-to-agent commerce via Google's Universal Checkout Protocol. Kontext provides trust scoring for A2A transactions so agents can verify each other before transacting.

  • Trust scoring for agent-to-agent transactions -- verify counterparty agents
  • Cross-agent audit trails linking both sides of an A2A transaction
  • UCP session tracking with full metadata preservation in the audit log
  • Anomaly detection tuned for multi-agent commerce patterns
ucp-agent.tstypescript
import { Kontext } from 'kontext-sdk';

const ctx = new Kontext();

// Google UCP / A2A -- verify agent-to-agent transactions
async function handleUcpTransaction(ucpPayload) {
  const result = await ctx.verify({
    action: 'ucp_transaction',
    amount: ucpPayload.amount,
    currency: ucpPayload.currency,
    agent: ucpPayload.agentId,
    metadata: {
      ucpSessionId: ucpPayload.sessionId,
      merchantId: ucpPayload.merchantId,
      counterpartyAgent: ucpPayload.counterpartyAgentId,
      items: ucpPayload.lineItems,
    },
  });

  return {
    approved: !result.flagged,
    trustScore: result.trustScore,
    auditId: result.auditId,
    crossAgentTrail: result.metadata.crossAgentAuditLink,
  };
}
Cross-Chain

Cross-Chain Transfers (CCTP)

USDC transfers across chains via Circle's Cross-Chain Transfer Protocol. Kontext tracks the full burn-attest-mint lifecycle with linked audit entries across source and destination chains.

  • Cross-chain audit linking -- a single audit trail spanning source and destination chains
  • Attestation tracking with status logging at each CCTP lifecycle stage
  • Pre-transfer compliance checks before initiating the burn on the source chain
  • Unified reporting across Ethereum, Base, and other supported CCTP chains
cctp-manager.tstypescript
import { Kontext } from 'kontext-sdk';

const ctx = new Kontext();

// CCTP cross-chain USDC transfer with full audit lifecycle
class CCTPTransferManager {
  async initiateTransfer(from: string, to: string, amount: string) {
    // 1. Pre-transfer verification
    const preCheck = await ctx.verify({
      action: 'cctp_initiate',
      amount,
      currency: 'USDC',
      agent: 'treasury-agent',
      metadata: {
        sourceChain: 'ethereum',
        destChain: 'base',
        from,
        to,
      },
    });

    if (preCheck.flagged) {
      throw new Error('Cross-chain transfer flagged');
    }

    // 2. Burn on source chain (your CCTP logic here)
    const burnTxHash = '0xburn...abc';

    // 3. Log attestation wait
    await ctx.log({
      action: 'cctp_awaiting_attestation',
      metadata: {
        burnTxHash,
        auditId: preCheck.auditId,
      },
    });

    // 4. Mint on destination chain
    const mintTxHash = '0xmint...def';

    // 5. Link both chains in audit trail
    await ctx.log({
      action: 'cctp_complete',
      metadata: {
        burnTxHash,
        mintTxHash,
        sourceChain: 'ethereum',
        destChain: 'base',
        auditId: preCheck.auditId,
      },
    });
  }
}
Enterprise

Treasury Management

AI agents managing corporate treasury operations with human-in-the-loop approval for high-value transfers. Define policies declaratively and Kontext enforces them automatically.

  • Human-in-the-loop approval for transfers exceeding configurable thresholds
  • Risk scoring based on amount, purpose, department, and agent history
  • Multi-channel notifications (Slack, email) for pending approvals
  • Department-level budget enforcement with real-time spend tracking
treasury-agent.tstypescript
import { Kontext } from 'kontext-sdk';

const ctx = new Kontext({ apiKey: process.env.KONTEXT_KEY });

// Treasury policy: require human confirmation for large transfers
ctx.setPolicy({
  requireConfirmation: {
    when: [
      { field: 'amount', operator: 'gt', value: '50000' },
      { field: 'action', operator: 'eq', value: 'treasury_transfer' },
    ],
    timeout: 600_000, // 10 minute timeout
    fallback: 'deny',
    notifyChannels: ['slack', 'email'],
  },
});

async function executeTreasuryTransfer(params) {
  const result = await ctx.verify({
    action: 'treasury_transfer',
    amount: params.amount,
    currency: 'USDC',
    agent: 'treasury-manager-v3',
    metadata: {
      purpose: params.purpose,
      approvedBudget: params.budget,
      department: params.department,
    },
  });

  if (result.pendingConfirmation) {
    console.log('Awaiting CFO approval...');
    console.log('Approval URL:', result.confirmationUrl);
    // Resolves when approved or times out
  }

  console.log('Risk score:', result.riskScore);
  console.log('Trust score:', result.trustScore);
}

Ready to add compliance to your agents?

Install the SDK and start logging agent transactions in under 5 minutes. Open source and free to start.

$npm install kontext-sdk