TL;DR
You'll build a 3-agent system: a Researcher agent that gathers information, a Writer agent that creates content, and a Reviewer agent that checks quality. Total setup time: under 2 hours. No PhD required.
Why Agentic AI Matters in 2026
Agentic AI is the shift from "AI answers questions" to "AI completes tasks autonomously." Instead of chatting with an AI, you give it a goal and let it figure out the steps.
The numbers tell the story:
- 1,445% surge in multi-agent system search queries (Gartner, Q1 2024 → Q2 2025)
- Only 14% of organizations have deployment-ready agentic solutions
- Fortune 500 companies deploying production agentic AI across manufacturing, logistics, and finance
Yet most content about agentic AI is theoretical. This guide is practical — you'll have working code by the end.
What We're Building
A content creation pipeline with 3 specialized agents:
- Research Agent: Takes a topic → searches for information → produces structured research notes
- Writer Agent: Takes research notes → produces a draft article
- Reviewer Agent: Takes the draft → checks for accuracy, tone, and completeness → provides feedback
The agents communicate through a simple orchestrator that passes outputs between them.
Prerequisites
- Node.js 18+ or Python 3.10+
- An Anthropic API key (Claude) — get one at console.anthropic.com
- Basic programming knowledge (this tutorial uses TypeScript)
Step 1: Project Setup (10 minutes)
mkdir multi-agent-demo && cd multi-agent-demo
npm init -y
npm install @anthropic-ai/sdk typescript ts-node
npx tsc --init
// src/types.ts
export interface AgentResult {
agent: string;
output: string;
metadata: {
tokensUsed: number;
duration: number;
};
}
export interface AgentConfig {
name: string;
systemPrompt: string;
model: string;
}
Step 2: Build the Base Agent (20 minutes)
// src/agent.ts
import Anthropic from '@anthropic-ai/sdk';
import { AgentConfig, AgentResult } from './types';
const client = new Anthropic();
export async function runAgent(
config: AgentConfig,
userMessage: string
): Promise<AgentResult> {
const start = Date.now();
const response = await client.messages.create({
model: config.model,
max_tokens: 2048,
system: config.systemPrompt,
messages: [{ role: 'user', content: userMessage }],
});
const output = response.content[0].type === 'text'
? response.content[0].text
: '';
return {
agent: config.name,
output,
metadata: {
tokensUsed: response.usage.input_tokens + response.usage.output_tokens,
duration: Date.now() - start,
},
};
}
Step 3: Define Specialized Agents (15 minutes)
// src/agents/researcher.ts
import { AgentConfig } from '../types';
export const researcherConfig: AgentConfig = {
name: 'Researcher',
model: 'claude-sonnet-4-6',
systemPrompt: `You are a research specialist. Given a topic:
- Identify 5-7 key points with supporting evidence
- Find relevant statistics and data points
- Note any controversies or opposing viewpoints
- Structure output as clear research notes with sections
Be factual. Cite specifics. No fluff.`,
};
// src/agents/writer.ts
export const writerConfig: AgentConfig = {
name: 'Writer',
model: 'claude-sonnet-4-6',
systemPrompt: `You are a technical content writer. Given research notes:
- Write a compelling 800-word article
- Use clear headings and short paragraphs
- Include practical examples and actionable advice
- Write in first person, conversational but authoritative tone
- End with a clear takeaway
Write for developers and engineers. No corporate speak.`,
};
// src/agents/reviewer.ts
export const reviewerConfig: AgentConfig = {
name: 'Reviewer',
model: 'claude-sonnet-4-6',
systemPrompt: `You are an editorial reviewer. Given a draft article:
- Check factual accuracy of all claims
- Rate readability (1-10)
- Identify any gaps or missing context
- Suggest 3 specific improvements
- Give a final verdict: PUBLISH, REVISE, or REWRITE
Be constructive but honest. Flag any issues clearly.`,
};
Step 4: Build the Orchestrator (20 minutes)
// src/orchestrator.ts
import { runAgent } from './agent';
import { researcherConfig } from './agents/researcher';
import { writerConfig } from './agents/writer';
import { reviewerConfig } from './agents/reviewer';
export async function runPipeline(topic: string) {
console.log(\n🔬 Starting pipeline for: "${topic}"\n);
// Step 1: Research
console.log('📚 Research Agent working...');
const research = await runAgent(
researcherConfig,
Research this topic thoroughly: ${topic}
);
console.log(✅ Research complete (${research.metadata.duration}ms)\n);
// Step 2: Write
console.log('✍️ Writer Agent working...');
const draft = await runAgent(
writerConfig,
Write an article based on these research notes:\n\n${research.output}
);
console.log(✅ Draft complete (${draft.metadata.duration}ms)\n);
// Step 3: Review
console.log('🔍 Reviewer Agent working...');
const review = await runAgent(
reviewerConfig,
Review this article draft:\n\n${draft.output}
);
console.log(✅ Review complete (${review.metadata.duration}ms)\n);
// Summary
const totalTokens = research.metadata.tokensUsed
+ draft.metadata.tokensUsed
+ review.metadata.tokensUsed;
const totalTime = research.metadata.duration
+ draft.metadata.duration
+ review.metadata.duration;
console.log('📊 Pipeline Summary:');
console.log( Total tokens: ${totalTokens});
console.log( Total time: ${(totalTime / 1000).toFixed(1)}s);
console.log( Estimated cost: $${(totalTokens * 0.000003).toFixed(4)});
return { research, draft, review };
}
Step 5: Run It (5 minutes)
// src/index.ts
import { runPipeline } from './orchestrator';
runPipeline('How agentic AI is changing software testing in 2026')
.then(result => {
console.log('\n--- FINAL ARTICLE ---\n');
console.log(result.draft.output);
console.log('\n--- REVIEW ---\n');
console.log(result.review.output);
});
ANTHROPIC_API_KEY=your-key npx ts-node src/index.ts
What You'll See
The pipeline runs in sequence: Research (5-8 seconds) → Writing (8-12 seconds) → Review (5-8 seconds). Total: about 20-30 seconds for a complete researched, written, and reviewed article.
Typical cost: $0.01-0.03 per pipeline run using Sonnet.
Level Up: Adding Parallel Agents and Feedback Loops
The basic pipeline is sequential. Here's how to make it smarter:
Parallel Research
Run multiple research agents simultaneously — one for statistics, one for expert opinions, one for case studies:
const [stats, opinions, cases] = await Promise.all([
runAgent(statsResearcher, topic),
runAgent(opinionResearcher, topic),
runAgent(caseStudyResearcher, topic),
]);
Revision Loop
If the reviewer says REVISE, send feedback back to the writer:
let verdict = 'REVISE';
let attempts = 0;
while (verdict === 'REVISE' && attempts < 3) {
const revised = await runAgent(writerConfig,
`Revise based on this feedback:\n${review.output}\n\nOriginal:\n${draft.output}`);
const reReview = await runAgent(reviewerConfig, revised.output);
verdict = extractVerdict(reReview.output);
attempts++;
}
Real-World Applications
This same pattern works for:
- QA Testing: Agent 1 analyzes requirements → Agent 2 generates test cases → Agent 3 reviews for coverage gaps
- Code Review: Agent 1 checks security → Agent 2 checks performance → Agent 3 checks style → Orchestrator combines feedback
- Customer Support: Agent 1 classifies ticket → Agent 2 drafts response → Agent 3 checks tone and accuracy
- Data Analysis: Agent 1 cleans data → Agent 2 runs analysis → Agent 3 generates report
Common Mistakes to Avoid
- Making agents too general. A "do everything" agent is just a chatbot. Specialized agents with focused system prompts produce better results.
- Skipping the review agent. Quality control is the whole point of multi-agent systems. Always have a validator.
- Over-engineering orchestration. Start with simple sequential pipelines. Add parallel execution and feedback loops only when you need them.
- Ignoring cost tracking. Each agent call costs tokens. Log and monitor usage from day one.
Frequently Asked Questions
How is this different from just prompting Claude once?
A single prompt tries to do research, writing, and review in one pass — it's jack of all trades. Separate agents have focused system prompts, so each step gets 100% attention. The quality difference is noticeable, especially for complex tasks. Plus, you can swap individual agents (e.g., use a faster model for research, a better model for writing).
What does this cost to run?
Using Claude Sonnet 4.6: about $0.01-0.03 per pipeline run. Running 100 articles through this pipeline costs roughly $1-3. The cost scales linearly with the number of agents and their output length.
Can I use this with open-source models?
Absolutely. Replace the Anthropic SDK with an Ollama API call. DeepSeek-R1 running locally works well as a research and review agent. You lose some quality vs. Claude but gain privacy and zero cost per run.
Is this production-ready?
This tutorial is a starting point. For production, add: error handling and retries, structured output parsing (JSON mode), logging and observability, rate limiting, and human-in-the-loop checkpoints for critical decisions.
Next Steps
- Build this tutorial (seriously, it takes 2 hours)
- Modify agents for your domain (QA testing, code review, data analysis)
- Add parallel execution for speed
- Explore frameworks like LangChain or CrewAI for more complex orchestration
Want help building agentic AI systems for your team?
Related Articles:
Tayyab Akmal
AI & QA Automation Engineer
6 years of catching critical bugs in fintech, e-commerce, and SaaS — then building the Playwright and Selenium automation that prevents them from shipping again.