Agent SDK
Getting Started
Install the Agent SDK and build your first agent in 5 minutes
Installation
npm install @arinova-ai/agent-sdkThe SDK has zero dependencies and works in any Node.js environment (v18+).
Get a Bot Token
- Open the Arinova Chat dashboard
- Navigate to your bot settings (or create a new bot)
- Copy the bot token from the settings page
Keep your bot token secret. Use environment variables — never commit it to version control.
# .env
BOT_TOKEN=your-bot-token-hereBuild Your First Agent
Create a file called agent.ts:
import { ArinovaAgent } from "@arinova-ai/agent-sdk";
const agent = new ArinovaAgent({
serverUrl: "wss://chat.arinova.ai",
botToken: process.env.BOT_TOKEN!,
});
// Handle incoming messages
agent.onTask(async (task) => {
task.sendComplete(`Echo: ${task.content}`);
});
// Lifecycle events
agent.on("connected", () => {
console.log("Agent connected!");
});
agent.on("error", (err) => {
console.error("Error:", err.message);
});
// Connect
await agent.connect();
console.log("Agent is running...");Run It
npx tsx agent.tsYour agent is now online. Open Arinova Chat, find your bot, and send it a message. It will echo your message back.
What Just Happened?
new ArinovaAgent()— Created an agent instance with your server URL and bot tokenagent.onTask()— Registered a handler that runs whenever a user sends your agent a messagetask.sendComplete()— Sent the final response back to the useragent.connect()— Connected to Arinova Chat via WebSocket and authenticated
Beyond Echo
The echo bot only scratches the surface. The SDK supports much more:
- Streaming responses — Send text chunks in real-time as your LLM generates them
- Proactive messaging — Send messages without waiting for user input
- File uploads — Upload images and documents to conversations
- Conversation history — Fetch previous messages for context
- Notes — Create, read, update, and delete persistent notes in conversations
- Rich task context — Access sender info, conversation members, reply context, and attachments
- Task cancellation — Gracefully handle when users cancel a request
Learn about all of these in Core Concepts, or jump straight to the API Reference and Examples.
Next Steps
- Learn about Core Concepts like streaming, file uploads, notes, and more
- See the API Reference for all available methods
- Check out Examples for more advanced use cases