Skip to content

@uservane/vercel-ai: AgentInitOptions

AgentInitOptions = object

Defined in: products/uservane/agent-core/dist/index.d.ts:69

@uservane/vercel-ai - agent-native capture for Vercel AI SDK hosts.

Thin positioning shim over @uservane/agent-core + @uservane/agent-react. Headless core (AgentController) + React <UserVaneProvider> / <InlineFeedback/>. Reuses @uservane/browser for bootstrap, decideShow, submit. Does not reimplement show-token, suppression, or sampling.

Session correlation (production linked path):

  1. Server: import { mintFeedbackToken } from "@uservane/vercel-ai/server" with the project SECRET key + the same sessionId passed to Langfuse propagateAttributes.
  2. Thread showToken + sessionId to the client.
  3. Client: controller.bind({ surveyId, showToken, sessionId }) then resolveTask. Submit carries the bound token + sessionId -> response stored linked.

Without bind(), the unbound bootstrap path still works (stored unlinked). Do not import the /server entry from client code (secret key must stay server-side). Observation-level auto-read remains deferred.

// NEEDS CEO VERIFICATION: observation-level auto-read (deferred)

import { UserVaneProvider, useUserVane } from "@uservane/vercel-ai";
<UserVaneProvider apiKey="uv_pk_live_..." surveySlug="post-task">
<Chat />
</UserVaneProvider>
// after server mints a bound token:
controller.bind({ surveyId, showToken, sessionId });
// at true resolution:
const { resolveTask } = useUserVane();
resolveTask({ outcome: "refunded" });

Headless-only: construct AgentController with headlessMode: true and supply setHeadlessContract({ isTaskOpen, onDismiss }) or shows are refused.

optional apiBase?: string

Defined in: products/uservane/agent-core/dist/index.d.ts:73

API origin. Defaults inside @uservane/browser.


optional debug?: boolean

Defined in: products/uservane/agent-core/dist/index.d.ts:75

When true, logs show/no-show rationale and link/unlink reasons.


key: string

Defined in: products/uservane/agent-core/dist/index.d.ts:71

Publishable key, e.g. uv_pk_live_....


optional nonBlocking?: boolean

Defined in: products/uservane/agent-core/dist/index.d.ts:81

When true, mechanical triggers (afterTurn / onSessionEnd / relative-time) may fire. Default false: agent is blocking-capable and a task is open until resolveTask fires.


optional relativeTimeMs?: number

Defined in: products/uservane/agent-core/dist/index.d.ts:88

Relative-time trigger (ms after init). Only evaluated in nonBlocking mode. Fires once through decideShow.


optional surveySlug?: string

Defined in: products/uservane/agent-core/dist/index.d.ts:83

Default survey slug for resolveTask / mechanical triggers.