ViteHub is still experimental. Expect bugs and breaking changes.

Capabilities

Understand how an Agent receives a selected ability.

A Capability gives an Agent a selected ability. It can add tools, instructions, requirements, policy, triggers, metadata, or invocation context.

Installing a Server Primitive does not give an Agent access to it. Attach a Capability when the Agent needs that operation.

Choose the API by its caller

Server PrimitiveCapability
CallerApplication server codeAn Agent during an Invocation
AccessA documented server importSelected tools, policy, requirements, or context
SelectionApplication code calls itThe Agent Definition or invocation selects it
Model accessNoneOnly the operations the Capability contributes

Select the abilities an Agent can use

server/agents/support.ts
import { defineAgent } from 'vite-hub/agent'
import { kv, workspaceShell } from 'vite-hub/agent/capabilities'

export default defineAgent({
  workspace: { mode: 'read' },
  capabilities: [
    workspaceShell({ mode: 'read' }),
    kv({ mode: 'read' }),
  ],
  driver: {
    run: ({ input }) => input,
  },
})

The Agent receives only what the selected Capabilities contribute. Application code can call the same Server Primitives through their server APIs.

Use a fixed or resolved list

Use an array when every invocation needs the same abilities. Use a resolver when trusted invocation data changes the list:

capabilities: ({ actor }) => [
  customerRecords,
  ...(actor.meta?.support === true ? [internalDiagnostics] : []),
],

ViteHub resolves the Agent Invoker before it calls the resolver. The returned array is the complete Capability list for that request.

Limit what the Agent can use

A Capability does not expose the full Runtime Context or unrestricted host access. Its tools, requirements, policy, and metadata define what the Agent can inspect and use.

Read the Capabilities section for implementation details and First agent for a runnable Definition.