ViteHub is still experimental. Expect bugs and breaking changes.

Title

Generate a short title and attach it to Agent output.

title() generates a short title for an Agent Invocation. It can use a model, a custom executor, or a local heuristic, then streams or returns the title as output metadata and optionally delivers it to a Channel thread.

Installation

Import the Capability factory from @vite-hub/agent/capabilities and add it to defineAgent({ capabilities }). Use the configuration example below as the starting point, then tighten modes, policies, stores, and providers for the Agent boundary.

What it adds

The Capability reads the first user message, generates a short title, provides it as a finish extension, and injects title data into compatible streams. Applications can use the finish extension to name a job, run, artifact, or other durable record without depending on a chat surface. It can filter by Agent Trigger id when title generation should run only for selected triggers.

Configuration

Attach title() to any Agent Definition that needs a generated title. When no model is available to the Capability, ViteHub falls back to a short heuristic title.

server/agents/support.ts
import { defineAgent } from '@vite-hub/agent'
import { title } from '@vite-hub/agent/capabilities'

export default defineAgent({
  driver: { model },
  capabilities: [
    title(),
  ],
})

Runtime behavior

title() runs in the output phase. It wraps compatible async streams or UI message streams so the title can arrive alongside the response, and it provides { title } in the finish extension.

For framework-managed Chat SDK message Channels, ViteHub also delivers the title once per thread by default, even when each webhook contains only the current message or the handler is recreated. Follow-up Channel invocations skip title generation after successful delivery. Set channelDelivery: "always" when the platform title should be refreshed on every invocation. Plain runAgent() and UI invocations without framework-managed Chat SDK delivery still receive stream data and finish extensions per invocation.

The Capability avoids wrapping the same result twice.

Requirements

title() needs message-shaped input with at least one user message. A model, custom executor, or heuristic path must be available.

Use a custom template, variables, or executor when the title must include product-specific context.

Driver support

Agent DriverSupport
Model-backedCan use the Agent model or an explicit model to generate the title and decorate streams.
Harness-backedCan decorate compatible output streams when the invocation produces them; model-based title generation still needs a model resolver.
Custom-run-backedCan decorate compatible custom output; custom driver.run controls the response shape.

Inspect and verify

Run one Agent Invocation and inspect the stream for title data. The finish extension should include { title } when title generation succeeds.

Test a vague first message and confirm the fallback title is used instead of an empty string.

Options

OptionTypeDefaultDescription
channelDelivery"once-per-thread" | "always""once-per-thread"Deliver framework-managed Chat SDK Channel titles once per thread, or on every invocation.
driverAgentDrivernoneAgent Driver used only for title generation.
execute(input) => string | { title?: string }noneCustom title generator.
fallbackstring"Untitled"Title used when generation returns no usable text.
idstring"title"Capability id.
instructionsstringnoneSystem instructions for model-backed title generation.
maxLengthnumber80Maximum title length.
modelAgentModelResolverAgent model, then heuristic fallbackModel used for title generation.
templatestring | functiongeneratedPrompt template for model-backed generation.
triggerstring | string[]all triggersLimit title generation to selected Agent Trigger ids.
variablesRecord<string, value | function>noneExtra template variables.
when(input) => booleannonePredicate that decides whether title generation runs.

Reference

Copyright © 2026