Module 5 of 10, lesson 4 of 5
Practice
Multi-agent systems
Write the code
Runs in your browser, with no install, account or API key. The model is scripted, so the results are repeatable.
async function fanOut(tasks, worker, { limit = 2 } = {}) { return Promise.all(tasks.map((task) => worker(task)));}module.exports = { fanOut };
Give the agent a skillFan out with a limit
Open in the editorasync function supervise({ model, agents, task, maxHandoffs = 4 }) { let notes = []; for (let i = 0; i < maxHandoffs; i += 1) { const decision = await model.create({ messages: [{ role: 'user', content: JSON.stringify({ task, notes }) }], }); if (decision.stop_reason === 'end_turn') { return { status: 'done', text: decision.content[0].text, notes };
Repair the agentFix the supervisor’s handoffs
Open in the editorRunning project
Running project: split the refund agent into two roles, advisor and policy checker. List each one’s tools and what they pass to each other. Estimate the extra calls. If the gain isn’t obvious, keep one agent and write down why.
Practice
- Multi AI Agent Systems with crewAI DeepLearning.AI
Short course on role-based agent teams.
Some of these need a free account or an API key, which may be paid.