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
π£ Conversation Methods
π· 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
π· 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);
}
}
Last updated