GitHub 37
Skip to content
ViteHub is still experimental. Expect bugs and breaking changes.

Agents

Define an AI agent in one file, give it files and tools, and reach it from chat, Slack, or GitHub.

Deploys on
  • Node
  • Docker
  • Cloudflare
  • Vercel
  • Netlify
  • Deno

For a single model call without tools, such as a summary or fields read from text, you do not need an Agent. Call ask(prompt, { model, schema }) from AI Gateways to get data checked against your schema.

An Agent Definition picks a Driver to do the work, and an Invocation runs it with one input. This example needs no model or credentials:

import { defineAgent, runAgent } from 'vite-hub/agent'

const greeting = defineAgent({
  runtime: false,
  driver: {
    run({ prompt }) {
      const name = typeof prompt === 'string' ? prompt : 'friend'
      return { text: `Hello, ${name}!` }
    },
  },
})

const [error, result] = await runAgent(greeting, { prompt: 'Ada' })
if (error) throw error
console.log(result.text) // 'Hello, Ada!'
ts

runAgent() returns an [error, result] tuple. See Invocations for model output, provider Drivers, and streaming.

  1. Define an Agent and choose its Driver.
  2. Run or stream an Invocation.
  3. Write instructions and attach tools through Capabilities.
  4. Select Chat History and add Workspace context.
  5. Connect a Channel for messages from another service or web chat.
  6. Inspect events, test contracts, and evaluate model behavior.

Then share configuration with presets and inheritance and keep run records with Invocation storage. Ready-made presets give full workflows, each with its own setup.

Choose what does the work

Run an AI model, Codex, Claude Code, or your own function. Your routes call the Agent the same way.

Give it only the tools you choose

An Agent cannot use a server feature until you add a tool for it. Built-in tools cover web search, memory, and MCP servers.

Let it read your files

Give it a folder from your project or GitHub. You choose whether the Agent can only read or also write.

Talk to it where people already are

Connect web chat, Slack, Discord, Telegram, Teams, GitHub, or an HTTP route.

Call it like a function

runAgent() runs the Agent and returns its result. The ViteHub Console shows what happened in each run.

Start from a ready-made agent

Babysitter fixes pull requests, and the Workspace preset answers from your files with links. Add your settings and run it.