tanstack

The TanStack adapter integrates agents with TanStack Start for file-based routing and React UI support.

Installation

bun add @regent/tanstack @tanstack/react-start

Basic Usage

import { createAgent } from '@regent/core';
import { http } from '@regent/http';
import { createTanStackRuntime } from '@regent/tanstack';

const agent = await createAgent({
  name: 'my-agent',
  version: '1.0.0',
})
  .use(http())
  .build();

const { runtime, handlers } = await createTanStackRuntime(agent);

API Reference

createTanStackRuntime()

Creates a TanStack-compatible runtime from an AgentRuntime.

TanStackRuntime

Available Handlers

Route Setup

Route Structure

File-Based Route Example

Payment Middleware

createTanStackPaywall()

Creates payment middleware for agent entrypoints.

Options

Return Value

Usage

paymentMiddleware()

Low-level payment middleware:

Supported Networks

EVM Networks

  • ethereum, base, optimism, arbitrum, polygon

  • ethereum-sepolia, base-sepolia, optimism-sepolia, arbitrum-sepolia, polygon-amoy

Solana Networks

  • solana, solana-devnet

Integration Example

Exports

Last updated