Skip to content

CLIENT

A universal JS client.

Install @sveda-ai/core. SvedaClient holds endpoints, headers, and tools. session.send posts a turn. Streaming stays on the wire — not a Vue widget, not a Laravel package.

@sveda-ai/core

npm package

send

session API

JS

any host

The problem

Most “embed an agent” kits are a widget, a framework plugin, or a stream helper that still leaves you writing the attach surface. The host should own a client object — not a Vue island and not a PHP package in the request cycle.

Framework lock-in

A Vue-only SDK forces the copilot into one renderer. @sveda-ai/vue exists as optional UI. Core is plain JavaScript and attaches wherever fetch exists.

The wrong verb

session.stream sounds like the product. The wire is a POST. SvedaChatSession exposes send. Streaming is the response, not a second client API.

Agent in the app process

Laravel packages and server middleware pull the loop into your routes. SvedaClient talks to sveda-server over HTTP. Your deploy stays yours.

How Sveda does it

Construct SvedaClient with endpoints, headers, and optional registries. Open a session by chat id. Call send. The client sets Accept to application/vnd.sveda.stream+json and reads the SSE body.

One constructor

Endpoints, headers, tools, and context live on the client — not scattered across composables.

  • endpoints.stream is required
  • message, histories, documentsExtract are optional
  • headers may be a function

session.send

A turn is text plus optional context, model, provider, and files. The session holds messages and status while the stream runs.

  • client.session(chatId)
  • await session.send(text)
  • session.stop() aborts the POST

Frontend tools here

Pass a SvedaToolRegistry or use the default on the client. Handlers run in the host when a tool.call targets frontend.

  • SvedaToolRegistry.register
  • name, description, parameters, handler
  • results can auto-submit
attach.ts @sveda-ai/core
import { SvedaClient } from "@sveda-ai/core";

const client = new SvedaClient({
  endpoints: { stream: "/sveda/stream" },
  headers: { "x-sveda-embed-token": token },
});

const session = client.session(chatId);
await session.send("Ship a copilot into the product.");

The host keeps the client.

Sveda is not a chatbot SaaS and not a Laravel package. You install @sveda-ai/core, point stream at your proxy or at sveda-server, and mint a visitor token on the host. The browser only sends x-sveda-embed-token or Authorization: Bearer sveda_embed_….

Optional packages stop at UI. @sveda-ai/vue can provide a panel. It is not required to send a turn. Histories and document extract hang off the same client when you configure those endpoints.

Read the JS client docs for options. The product copilot page maps the same attach path onto a live host.

SVEDA CLIENT idle → streaming

POST /sveda/stream

Accept: application/vnd.sveda.stream+json

x-sveda-embed-token: sveda_embed_…

session.send → text.delta → message.end

Related

Install the client. Keep the host.

npm install @sveda-ai/core. Construct SvedaClient. Call session.send. Vue is optional.

Get started