import { agency } from '@framers/agentos';
const research = agency({
provider: 'openai',
model: 'gpt-4o',
strategy: 'hierarchical',
instructions:
'Coordinate the team to produce a thorough research report. ' +
'If you need a capability neither the researcher nor the writer covers, ' +
'call spawn_specialist to mint a new specialist for just this run.',
agents: {
researcher: { instructions: 'Find authoritative sources and pull verbatim quotes.' },
writer: { instructions: 'Produce well-cited prose from the research brief.' },
},
emergent: {
enabled: true, // unlocks the spawn_specialist tool
tier: 'session', // spawned agents are discarded when generate() returns
judge: true, // EmergentAgentJudge reviews each spec before activation
planner: { maxSpecialists: 3, requireJustification: true, maxJudgeCalls: 6 },
},
on: {
emergentForge: (event) =>
console.log(`[FORGE] spawned "${event.agentName}" approved=${event.approved}`),
},
});
const result = await research.generate(
'Survey the post-2023 RAG literature, including evaluation methodology, ' +
'known limitations, and reproducibility challenges.',
);
console.log(result.text);