Build Configuration — Agentuity Documentation

Build Configuration

Customize the build process with Vite plugins and build-time constants

Customize how your project is built using vite.config.ts in your project root. Add Vite plugins for frontend builds or define build-time constants.

Basic Configuration

import { defineConfig } from 'vite';
 
export default defineConfig({
  // Configuration options here
});

Configuration Options

plugins

Add Vite plugins for frontend builds (src/web/). The CLI passes your vite.config.ts to Vite directly. If the file is missing, the CLI writes a React fallback config for older projects.

import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import tailwindcss from '@tailwindcss/vite';
 
export default defineConfig({
  plugins: [react(), tailwindcss()],
});

See the Vite plugin documentation for available plugins.

define

Replace identifiers with constant values at build time. Values must be JSON-stringified.

import { defineConfig } from 'vite';
 
export default defineConfig({
  define: {
    'API_VERSION': JSON.stringify('v2'),
    '__DEV__': JSON.stringify(false),
  },
});

Environment Variables

Vite exposes VITE_* variables to frontend code by default. Agentuity's dev server and generated environment types also recognize these public prefixes:

PrefixDescription
VITE_*Standard Vite convention
AGENTUITY_PUBLIC_*Agentuity convention
PUBLIC_*Short form

For deployed frontend builds, add envPrefix if you want to expose AGENTUITY_PUBLIC_* or PUBLIC_* variables:

import { defineConfig } from 'vite';
 
export default defineConfig({
  envPrefix: ['VITE_', 'AGENTUITY_PUBLIC_', 'PUBLIC_'],
});
// .env.local
AGENTUITY_PUBLIC_API_URL=https://api.example.com
 
// src/web/App.tsx
const apiUrl = import.meta.env.AGENTUITY_PUBLIC_API_URL;

Build Architecture

Agentuity uses a hybrid build system:

ComponentToolOutput
Frontend (src/web/)Vite.agentuity/client/
Server (agents, routes)Bun.agentuity/app.js

This separation allows Vite's optimizations for frontend (HMR, tree-shaking, CSS processing) while using Bun's fast bundling for server code.

For details on how these components interact during development, see Dev Server Architecture.

Full Example

typescriptvite.config.ts
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import tailwindcss from '@tailwindcss/vite';
 
export default defineConfig({
  // Vite plugins for frontend
  plugins: [react(), tailwindcss()],
 
  envPrefix: ['VITE_', 'AGENTUITY_PUBLIC_', 'PUBLIC_'],
 
  // Build-time constants
  define: {
    'APP_VERSION': JSON.stringify('1.0.0'),
  },
});

Next Steps