Skip to content

Repository files navigation

ViteHub

Portable Agents. Server Primitives for any host.

Documentation · Installation · Agents · Server primitives

ViteHub is one platform with two product lanes. ViteHub Agents defines, invokes, and deploys server-side Agents. ViteHub Server Primitives provide ordinary Vite applications with portable state and work across hosts.

Choose a product lane

Agents

Agents are named server-side actors. Each Agent Definition picks an Agent Driver, receives Agent Invocations, can read explicit Workspace context, and gains abilities through Capabilities. Start with your first Agent.

Server Primitives

Server Primitives give app code stable Runtime Helpers for auth, environment values, storage, queues, workflows, schedules, sandboxes, workspace files, and Provider Output. They work without an Agent Definition. Start with your first Server Primitive.

Agents may compose Server Primitives. Server Primitives never require Agents.

Installation

Install the framework distribution for the normal application path. It keeps one direct ViteHub dependency while preserving feature boundaries through intentional subpaths.

pnpm add vite-hub

Register the Vite Integration.

import { vitehub } from "vite-hub";
import { defineConfig } from "vite";

export default defineConfig({
  plugins: [
    vitehub({ preset: "node" }),
  ],
});

For model-backed agents, add a model provider such as AI Gateway.

pnpm add @ai-sdk/gateway

Requirements: Node 24 or newer, Vite 8 or newer, and a server app with vite.config.ts.

First Agent

Create an Agent Definition.

import { gateway } from "@ai-sdk/gateway";
import { defineAgent } from "vite-hub/agent";

export default defineAgent({
  driver: {
    model: gateway("openai/gpt-5.1-mini"),
    instructions: "Answer support questions with short, concrete replies.",
  },
});

Run it from server code.

import { runAgent } from "vite-hub/agent";
import support from "../agents/support";

export default defineEventHandler(async (event) => {
  const body = await readBody<{ prompt: string }>(event);

  return runAgent(support, { runtime: "vite" }, {
    prompt: body.prompt,
  });
});

Add Capabilities only when the Agent needs controlled access to tools, storage, Workspace files, chat, product events, or external systems.

How Agents Work

  • An Agent Definition declares one Agent and its Agent Driver.
  • An Agent Driver decides how an Agent Invocation runs: model-backed, harness-backed, or custom-run-backed.
  • An Agent Invocation is one runtime request to an Agent.
  • Capabilities attach named abilities. They contribute tools, instructions, triggers, policies, or runtime context.
  • A Workspace gives an Agent explicit file-tree state. Sources place read-only context into that Workspace.
  • ViteHub discovers definitions, generates Runtime Registries, and prepares Provider Output through Vite Integrations.

Server code can call primitives directly. Agents do not receive every primitive by default; attach a Capability when the model should use one.

Server Primitives

Server primitives are useful with or without Agents.

Need Start with
Environment values and secrets vite-hub/env
Auth and sessions vite-hub/auth
Small key-addressed state vite-hub/kv
Relational data vite-hub/database
Uploads and generated assets vite-hub/blob
File-tree state and Sources vite-hub/workspace
Background delivery vite-hub/queue
Durable long-running work vite-hub/workflow
Future or recurring work vite-hub/schedule
Isolated execution vite-hub/sandbox

Each package owns its Runtime Helpers and Vite Integration. Host-specific wiring stays behind ViteHub Provider Output, so app code can use stable imports instead of provider SDK plumbing.

Libraries and focused integrations can depend on any @vite-hub/* owner package directly.

Learn More

Development

This repo uses Node 24, pnpm, and Vite+. Run vp run verify for the full local gate. Package scripts own package-local test, build, and typecheck behavior.

About

Agents for any host, composed with server primitives through one Vite plugin.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages