@vite-hub/agent
v0.0.1
Published
Agent DX layer and Vite/Nitro integration for ViteHub.
Downloads
76
Maintainers
Readme
@vite-hub/agent
@vite-hub/agent defines model-backed agents from files such as server/agents/support/config.ts.
Keep the three pieces separate:
- AI package: the AI SDK model and streaming runtime.
- 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/workspace aiAdd the AI SDK model provider you pass to model.
Minimal API
// server/agents/support/config.ts
import { gateway } from "@ai-sdk/gateway"
import { defineAgent } from "@vite-hub/agent"
import { chat, workspaceShell } from "@vite-hub/agent/capabilities"
import { source } from "@vite-hub/workspace"
export default defineAgent({
model: gateway("openai/gpt-5.1-mini"),
instructions: "Answer support questions from the workspace.",
capabilities: [chat(), workspaceShell()],
workspace: {
sources: {
support: source.file("support.md"),
},
},
})// vite.config.ts
import { hubAgent } from "@vite-hub/agent/vite"
import { hubWorkspace } from "@vite-hub/workspace/vite"
import { nitro } from "nitro/vite"
import { defineConfig } from "vite"
export default defineConfig({
plugins: [hubWorkspace(), hubAgent(), nitro()],
})// nitro.config.ts
import { defineNitroConfig } from "nitro/config"
export default defineNitroConfig({
modules: ["@vite-hub/workspace/nitro", "@vite-hub/agent/nitro"],
})Capabilities
chat()exposes the agent as a chat surface; see the AI agent tutorial.workspaceShell()runs scoped shell/file work through@vite-hub/shell.webSearch()searches and reads the web with Brave, Exa, Jina, SearXNG, SerpApi, SerpBase, or Tavily.transcribe()uses the AI SDK transcription API.mcp()connects tools from Model Context Protocol servers through@ai-sdk/mcp.kv(),blob(), anddb()expose@vite-hub/kv,@vite-hub/blob, and@vite-hub/database.sandbox()andschedule()expose@vite-hub/sandboxand@vite-hub/schedule.skills(),access(),memory(),fetch(),llmRoute(),llmGate(), andusageTelemetry()cover prompt skills, workspace scope, durable notes, HTTP reads, pre-run decisions, and usage reporting.
Built on
Vite discovers agent files for local development. Nitro mounts the generated agent routes. Model execution uses AI SDK; provider tools stay capability-scoped instead of becoming one global agent config.
Learn more at vitehub.dev.
