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

MethodParametersReturns
executeGoal(desc)stringPromise<object>
executeTask(task){ type, description, context }Promise<object>
processNaturalLanguage(input)stringPromise<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

OptionTypeDefault
providerstring'openai'
modelstring'gpt-4o'
temperaturenumber0.7
maxTokensnumber4096
smartRouterbooleanfalse

Config

import { Config } from 'devos-ai';

const config = new Config();
config.set('model', 'gpt-4o');
const model = config.get('model');
const all = config.getAll();