SDK (Node.js)
TypeScript SDK for integrating Supyagent Cloud with the Vercel AI SDK — tools, persistence, context management, and React UI components.
SDK (Node.js)
The Supyagent SDK (@supyagent/sdk) lets you build AI-powered chatbot apps in TypeScript. It connects your Vercel AI SDK app to Supyagent Cloud integrations and provides chat persistence, context management, and pre-built React UI components.
Packages
| Package | Import | What it does |
|---|---|---|
@supyagent/sdk | import { supyagent } from '@supyagent/sdk' | Core client — fetches tools and skills from Supyagent Cloud |
@supyagent/sdk/prisma | import { createPrismaAdapter } from '@supyagent/sdk/prisma' | Chat persistence via Prisma (SQLite or PostgreSQL) |
@supyagent/sdk/context | import { createContextManager } from '@supyagent/sdk/context' | Token tracking, automatic summarization, and context compactification |
@supyagent/sdk/react | import { ProviderIcon, ToolInput } from '@supyagent/sdk/react' | React components for rendering tool calls and results |
Quick Start
The fastest way to get started is with create-supyagent-app:
npx create-supyagent-app my-appThis scaffolds a complete Next.js chatbot app with the SDK pre-configured. See the Quickstart guide for details.
Manual Installation
npm install @supyagent/sdkimport { streamText } from 'ai';
import { supyagent, createBashTool } from '@supyagent/sdk';
const client = supyagent({ apiKey: process.env.SUPYAGENT_API_KEY! });
export async function POST(req: Request) {
const { messages } = await req.json();
const { systemPrompt, tools: skillTools } = await client.skills({ cache: 300 });
const tools = { ...skillTools, bash: createBashTool() };
const result = streamText({
model: yourModel,
system: systemPrompt,
messages,
tools,
});
return result.toDataStreamResponse();
}In This Section
Quickstart
Scaffold a full app with create-supyagent-app.
Client
The supyagent() client — tools(), skills(), and me().
Built-in Tools
Bash execution, image viewing, and skill tools.
Persistence
Save and load chat history with Prisma.
Context Management
Token tracking, summarization, and compactification.
React Components
UI components for rendering tool calls and results.
Full API Route Example
Complete Next.js route combining all SDK features.