1.0.1 • Published 3 months ago

@skillfulai/express-template v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
3 months ago

Skillful AI Express Server Template

A ready-to-use Express server template for Skillful AI agents with configurable rate limiting, logging, and endpoints for all core functionalities.

Quick Start

# Create your project
mkdir my-skillful-server
cd my-skillful-server
npm init -y

# Install the package
npm install @skillfulai/express-template

Create an index.js file:

const SkillfulServer = require('@skillfulai/express-template');

// Initialize with default options
const server = new SkillfulServer();
server.initialize();

Create a .env file:

SKILLFUL_API_KEY=your_skillful_api_key
AGENT_NAME=Wojak
PORT=3000

Configuration Options

const server = new SkillfulServer({
    // Enable/disable features
    enableRateLimiting: true,
    enableLogging: true,

    // Rate limiting configuration
    rateLimits: {
        global: {
            windowMs: 15 * 60 * 1000, // 15 minutes
            max: 100 // requests per window
        },
        chat: {
            windowMs: 60 * 1000, // 1 minute
            max: 10 // requests per minute
        }
    },

    // Logging options
    logger: {
        requests: true,
        responses: false,
        errors: true,
        format: 'short' // or 'detailed'
    },

    // Server configuration
    port: 3000
});

Available Endpoints

Agent Management

  • GET /health - Check server health
  • GET /agent/info - Get current agent information
  • GET /agent/skills - Get categorized list of agent skills
  • GET /agents - List all available agents
  • POST /agent/switch - Switch to a different agent

Chat

  • POST /chat - Send message to agent
  • GET /chat/history - Get conversation history
  • POST /chat/clear - Clear conversation history

Extending the Server

Create a custom server by extending the base class:

class CustomServer extends SkillfulServer {
    constructor(options) {
        super(options);
        // Add custom initialization
    }

    setupRoutes() {
        super.setupRoutes();
        // Add custom routes
        this.app.get('/custom', (req, res) => {
            res.json({ message: 'Custom endpoint' });
        });
    }
}

const server = new CustomServer({
    enableRateLimiting: true,
    enableLogging: true
});

Features

  • Express server with core Skillful AI integration
  • Configurable rate limiting
  • Customizable logging
  • Easy agent switching
  • Conversation management
  • Skills categorization
  • Built-in error handling
  • Extensible architecture

Requirements

  • Node.js 14 or higher
  • npm or yarn
  • Skillful AI API key
  • Environment variables configuration

Support

For support with Skillful AI: