1.0.1 • Published 3 months ago
@skillfulai/express-template v1.0.1
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 healthGET /agent/info
- Get current agent informationGET /agent/skills
- Get categorized list of agent skillsGET /agents
- List all available agentsPOST /agent/switch
- Switch to a different agent
Chat
POST /chat
- Send message to agentGET /chat/history
- Get conversation historyPOST /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:
- Documentation: docs.skillfulai.io
- Discord: discord.gg/skillfulai