API Reference
Use DevOS programmatically in your Node.js projects.
Overview
import { Orchestrator, AIAdapter, Config } from 'devos-ai';
const orchestrator = new Orchestrator();
await orchestrator.executeGoal('Build a REST API with Express');
Orchestrator
The main entry point for programmatic usage.
import { Orchestrator } from 'devos-ai';
const orch = new Orchestrator();
// Execute a natural language goal
await orch.executeGoal(description);
// Execute a structured task
await orch.executeTask({ type, description, context });
// Process natural language command
const result = await orch.processNaturalLanguage('add auth to my app');
Methods
| Method | Parameters | Returns |
|---|---|---|
executeGoal(desc) | string | Promise<object> |
executeTask(task) | { type, description, context } | Promise<object> |
processNaturalLanguage(input) | string | Promise<object> |
Agents
Use individual agents directly:
import { PlannerAgent, CoderAgent, DeployerAgent } from 'devos-ai';
// Plan a project
const planner = new PlannerAgent();
const plan = await planner.createPlan('Build a blog');
// Generate code
const coder = new CoderAgent();
await coder.generateFile('src/server.js', 'Express server with CORS');
// Deploy
const deployer = new DeployerAgent();
await deployer.deploy({ target: 'vercel' });
AI Adapter
import { AIAdapter } from 'devos-ai';
const ai = new AIAdapter({
provider: 'openai',
model: 'gpt-4o'
});
const response = await ai.chat([
{ role: 'system', content: 'You are a helpful assistant.' },
{ role: 'user', content: 'Write a fibonacci function in JS' }
]);
Options
| Option | Type | Default |
|---|---|---|
provider | string | 'openai' |
model | string | 'gpt-4o' |
temperature | number | 0.7 |
maxTokens | number | 4096 |
smartRouter | boolean | false |
Config
import { Config } from 'devos-ai';
const config = new Config();
config.set('model', 'gpt-4o');
const model = config.get('model');
const all = config.getAll();