Skip to main content
AgentOS deploys agents, teams, and flows as production-ready HTTP APIs with built-in health checks, CORS, and Express integration.
AgentOS replaces AgentApp as the recommended class name. The old name still works as a silent alias.

Quick Start

1

Install

npm install praisonai express
2

Create Server

import { AgentOS, Agent } from 'praisonai';

const agent = new Agent({
  name: 'assistant',
  instructions: 'You are a helpful assistant'
});

const app = new AgentOS({
  name: 'My AI App',
  agents: [agent]
});

await app.serve({ port: 8000 });
3

Test

curl -X POST http://localhost:8000/api/chat \
  -H "Content-Type: application/json" \
  -d '{"message": "Hello!"}'

How It Works

StepDescription
1Client sends HTTP request to AgentOS endpoint
2AgentOS routes to the appropriate agent
3Agent processes the message and returns a response
4AgentOS formats and returns the response as JSON

Configuration Options

import { AgentOS, Agent } from 'praisonai';

const app = new AgentOS({
  name: 'My AI App',
  agents: [agent],
  teams: [team],      // Optional: AgentTeam instances
  flows: [flow],      // Optional: AgentFlow instances
  config: {
    host: '0.0.0.0',
    port: 8000,
    corsOrigins: ['*'],
    apiPrefix: '/api',
    debug: false,
    timeout: 60
  }
});
OptionTypeDefaultDescription
namestring"PraisonAI App"Application name
agentsAgent[][]Agents to serve
teamsAgentTeam[][]Teams to serve
flowsAgentFlow[][]Flows to serve
config.hoststring"0.0.0.0"Server host
config.portnumber8000Server port
config.corsOriginsstring[]["*"]Allowed CORS origins
config.apiPrefixstring"/api"API route prefix
config.debugbooleanfalseEnable debug mode
config.timeoutnumber60Request timeout (seconds)

API Endpoints

EndpointMethodDescription
/GETApp info (name, status, agent count)
/healthGETHealth check ({ status: 'healthy' })
/api/agentsGETList available agents
/api/chatPOSTChat with an agent
/api/teamsGETList available teams
/api/flowsGETList available flows

Chat Request

curl -X POST http://localhost:8000/api/chat \
  -H "Content-Type: application/json" \
  -d '{
    "message": "Hello!",
    "agent_name": "assistant",
    "session_id": "user-123"
  }'

Chat Response

{
  "response": "Hello! How can I help you today?",
  "agent_name": "assistant",
  "session_id": "user-123"
}

Common Patterns

import { AgentOS, Agent } from 'praisonai';

const agent = new Agent({
  instructions: 'You are a helpful assistant'
});

const app = new AgentOS({ agents: [agent] });
await app.serve();

Best Practices

Read port from environment for deployment flexibility.
await app.serve({
  port: parseInt(process.env.PORT || '8000')
});
Restrict CORS origins in production instead of using ’*’.
config: {
  corsOrigins: ['https://yourdomain.com']
}
Use the stop() method for clean shutdown.
process.on('SIGTERM', async () => {
  await app.stop();
  process.exit(0);
});

Backward Compatibility

AgentApp works as a silent alias with no deprecation warnings.
// Both are equivalent
import { AgentOS, AgentApp } from 'praisonai';

const app1 = new AgentOS({ agents: [agent] });
const app2 = new AgentApp({ agents: [agent] });

// They are the same class
console.log(AgentOS === AgentApp); // true
Additional config aliases:
  • managersteams (deprecated)
  • workflowsflows (deprecated)