SkillfulAI
  • Skillful AI
    • Welcome
    • About us
    • Ecosystem
  • Web SDK
    • Overview
    • Getting Started
      • Installation
      • Quick Start
      • Authentication
    • SDK Reference
    • Templates
      • Telegram Bot Template
      • Express Server Template
        • API Reference
      • Discord Bot Template
        • ProActive Mode
      • Kick Stream Bot
        • Getting Started
          • Installation
          • Quick Start
        • Create Commands
        • Advanced Configurations
  • Unity Gaming SDK
    • Overview
    • Getting Started
      • Installation
      • Authentication
    • Services
      • Skillful Agents
        • Overview
        • Quick Start
        • Service Reference
      • Smart NPCs
        • Overview
        • Quick Start
        • Service Reference
      • Skillful Inference
        • Overview
        • Quick Start
        • Service Reference
          • Question Answering
          • Sentence Similarity
          • Speech Recognition
          • Text Classification
          • Text Generation
          • Text Summary
          • Text-To-Image
          • Zero Shot Classification
          • Translation (Localization)
    • Audio Recorder
    • Additional Utilities
Powered by GitBook
On this page
  • 🔷 SkillfulClient
  • Initialization
  • Core Methods
  • 🔷 Agent
  • Properties
  • Methods
  • 🔷 Response Structure
  • 🔷 Error Handling
  1. Web SDK

SDK Reference

Welcome to the Skillful AI Web SDK reference documentation. Here you'll find detailed information about the classes, methods, and properties available in the SDK.

🔷 SkillfulClient

The SkillfulClient is the main entry point for interacting with Skillful AI agents.

Initialization

import { SkillfulClient } from '@skillfulai/agents';

const client = new SkillfulClient({
    apiKey: 'your-api-key'
});

Core Methods

🟣 Agent Management

getAgents()

Retrieves all available agents.

const agents = await client.getAgents();

Returns: Array<Agent> - List of available agents

setAgent(agentOrName)

Sets the active agent for conversations.

// By name
await client.setAgent('Wojak');

// By agent object
await client.setAgent(agents[0]);

Parameters:

  • agentOrName: string | Agent - Agent name or object

Returns: Promise<Agent> - The set agent

🟣 Conversation Methods

sendMessage(content)

Sends a message to the active agent.

const response = await client.sendMessage('Hello!');

Parameters:

  • content: string - Message to send

Returns:

{
    text: string;      // Agent's response
    events: any[];     // Event metadata
    tools: any[];      // Tools used
    sources: any[];    // Source references
}
getConversationHistory()

Gets the current conversation history.

const history = client.getConversationHistory();

Returns: Array of message objects

Array<{
    role: 'user' | 'assistant';
    content: string;
}>
clearConversation()

Clears the current conversation history.

client.clearConversation();

🔷 Agent

The Agent class represents an AI agent and provides access to its properties and capabilities.

Properties

agent.id: string          // Unique identifier
agent.name: string        // Agent name
agent.description: string // Description
agent.logoUrl: string    // Logo URL
agent.type: string       // Agent type
agent.isDraft: boolean   // Draft status
agent.isMinted: boolean  // Minting status

Methods

findAgentByName(name)

Finds a specific agent by name.

const wojak = await client.findAgentByName('Wojak');

Parameters:

  • name: string - Name of the agent to find

Returns: Promise<Agent | null> - Found agent or null

hasSkill(skillName)

Checks if the agent has a specific skill.

const hasWeather = agent.hasSkill('weather');

Parameters:

  • skillName: string - Name of the skill to check

Returns: boolean

getLLMInfo()

Gets the agent's language model configuration.

const llmInfo = agent.getLLMInfo();

Returns:

{
    provider: string;    // LLM provider
    model: string;      // Model name
    temperature: number; // Temperature setting
    maxTokens: number;  // Max tokens
}

🔷 Response Structure

When receiving a response from sendMessage(), you get:

{
    text: string;    // The agent's response text
    events: Array<{
        type: string;
        data: any;
    }>;
    tools: Array<{
        type: string;
        data: any;
    }>;
    sources: {
        type: string;
        data: {
            nodes: any[];
        };
    };
}

🔷 Error Handling

The SDK provides detailed error messages for common issues:

try {
    await client.sendMessage('Hello');
} catch (error) {
    // Handle specific error types
    if (error.message.includes('No active agent')) {
        console.error('Please select an agent first');
    } else if (error.message.includes('unauthorized')) {
        console.error('Invalid API key');
    } else {
        console.error('Unexpected error:', error.message);
    }
}
PreviousAuthenticationNextTemplates

Last updated 1 month ago