Three examples, captured from node examples/….mjs against the OpenAI API. The full source is committed at framersai/agentos/examples. Pick one.
import { agency } from '@framers/agentos'; const team = agency({ provider: 'openai', model: 'gpt-4o', strategy: 'hierarchical', instructions: 'Coordinate a research team. If the task needs a ' + 'capability your roster does not cover, call ' + 'spawn_specialist to mint one.', agents: { researcher: { instructions: 'Find sources.' }, writer: { instructions: 'Produce concise prose.' }, }, emergent: { enabled: true, judge: true, planner: { maxSpecialists: 1 }, }, on: { emergentForge: (e) => console.log( `[FORGE] spawned "${e.agentName}"` ), }, }); const result = await team.generate( 'Write a 2-paragraph briefing on agentic-AI ' + 'sandbox security risks. Include a security ' + 'audit perspective on node:vm vs container ' + 'isolation. The team has no security auditor; ' + 'spawn one if needed.', ); console.log(result.text);
The team starts with researcher + writer. The prompt asks for a security audit, which neither covers. The manager calls spawn_specialist, EmergentAgentJudge approves the spec, and security_auditor joins the live roster. The final answer above is what GPT-4o produced through that team. Captured from a real run, no edits.