@reactive-agents/vue

Vue composables for Reactive Agents — useAgentStream, useAgent
3,001
Install
npm install @reactive-agents/vue
Latest Version:0.17.0
Vue:3
Last Updated:Oct 10, 2026
Links: npm
Maintainer: tylerbuell

@reactive-agents/vue

Vue composables for Reactive Agents — useAgentStream, useAgent

npm docs

Stability: experimental. The SSE event contract may change in a minor release. Pin a version for production use.

Vue 3 composables for streaming AI agents — stream agent output token-by-token into reactive refs, fire one-shot calls, or progressively render a structured JSON object as it streams. Built for chat UIs, copilots, and any Vue app talking to an LLM agent. These composables consume a Server-Sent Events (SSE) endpoint produced by AgentStream.toSSE() on the server, so token streaming works with plain fetch and no extra client deps.

Install

bun add @reactive-agents/vue
# or: npm install @reactive-agents/vue

Usage

Server:

// server route
import { ReactiveAgents, AgentStream } from "reactive-agents";

export async function POST(req: Request) {
  const { prompt } = await req.json();
  const agent = await ReactiveAgents.create().withProvider("anthropic").withTools().build();
  return AgentStream.toSSE(agent.runStream(prompt));
}

Client — streaming:

<script setup lang="ts">
import { useAgentStream } from "@reactive-agents/vue";
const { text, status, error, run } = useAgentStream("/api/agent");
</script>

<template>
  <button @click="run('Explain quantum computing')">Ask</button>
  <p style="white-space: pre-wrap">{{ text }}</p>
  <span v-if="status === 'streaming'">●</span>
  <p v-if="error" style="color: red">{{ error }}</p>
</template>

Client — structured object:

<script setup lang="ts">
import { useStructuredObject } from "@reactive-agents/vue";
const { object, status, run } = useStructuredObject("/api/agent/structured");
</script>

<template>
  <button @click="run('Generate a user profile')">Run</button>
  <p v-if="object.name">Name: {{ object.name }}</p>
  <pre v-if="status === 'completed'">{{ JSON.stringify(object, null, 2) }}</pre>
</template>

API

  • useAgentStream(endpoint, requestInit?) — streaming composable. Returns readonly refs { text, events, status, error, output } plus run(prompt, body?) and cancel(). status is "idle" | "streaming" | "completed" | "error".
  • useAgent(endpoint, requestInit?) — one-shot composable. Returns readonly refs { output, loading, error } plus run(prompt, body?) which resolves with the final output string.
  • useStructuredObject(endpoint, requestInit?) — streams a JSON object, surfacing a progressively-filled object ref. Returns { object, text, status, error, run, cancel }.
  • parsePartialObject(buf) — best-effort parse of a streaming JSON prefix into a partial object (used internally by useStructuredObject).
  • Types: AgentStreamEvent, AgentHookState.

Part of Reactive Agents

This package is part of Reactive Agents — the TypeScript AI agent framework built on Effect-TS. See the Web Integration guide and the full docs.

Related Packages

@aibind/vue

AI SDK bindings for Vue 3 — reactive composables for streaming, structured outpu...

1,366 19
@aibind/nuxt

AI SDK bindings for Nuxt — composables with defaults, server handlers, and agent...

1,296 19
@agentskit/vue

Vue 3 composable + headless chat components for AgentsKit — streaming, tools, an...

6,400 37
@json-render/vue

Vue renderer for @json-render/core. JSON becomes Vue components.

433,381 18,809
@opentiny/tiny-robot-kit

AI大模型请求与数据处理工具包

29,412 101

Version History

Version Released Vue License
0.17.0 >=3.0.0
0.16.0 >=3.0.0
0.15.0 >=3.0.0
0.14.0 >=3.0.0
0.13.6 >=3.0.0