Build/Frontend

Deployment Scenarios

Deploy your frontend alongside agents or separately on Vercel, Netlify, etc.

Choose where your frontend lives based on your project needs.

All-in-One Deployment

Put your frontend code in src/web/ and deploy everything together:

my-project/
├── src/
│   ├── agent/
│   │   └── chat/
│   │       └── agent.ts
│   ├── api/
│   │   └── index.ts
│   └── web/
│       ├── App.tsx
│       ├── frontend.tsx
│       └── index.html
└── agentuity.json

When you run agentuity deploy, both your agents and frontend are bundled and deployed together.

// src/web/App.tsx
import { AgentuityProvider, useAPI } from '@agentuity/react';
 
function Chat() {
  const { invoke, data, isLoading } = useAPI('POST /api/chat');
  // ... your chat UI
}
 
export default function App() {
  return (
    <AgentuityProvider>
      <Chat />
    </AgentuityProvider>
  );
}

No baseUrl Needed

When frontend and agents are deployed together, you don't need to set baseUrl. The provider automatically connects to the same origin.

Best for:

  • New projects starting from scratch
  • Simple deployments with one codebase
  • Projects that don't need separate frontend scaling

Separate Frontend

Deploy your frontend on Vercel, Netlify, or any hosting platform while agents run on Agentuity:

Frontend (e.g., Vercel)                Agents (Agentuity)
┌───────────────────────┐           ┌───────────────────────┐
│     your-app.com      │ ────────► │    project.cloud      │
│     React/Next.js     │           │     Agent routes      │
└───────────────────────┘           └───────────────────────┘
// In your React app
import { AgentuityProvider, useAgent } from '@agentuity/react';
 
export default function App() {
  return (
    <AgentuityProvider baseUrl="https://your-project.agentuity.cloud">
      <YourApp />
    </AgentuityProvider>
  );
}

Best for:

  • Existing projects adding AI agents
  • Teams with separate frontend and backend deployments

CORS Configuration

When your frontend and agents are on different domains, configure CORS in app.ts:

// app.ts
import { createApp } from '@agentuity/runtime';
 
const { server, logger } = await createApp({
  cors: {
    origin: ['https://your-frontend.com', 'http://localhost:3000'],
    allowMethods: ['GET', 'POST', 'PUT', 'DELETE'],
    allowHeaders: ['Content-Type', 'Authorization'],
  },
});
 
logger.debug('Running %s', server.url);

Required for Cross-Origin

Without CORS configuration, browsers will block requests from your frontend to your agents when they're on different domains.

Comparison

AspectAll-in-OneSeparate Frontend
DeploymentSingle agentuity deployDeploy frontend and agents separately
ConfigurationMinimalRequires baseUrl and CORS
ScalingTied togetherIndependent scaling
Best forNew projectsExisting frontends

Next Steps

Need Help?

Join our DiscordCommunity for assistance or just to hang with other humans building agents.

Send us an email at hi@agentuity.com if you'd like to get in touch.

Please Follow us on

If you haven't already, please Signup for your free account now and start building your first agent!