Complete Node.js SDK for the Oblien AI Platform. Manage agents, chat sessions, sandboxes, namespaces, and more.
npm install oblien// Import client
import { OblienClient } from 'oblien';
// Import modules (tree-shakeable)
import { OblienAgents } from 'oblien/agents';
import { OblienChat } from 'oblien/chat';
import { OblienSandboxes } from 'oblien/sandbox';
import { OblienSearch } from 'oblien/search';
import { OblienIcons } from 'oblien/icons';
import { OblienNamespaces } from 'oblien/namespaces';
import { OblienCredits } from 'oblien/credits';
// Initialize client
const client = new OblienClient({
apiKey: 'your-client-id',
apiSecret: 'your-client-secret',
baseURL: 'https://api.oblien.com' // Optional
});
// Use modules
const agents = new OblienAgents(client);
const chat = new OblienChat(client);
const sandboxes = new OblienSandboxes(client);
const search = new OblienSearch(client);
const icons = new OblienIcons(client);Manage AI agents with settings, tools, and analytics.
import { OblienAgents } from 'oblien/agents';
const agents = new OblienAgents(client);
// Create agent
const agent = await agents.create({
name: 'Support Agent',
namespace: 'production',
prompts: {
identity: 'You are a helpful assistant.'
}
});
// Configure settings
const agentInstance = agents.agent(agent.agentId);
await agentInstance.settings.updateModelConfig({
model: 'oblien-master',
temperature: 0.8
});
// Assign tools
await agentInstance.settings.updateTools(['web-search', 'calculator']);
// Get analytics
const overview = await agentInstance.getOverview({ days: 7 });Features:
- β CRUD operations (create, read, update, delete)
- β Settings management (5 sections: switches, model, tools, guest limits, context)
- β Tools management (list, search, create, validate)
- β Analytics & monitoring
- β Namespace support
- β User management
π Full Documentation | π‘ Examples
Create and manage chat sessions with guest support.
import { OblienChat } from 'oblien/chat';
const chat = new OblienChat(client);
// Create session
const session = await chat.createSession({
agentId: 'agent-id',
namespace: 'production'
});
// Create guest session
const guestSession = await chat.createGuestSession({
ip: '192.168.1.1',
fingerprint: 'abc123',
agentId: 'agent-id'
});
// List sessions
const sessions = await chat.listSessions({ limit: 20 });Features:
- β Session management
- β Guest sessions with fingerprint tracking
- β Token generation
- β Automatic guest ID generation
π Documentation | π‘ Examples
Manage cloud sandboxes (containerized environments).
import { OblienSandboxes } from 'oblien/sandbox';
const sandboxes = new OblienSandboxes(client);
// Create sandbox
const sandbox = await sandboxes.create({
name: 'my-dev-env',
region: 'us-east-1',
template: 'node-20',
autoStart: true
});
// Use sandbox
const { url, token } = sandbox.sandbox;
const response = await fetch(`${url}/files/list`, {
headers: { 'Authorization': `Bearer ${token}` }
});
// Control lifecycle
await sandboxes.stop(sandboxId);
await sandboxes.start(sandboxId);
await sandboxes.restart(sandboxId);
// Regenerate token (1h expiry)
const newToken = await sandboxes.regenerateToken(sandboxId);
// Get metrics
const metrics = await sandboxes.getMetrics(sandboxId);Features:
- β Create, start, stop, restart, delete sandboxes
- β Auto-start option
- β Token management (1h JWT)
- β Resource metrics
- β Multiple templates & regions
- β Platform statistics
π Full Documentation | π‘ Examples
Manage namespaces and service configurations.
import { OblienNamespaces } from 'oblien/namespaces';
const namespaces = new OblienNamespaces(client);
// Create namespace
const namespace = await namespaces.create({
name: 'production',
slug: 'prod',
type: 'production'
});
// Configure services
await namespaces.configureService(namespaceId, {
service: 'ai',
enabled: true,
config: { /* ... */ }
});
// Get usage stats
const usage = await namespaces.getUsage(namespaceId);Features:
- β Namespace CRUD
- β Service configuration
- β Usage tracking
- β Activity logs
π Documentation
Search and fetch icons, images, and videos using AI-powered semantic search.
import { OblienIcons } from 'oblien/icons';
const icons = new OblienIcons(client);
// Search for icons
const results = await icons.search('home', { limit: 20 });
// Fetch specific icons
const icon = await icons.fetchIcon('settings gear');
// Fetch multiple icons at once
const iconSet = await icons.fetchIcons([
'home',
'user profile',
'settings',
'notification bell'
]);
// Fetch mixed media (icons, images, videos)
const media = await icons.fetch([
{ type: 'icon', description: 'user avatar' },
{ type: 'image', description: 'mountain landscape' },
{ type: 'video', description: 'product demo' }
]);Features:
- β Semantic icon search with AI embeddings
- β Fetch icons, images, and videos
- β Relevance scoring
- β Multiple icon styles (Outline, Filled, etc.)
- β Batch fetching
- β Pagination support
- β CDN-hosted assets
π Full Documentation | π‘ Examples
Manage billing and credits.
import { OblienCredits } from 'oblien/credits';
const credits = new OblienCredits(client);
// Get balance
const balance = await credits.getBalance();
// Get usage
const usage = await credits.getUsage({ period: 'monthly' });Features:
- β Balance checking
- β Usage tracking
- β Transaction history
// Import client and modules
import { OblienClient } from 'oblien';
import { OblienAgents } from 'oblien/agents';
import { OblienChat } from 'oblien/chat';
import { OblienSandboxes } from 'oblien/sandbox';
// Initialize
const client = new OblienClient({
apiKey: 'your-client-id',
apiSecret: 'your-client-secret'
});
const agents = new OblienAgents(client);
const chat = new OblienChat(client);
const sandboxes = new OblienSandboxes(client);
async function main() {
// 1. Create agent with tools
const agent = await agents.create({
name: 'Code Assistant',
namespace: 'production',
prompts: {
identity: 'You are a coding assistant.'
}
});
// Configure agent
const agentInstance = agents.agent(agent.agentId);
await agentInstance.settings.updateTools(['web-search', 'calculator']);
await agentInstance.settings.updateModelConfig({
temperature: 0.7,
max_tokens: 3000
});
// 2. Create sandbox for code execution
const sandbox = await sandboxes.create({
name: 'code-env',
template: 'node-20',
autoStart: true
});
// 3. Create chat session
const session = await chat.createSession({
agentId: agent.agentId,
namespace: 'production'
});
console.log('Setup complete!');
console.log('- Agent ID:', agent.agentId);
console.log('- Sandbox URL:', sandbox.sandbox.url);
console.log('- Session ID:', session.sessionId);
}
main();oblien/
βββ src/
β βββ agents/ # Agents management
β β βββ index.js # OblienAgents class
β β βββ agent.js # Agent instance
β β βββ settings.js # AgentSettings class
β β βββ tools.js # Tools class
β βββ chat/ # Chat sessions
β β βββ index.js # OblienChat class
β β βββ session.js # ChatSession class
β βββ sandbox/ # Sandboxes management
β β βββ index.js # OblienSandboxes class
β β βββ sandbox.js # Sandbox instance
β βββ namespaces/ # Namespaces management
β βββ credits/ # Credits & billing
β βββ client.js # OblienClient (base)
βββ docs/ # Documentation
β βββ AGENTS_COMPLETE.md
β βββ SANDBOXES.md
β βββ CHAT.md
β βββ NAMESPACES.md
βββ examples/ # Usage examples
βββ agents-complete-example.js
βββ sandbox-example.js
βββ chat-example.js
| Module | Base Path | Operations |
|---|---|---|
| Agents | /ai/agents |
CRUD, settings, tools, analytics |
| Chat | /ai/session |
Create, list, history |
| Sandboxes | /sandbox |
CRUD, start/stop/restart, metrics |
| Tools | /ai/tools |
List, search, create |
| Namespaces | /namespaces |
CRUD, services, usage |
All modules use client credentials authentication:
const client = new OblienClient({
apiKey: 'your-client-id', // X-Client-ID header
apiSecret: 'your-client-secret' // X-Client-Secret header
});Get your credentials from the Oblien Dashboard.
The SDK includes TypeScript definitions:
import {
OblienClient,
OblienAgents,
Agent,
AgentSettings,
Tools,
OblienSandboxes,
Sandbox
} from 'oblien';
const client: OblienClient = new OblienClient({
apiKey: string,
apiSecret: string
});try {
const agent = await agents.create({ /* ... */ });
} catch (error) {
console.error('Error:', error.message);
if (error.message.includes('401')) {
// Authentication failed
} else if (error.message.includes('404')) {
// Resource not found
} else if (error.message.includes('429')) {
// Rate limit exceeded
}
}- Reuse Client: Create one client instance and share across modules
- Error Handling: Always wrap API calls in try-catch
- Token Management: For sandboxes, refresh tokens before 1h expiry
- Resource Cleanup: Stop/delete unused sandboxes and sessions
- Namespace Organization: Use namespaces to separate environments
- Tool Validation: Validate tools before assigning to agents
// Create specialized agents
const coder = await agents.create({
name: 'Coder',
prompts: { identity: 'Expert coder' }
});
const reviewer = await agents.create({
name: 'Reviewer',
prompts: { identity: 'Code reviewer' }
});
// Configure each with specific tools
await agents.agent(coder.agentId).settings.updateTools([
'web-search', 'code-interpreter'
]);
await agents.agent(reviewer.agentId).settings.updateTools([
'code-analyzer', 'security-scanner'
]);// Create agent for customer support
const supportAgent = await agents.create({
name: 'Support Bot',
namespace: 'production'
});
// Set guest limits
await agents.agent(supportAgent.agentId).settings.updateGuestLimits({
enabled: true,
max_messages_per_day: 100,
max_total_tokens_per_day: 50000
});
// Create guest session
const session = await chat.createGuestSession({
ip: req.ip,
fingerprint: req.headers['x-fingerprint'],
agentId: supportAgent.agentId
});- Website: https://oblien.com
- Documentation: https://docs.oblien.com
- Dashboard: https://dashboard.oblien.com
- API Reference: https://api.oblien.com/docs
- Support: support@oblien.com
- GitHub: https://github.com/oblien/oblien
MIT License - see LICENSE file for details
- β Added Sandboxes module
- β Enhanced Agents module with proper settings sections
- β Added Tools management
- β Improved documentation
- β Added Agents module
- β Added Namespaces module
- β Guest session support
- β Initial release
- β Chat module
- β Credits module
Made with β€οΈ by the Oblien Team