Skip to main content
General

Quickstart

Set up the server, deploy an AI-generated app, and visit it.

View the complete Quickstart example on GitHub.

Install

npm add @rivet-dev/agentos @rivet-dev/agentos-apps
npm add @hono/node-server hono
npm add --save-dev tsx
npm pkg set type=module

Setup the server

Setup the HTTP server that will serve requests for AI-generated apps. Also set up the actors that power the deployments.

Run the server:

npx tsx src/server.ts

Deploy an AI-generated app

Pass generated files directly to deployApp(). This can be called by an agent, an upload endpoint, or any other part of your system:

import { deployApp } from "@rivet-dev/agentos-apps";

// An agent, upload endpoint, or any other part of the system can call
// deployApp() with the files it generated.
await deployApp({
	appId: "hello-world",
	files: {
		"package.json": JSON.stringify({
			name: "hello-world-app",
			version: "0.0.0",
			private: true,
			type: "module",
			main: "src/index.ts",
			dependencies: {
				hono: "^4.12.9",
			},
		}),
		"src/index.ts": `
import { Hono } from "hono";

const app = new Hono();

// Serve the application's frontend.
app.get("/", (c) => c.html("<h1>Hello from agentOS Apps</h1>"));

// Serve a REST API request from the same application.
app.get("/api/hello", (c) => c.json({ message: "Hello from agentOS Apps" }));

export default app;
`,
	},
});
npx tsx src/deploy.ts

Visit the AI-generated app

Open http://localhost:3000/apps/hello-world/. Pass this URL to agents, frontends, or any other part of your system that needs to visit the deployment.

Deploy

By default, Rivet stores actor state on the local file system.

To scale Rivet in production, pick how much of it you want to run yourself:

If you are running your own workers, follow the guide for your hosting provider: