Stop wrestling with complex AI integrations. RiLiGar Agents SDK gives you enterprise-grade AI agents in just 5 lines of code.
β¨ What used to take weeks, now takes minutes. Built on top of industry giants like OpenAI, Anthropic, Google, and Meta through OpenRouter's unified API, this framework packs thousands of hours of engineering into an elegantly simple package.
π― One SDK. All AI Providers. Infinite Possibilities.
- π€ Smart Agents with custom personalities and instructions
- π§ Custom Tools that agents can execute seamlessly
- π‘οΈ Built-in Guardrails for safe, controlled AI interactions
- π HMAC Security for enterprise-grade API authentication
- π‘ Real-time Streaming for responsive user experiences
- π MCP Protocol for enterprise-grade integrations
- π Intelligent Logging with contextual insights
- π HTTP Endpoints to expose agents as REST APIs
Via OpenRouter (configure OPENROUTER_API_KEY):
- OpenAI (GPT-4, GPT-3.5)
- Anthropic (Claude)
- Google (Gemini)
- Meta (Llama)
- Perplexity, Cohere, etc.
const llm = model.create({
modelName: 'openai/gpt-4', // or 'anthropic/claude-3', 'google/gemini-pro'
apiKey: process.env.OPENROUTER_API_KEY,
temperature: 0.7,
});npm install @riligar/agents-sdkimport { Agent, Endpoint, Logger, model, tool } from '@riligar/agents-sdk';
// 1. Configure your API Key
const OPENROUTER_API_KEY = process.env.OPENROUTER_API_KEY;
// 2. Create logger and model
const logger = new Logger({ level: 'info' });
const llm = model.create({
apiKey: OPENROUTER_API_KEY,
logger: logger,
});
// 3. Define tools (optional)
const tools = await tool.build(
[
{
type: 'local',
id: 'greeting',
description: 'Returns a personalized greeting',
parameters: {
type: 'object',
properties: {
name: { type: 'string', description: 'Person name' },
},
required: ['name'],
},
executeFn: async ({ name }) => {
return { message: `Hello, ${name}! π` };
},
},
],
{ logger }
);
// 4. Create your agent
const agent = new Agent({
name: 'Assistant',
instructions: 'You are a friendly assistant who can greet people.',
model: llm,
tools: tools,
logger: logger,
});
// 5. Execute tasks
const result = agent.run('Greet John');
const text = await result.text;
console.log(text); // Agent response
// 6. Expose as HTTP API (optional)
const endpoint = new Endpoint(agent, { port: 3001 });
await endpoint.start(); // Agent available at http://localhost:3001
// 7. Use from any JavaScript client
const response = await fetch('http://localhost:3001/process', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ task: 'Greet Sarah' }),
});
const data = await response.json();
console.log(data.result.text); // "Hello, Sarah! π"Connect automatically to MCP servers:
const tools = await tool.build(
[
{
type: 'remote',
serverUrl: 'http://localhost:3000', // MCP Server
},
],
{ logger }
);Secure your agent endpoints with enterprise-grade HMAC authentication. Perfect for production APIs that need to verify client identity and request integrity.
- π‘οΈ HMAC-SHA256: Industry-standard message authentication
- β±οΈ Timestamp Protection: Prevents replay attacks
- π₯ Multi-Client Support: Individual keys per client
- π Timing-Safe Validation: Resistant to timing attacks
- π« Request Integrity: Detects message tampering
- βοΈ Configurable Tolerance: Flexible timestamp validation
# Server configuration
OPENROUTER_API_KEY=your-openrouter-api-key
HMAC_MASTER_SECRET=your-master-secret-key
FRONTEND_SECRET=frontend-client-secret-key
MOBILE_SECRET=mobile-client-secret-key
ADMIN_SECRET=admin-client-secret-key
# Client configuration
AGENT_CLIENT_ID=frontend-app
AGENT_SECRET_KEY=frontend-client-secret-key
AGENT_BASE_URL=https://your-agent-api.comimport { Agent, Endpoint, Logger, model, security } from '@riligar/agents-sdk';
// Create your agent
const agent = new Agent({
name: 'SecureAgent',
instructions: 'You are a secure AI assistant.',
model: model.create({ apiKey: process.env.OPENROUTER_API_KEY }),
logger: new Logger({ level: 'info' }),
});
// Create endpoint with HMAC security
const endpoint = new Endpoint(agent, {
port: 3001,
// Option 1: Client-specific keys (recommended)
hmacClients: {
'frontend-app': process.env.FRONTEND_SECRET,
'mobile-app': process.env.MOBILE_SECRET,
'admin-panel': process.env.ADMIN_SECRET,
},
// Option 2: Master secret (simpler)
hmacSecret: process.env.HMAC_MASTER_SECRET,
hmacTolerance: 300, // 5 minutes tolerance
});
await endpoint.start();
console.log('π Secure agent running on http://localhost:3001');import { security } from '@riligar/agents-sdk';
class SecureAgentClient {
constructor(clientId, secretKey, baseUrl) {
this.clientId = clientId;
this.secretKey = secretKey;
this.baseUrl = baseUrl;
}
async processTask(task) {
const body = { task };
// Generate HMAC authentication
const authHeader = security.generateHMACAuth(this.clientId, this.secretKey, 'POST', '/process', body);
const response = await fetch(`${this.baseUrl}/process`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: authHeader,
},
body: JSON.stringify(body),
});
if (!response.ok) {
throw new Error(`Authentication failed: ${response.status}`);
}
return response.json();
}
async checkHealth() {
const authHeader = security.generateHMACAuth(this.clientId, this.secretKey, 'GET', '/health');
const response = await fetch(`${this.baseUrl}/health`, {
headers: { Authorization: authHeader },
});
return response.json();
}
}
// Usage
const client = new SecureAgentClient('frontend-app', process.env.FRONTEND_SECRET, 'https://your-agent-api.com');
const result = await client.processTask('Analyze customer data');
console.log(result.result.text);| Example | File | Description |
|---|---|---|
| Basic | examples/hello.js |
Simple agent with tools |
| Security | examples/security.js |
HMAC authentication |
| Guardrails | examples/guardrail.js |
Input/output validation |
| Handoffs | examples/handoffs.js |
Transfer between agents |
| MCP | examples/mcp/ |
MCP server integration |
Run any example:
export OPENROUTER_API_KEY="your-key-here"
node examples/hello.js- OpenRouter - Unified API for multiple LLM providers
- OpenAI | SDK
- Anthropic | SDK
- Google AI | SDK
- Meta Llama
- Model Context Protocol
Apache-2.0