@aigentyc/chat-sdk
v0.8.3
Published
React SDK for building AI-powered chat interfaces connected to the Aigentyc platform
Maintainers
Readme
@aigentyc/chat-sdk
React SDK for building AI-powered chat interfaces connected to the Aigentyc platform.
Features
- Drop-in
<Chat />and<ChatWidget />components - Full slot system — replace any UI piece
- Headless mode with
useAigentycChathook - Backend-driven tool rendering (visualization, json-render, custom HTML)
- Live chat handoff with Socket.IO
- Built-in i18n (en, he) — extensible with
addLanguage() - React 19, SSR-compatible (Next.js App Router)
- Multi-instance support — multiple chats on one page
- White-label — zero forced branding
Quickest start — scaffold a new app
npm create aigentyc-chat@latest my-app
cd my-app && npm install && npm run devPicks Vite or Next.js, wires your projectId, drops in <Chat />. Done.
Add to an existing app
npm install @aigentyc/chat-sdkThat's it — core chat, streaming, and tool rendering work out of the box.
Optional peer deps — install only if you use that feature:
socket.io-client— live chat handoffrecharts— visualization tool renderer@json-render/core @json-render/react @json-render/shadcn zod— json-render tools
Quick Start
import { Chat } from "@aigentyc/chat-sdk"
import "@aigentyc/chat-sdk/theme/styles.css"
export function App() {
return (
<Chat
projectId="your-project-id"
apiEndpoint="https://app.aigentyc.ai"
apiKey="your-api-key"
/>
)
}Four Levels of Control
Level 1 — Drop-in
<Chat projectId="..." apiEndpoint="..." />Level 2 — Customize with slots + theme
<Chat
projectId="..." apiEndpoint="..."
theme={{ primaryColor: "#3b82f6" }}
slots={{ header: MyHeader, input: MyInput }}
onMessageSent={(msg) => analytics.track('chat', msg)}
/>Level 3 — Compose components
<ChatProvider projectId="..." apiEndpoint="...">
<MyLayout>
<ChatInterface />
<ChatInput />
</MyLayout>
</ChatProvider>Level 4 — Headless
const { messages, sendMessage, status } = useAigentycChat({
projectId: "...", apiEndpoint: "..."
})Slots
| Slot | Replaces |
| --- | --- |
| header | Chat header bar |
| welcome | Welcome / empty state |
| message | Individual message bubble |
| input | Composer / input box |
| footer | Footer below input |
| loader | Loading indicator |
| suggestions | Suggested prompts |
| tools | Per-tool renderers (keyed by tool name) |
Tool Rendering
Tools created in the Aigentyc platform come with rendering instructions. The SDK auto-renders based on uiRenderMode:
visualization→ rechartsjson_render→ component spec via @json-render/shadcnlegacy→ custom HTML/CSS templatepreset→ built-in renderers
Override per-tool:
<Chat slots={{ tools: { searchProducts: MyProductGrid } }} />Theming
All theme tokens are CSS variables under [data-aigentyc-chat]. Override via theme prop or your own CSS.
i18n
Built-in: en, he. Add custom languages:
import { addLanguage } from "@aigentyc/chat-sdk/i18n"
addLanguage("fr", { welcomeTitle: "Bienvenue", ... })Live Chat
Enable Socket.IO-based live chat handoff:
<Chat enableLiveChat chatServiceUrl="wss://..." />Page agent
pageAgent lets the assistant operate the host page for the visitor — go to a screen, fill in a form (a send always waits for the visitor). Turn it on per project in the dashboard, then on the widget:
<ChatWidget
projectId="…"
pageAgent={{
// Optional. Without it the widget learns the site itself (the platform's
// crawl of it, else its sitemap). Pass it when the page is served from
// another address than the site (a preview proxy).
siteMap: [{ label: "טפסים", url: "https://www.example.org/forms/" }],
// The organisation's other sites the agent may also take the visitor to.
relatedSites: [
{ origin: "https://shop.example.org", label: "החנות" },
"https://community.example.org",
],
}}
/>- Which pages a run sees. A step offers a bounded number of site-map entries (40). They are ranked by how well each matches the visitor's request — label, description and address, Hebrew-aware (final letters, niqqud, one-letter prefixes) — so the right page is reachable on a site of hundreds of pages.
- Related sites. Their pages are offered alongside this site's, named with the site ("החנות — מבצעים"), learned from the platform's map of each site. With
navigateset, the host carries out the move (a proxy serving every site under one address keeps the run going). Without it, the browser loads the other site; the run cannot continue there, so it ends on that step, reporting which page it opened. Any origin not listed is refused. speed— how fast the visible steps play (pointer travel, the hold on each step):2twice as fast,0.5half, clamped 0.25–4, default 1. Network and page-load waits are never shortened.currentUrl/navigate— host overrides for a page served under another address (see the JSDoc onPageAgentConfig).
Next.js / SSR
All components have "use client" directives. Works in App Router and Pages Router.
Storybook
npm run storybookDemo
cd demo && npm install && npm run devPackage Exports
@aigentyc/chat-sdk— main (Chat, ChatWidget, ChatProvider)@aigentyc/chat-sdk/core— types, transport, utils@aigentyc/chat-sdk/hooks— all hooks@aigentyc/chat-sdk/components— individual chat components@aigentyc/chat-sdk/ai-elements— Message, Conversation, etc.@aigentyc/chat-sdk/tools— ToolRenderer, VisualizationRenderer@aigentyc/chat-sdk/json-render— json-render system@aigentyc/chat-sdk/ui— shadcn primitives@aigentyc/chat-sdk/theme— ThemeProvider + styles.css@aigentyc/chat-sdk/i18n— translations
License
MIT
