@agentskit/svelte — for agents
Svelte 5 binding — `createChatStore` produces a Readable that drives any Svelte component.
#Purpose
Svelte binding for the ChatReturn contract from @agentskit/core. Returns a Readable<ChatState> plus action methods (send / stop / clear) and destroy() for cleanup.
#Install
npm install @agentskit/svelte
# peer:
npm install svelte#Primary exports
createChatStore(config): SvelteChatStore—Readable<ChatState>+ action methods +destroy().
#Minimal example
<script lang="ts">
import { createChatStore } from '@agentskit/svelte'
const chat = createChatStore({ adapter })
</script>
{#each $chat.messages as m (m.id)}
<p>{m.content}</p>
{/each}
<form on:submit|preventDefault={() => chat.send($chat.input)}>
<input bind:value={$chat.input} />
</form>#Common patterns
- Runes vs stores: works in both Svelte 5 runes mode and Svelte 4 stores — auto-subscription via
$chatworks the same. - Cleanup: call
chat.destroy()inonDestroy()to abort in-flight streams and release the adapter. - SvelteKit SSR: instantiate in
onMountor a client-only component; the adapter must run in the browser unless you proxy through a server endpoint.
#Related
- @agentskit/core —
ChatReturncontract. - @agentskit/adapters — provider adapters.
- @agentskit/react, @agentskit/vue, @agentskit/solid, @agentskit/angular, @agentskit/ink, @agentskit/react-native — sibling bindings.
#Source
- npm: https://www.npmjs.com/package/@agentskit/svelte
- repo: https://github.com/AgentsKit-io/agentskit/tree/main/packages/svelte
Explore nearby
- PeerFor agents — overview
Dense, LLM-friendly reference for every AgentsKit package. Designed to paste into an agent's context window.
- Peer@agentskit/core — for agents
Zero-dependency foundation. Contracts, chat controller, primitives, and a dozen feature subpaths.
- Peer@agentskit/adapters — for agents
Provider adapters (OpenAI-compatible + native) + router + ensemble + fallback + generic factory.