Integrating Arcten: A Step-by-Step Guide
This guide will walk you through integrating Arcten into your application. We'll build a simple copilot for a project management app that can create tasks, assign team members, and update project status.
Step 1: Installation
First, install the Arcten SDK:
npm install @arcten/sdkStep 2: Initialize the Client
In your application's entry point, initialize the Arcten client with your API key:
import { Arcten } from '@arcten/sdk';
const arcten = new Arcten({
apiKey: process.env.ARCTEN_API_KEY,
environment: 'production'
});Step 3: Define Actions
Actions are functions your copilot can call. Define them with type-safe schemas:
arcten.defineAction({
name: 'createTask',
description: 'Creates a new task in a project',
parameters: {
title: { type: 'string', required: true },
projectId: { type: 'string', required: true },
assignee: { type: 'string', required: false },
dueDate: { type: 'date', required: false }
},
handler: async (params, context) => {
const task = await db.tasks.create({
title: params.title,
projectId: params.projectId,
assigneeId: params.assignee,
dueDate: params.dueDate,
createdBy: context.user.id
});
return { success: true, taskId: task.id };
}
});Step 4: Add the UI Component
Drop Arcten's React component into your UI:
import { CopilotPanel } from '@arcten/react';
function MyApp() {
return (
<div>
<YourAppContent />
<CopilotPanel
position="bottom-right"
context={{ userId: currentUser.id }}
/>
</div>
);
}Step 5: Test and Deploy
That's it! Your copilot is now live. Users can say things like 'Create a task called Design Review in the Q1 Projects project, assign it to Sarah, due next Friday' and the copilot will execute it.
Next Steps
From here, you can add more actions, connect knowledge sources, configure guardrails, and monitor analytics. Check out our full documentation for advanced features.