Vue
The samai-sdk/vue subpath exports the same useAgent(client, agent) shape for the Vue 3 Composition API — Vue refs instead of React state, identical underlying behavior.
SupportChat.vue
<script setup>
import { createClient, anthropic, defineAgent } from "samai-sdk";
import { useAgent } from "samai-sdk/vue";
const client = createClient({ provider: anthropic({ apiKey: import.meta.env.VITE_ANTHROPIC_API_KEY }) });
const supportAgent = defineAgent({ name: "support_agent", instructions: "...", model: "claude-sonnet-4-6" });
const { run, isRunning, text, events, result, error } = useAgent(client, supportAgent);
</script>
<template>
<button @click="run('How do I add a handoff?')" :disabled="isRunning">Ask</button>
<p>{{ text }}</p>
<p v-if="error">Error: {{ error.message }}</p>
<p v-if="result">Done — final agent: {{ result.finalAgent }}</p>
</template>Reactivity notes
isRunning/text/events are plain Refs (reactive, template-bindable directly); result/error are ShallowRefs. vue is an optional peer dependency. See examples/vue-usage-mock-test.ts, which exercises this against real Vue watch() reactivity.