import { Agent, PraisonAIAgents, GuardrailManager, builtinGuardrails } from 'praisonai';
// Shared guardrails for all Agents
const sharedGuardrails = new GuardrailManager();
sharedGuardrails.add(builtinGuardrails.maxLength(1000));
sharedGuardrails.add(builtinGuardrails.blockedWords(['password', 'secret', 'api_key']));
const researcher = new Agent({
name: 'Researcher',
instructions: 'Research topics.',
guardrails: { output: sharedGuardrails }
});
const writer = new Agent({
name: 'Writer',
instructions: 'Write content.',
guardrails: { output: sharedGuardrails }
});
const agents = new PraisonAIAgents({
agents: [researcher, writer],
tasks: [
{ agent: researcher, description: 'Research: {topic}' },
{ agent: writer, description: 'Write about the research' }
]
});
// All Agent outputs are validated
await agents.start({ topic: 'AI safety' });