@vite-hub/agent has 3,695 recorded weekly downloads on npm, an increase of 86.1% over the past 30 days, ranking #1657 of 3,247 tracked listings.
About @vite-hub/agent
@vite-hub/agent
<p> <a href="https://vitehub.dev"><img alt="ViteHub" src="https://img.shields.io/static/v1?label=ViteHub&message=vitehub.dev&color=blue"></a> <img alt="TypeScript" src="https://img.shields.io/static/v1?label=TypeScript&message=ready&color=blue"> <img alt="AI SDK" src="https://img.shields.io/static/v1?label=AI+SDK&message=v7&color=blue"> </p>@vite-hub/agent defines Agents from files such as server/agents/support/agent.ts. Each Agent selects one Driver: an AI SDK model, a built-in coding provider, typed TypeSafe Jev questions, application-owned driver.run logic, or driver: "external" for an Agent that a process outside the app runs.
Keep the three pieces separate:
- Agent Driver: the model, coding provider, or application-owned function that runs the Agent.
- Capabilities: opt-in abilities such as chat, shell, search, storage, sandbox, and MCP tools.
- Workspace: file-system context the agent can inspect, reason from, and optionally update while doing a task.
Install
pnpm add @vite-hub/agent @vite-hub/env @vite-hub/workspace ai
ai is required for model-backed drivers and AI SDK-powered capabilities such as model-backed title() and transcribe(). Agents with driver.run can bundle without installing ai.
driver.ask requires the optional peer advocaat. ViteHub imports it only when an ask Driver runs. When the application does not install it, the Agent Vite plugin keeps the import external, so other Agents still build.
Add the AI SDK model provider you pass to model.
The codexDriver() and claudeCodeDriver() drivers use ViteHub's pinned T3 provider runtime. Install only the provider packages an Agent uses:
pnpm add @openai/codex@0.169.0
pnpm add @anthropic-ai/claude-agent-sdk@0.3.321
ViteHub resolves those project dependencies directly. Production self-hosted Node builds on macOS and Linux copy only the build host's native payload, including the Linux libc variant, so build on the same host type used for deployment. Without @openai/codex, the Codex Driver keeps using codex from the host PATH. The Claude Code Driver requires the Agent SDK; when its native package is unavailable at runtime, ViteHub leaves T3's host claude command fallback unchanged. Claude Code credentials and Codex credentials without an explicit driver.credentials resolver must be available to the host process.
The published Agent bundles ViteHub's pinned T3 provider runtime, so consumers do not need to install that runtime or change pnpm's exotic dependency settings.
CLI discovery loads the application Vite config without registering the development invocation route. Middleware stages behave the same way. Normal vite dev keeps the development endpoint. The generated registry also handles the first SSR import cycle through Agent server internals.
The Vite integration requires Vite 8. Configure build inputs, output options, and external dependencies under build.rolldownOptions.
Minimal API
// server/agents/support/agent.ts
import { defineAgent } from "@vite-hub/agent"
import { workspaceShell } from "@vite-hub/agent/capabilities"
import { webChat } from "@vite-hub/agent/channels"
import { file } from "@vite-hub/workspace"
export default defineAgent({
driver: {
model: "openai/gpt-5.1-mini",
instructions: [
"Answer support questions from the workspace.",
"Use the support Source for support policies and known answers.",
],
},
channels: {
web: webChat(),
},
capabilities: [workspaceShell()],
workspace: {
sources: {
support: file({
path: "support.md",
}),
},
},
});
Each channels value is a Channel definition, such as webChat(), or a factory that returns one. A plain options object under a built-in name, such as telegram: { ... }, throws AGENT_R0425. defineAgent() does not import the built-in Channels, so the server bundle contains only the Channels and chat adapters that the Agent imports.
Typed questions
driver.ask answers typed questions with TypeSafe Jev. Questions are sent in deterministic sequential batches when their combined request would exceed the provider budget; an empty question map skips Jev. For each question, the serialized shared state plus that question and request overhead must fit below 30,000 bytes, otherwise the Invocation fails. The answers are the Invocation output, and runAgent() infers the type of result.output from the questions:
// server/agents/labeller.ts
import { defineAgent } from "@vite-hub/agent";
import { ask } from "@vite-hub/gateways";
export default defineAgent({
driver: {
ask: {
label: ask.choice("Which label fits this email?", { invoice: "Bills and receipts.", none: "No label fits." }),
urgent: ask.if("Does it need action today?"),
},
},
});
Jev requests go through the AI gateway in driver.gateway, or through typesafe() from @vite-hub/gateways, which reads TYPESAFE_API_KEY. The gateway retries 408, 429, and 5xx provider answers and network failures. A rejected key fails with GATEWAYS_R0008 and status 503, and a provider that still fails after three attempts with GATEWAYS_R0009 and status 502. A driver.gateway without ask(), such as cliproxy(), fails at definition time with AGENT_R1013.
Jev reads Invocation data when a caller sets it, else the prompt text, else the latest user message. ask.choice(), ask.switch(), ask.score(), ask.chance(), and ask.if() return plain question objects. driver.ask also accepts a function that returns the questions for each Invocation.
ask.if() accepts a finite threshold from 0 to 1, inclusive. It defaults to 0.5.…
Description from the npm listing.
- agent
- agent-harness
- ai
- ai-agents
- ai-sdk
- cloudflare
- coding-agent
- llm
- typescript
- vercel
- vite
- vitehub
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (142)Similar npm AI SDKs plugins
All 20 @vite-hub/agent alternativesData source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/@vite-hub/agent. First seen Nov 9, 2026; last successful collection Dec 6, 2026. See the methodology.