SDK Quickstart
Setting Up Your Environment
Before you begin, make sure you have the following:
A valid API key from Assisfy.
Node.js and npm installed on your machine.
Running Your First Agent
Here’s a step-by-step guide to run your first agent using Assisfy.
Create an Assisfy Client:
const assisfy = new Assisfy({
apiKey: 'your-api-key', // Replace with your Assisfy API key
});
Initialize the Agent:
You’ll initialize a session by calling the initialize
method.
const session = await assisfy.session().create({
goal: "Who is the president of the United States?",
});
Events
You can now begin handling events such as when a session starts, or an action is performed. Use session.on
to handle events for the current session.
session.on('session_created', (data) => {
console.log('session_created', data);
});
session.on('session_connected', (data) => {
console.log('session_connected', data);
});
session.on('session_error', (data) => {
console.log('session_error', data);
});
session.on('session_disconnected', (data) => {
console.log('session_disconnected', data);
});
Last updated