Sample-Project

Since you want to see how these two powerhouses work together, we’re going to build a "Content Engine" workflow. This is a classic "Multi-Agent" setup where the Researcher acts as the specialized input and the Writer acts as the polished output.

The Workflow: "The Fact-to-Feature Engine"

To make this work in CrewAI (code) or Langflow (visual), you need to give each agent a specific Task. Here are the exact prompts to use:

Step 1: The Research Task (For the Skeptic)

Assign to: Lead Investigative Researcher

Description: > "Research the top 3 current trends in [User Topic] for 2026. For each trend, find one primary source (original study or press release) and one secondary source (expert commentary). Identify the 'Hidden Pain Point'—the one thing people are struggling with that no one is talking about yet." Expected Output: > "A structured bulleted list of 3 trends, each with 2 verified links and a 1-sentence summary of the 'Hidden Pain Point'."

Step 2: The Writing Task (For the Copywriter)

Assign to: Senior Direct-Response Copywriter

Description: > "Review the research provided by the Lead Investigator. Using the 'Hidden Pain Points' identified, draft a high-impact LinkedIn post (max 200 words). Use the PAS Framework:

  1. Problem: Identify the pain point.

  2. Agitate: Explain why it’s getting worse.

  3. Solve: Introduce the trend as the solution. Ensure the tone is authoritative yet conversational." Expected Output: > "A 3-paragraph LinkedIn post with a hook, a body, and a clear Call to Action (CTA)."

🛠️ How to Chain Them Together (The "Secret Sauce")

If you are using CrewAI, you simply put them in a list: tasks=[task1, task2]. The framework automatically passes the output of the first task as the input for the second.

If you are using Langflow, you connect the Output of the Researcher's LLM node to the Input (or Context) of the Writer's LLM node.

Why this works:

  • Quality Control: The Writer is "forced" to use the facts from the Researcher. It can't just make things up.

  • Specialization: The Researcher doesn't have to worry about being "creative," and the Writer doesn't have to worry about "searching." They both stay in their zone of genius.

🚀 Professional-Level Challenge

If you want to take this to the next level, add a third agent: The Editor.

  • Role: Chief Quality Officer.

  • Task: "Review the Writer's post. If it contains any 'AI-isms' (like 'In the ever-evolving landscape' or 'delve into'), reject it and ask for a rewrite without those phrases."

To wrap things up, you’ve just gone from understanding AI Agents as "brains with hands" to seeing the exact Python architecture used to build a high-performing "Dream Team."

We’ve moved past the era of simple prompting. By chaining specialized agents together—a Skeptical Researcher, a Psychological Writer, and a Human-Centric Editor—you are no longer just using AI; you are managing a digital workforce.

Your Final Checklist for Building Agents

If you decide to start building tonight, keep these three rules in mind:

  1. Specific Personas: Never tell an agent "You are an AI." Tell it "You are a cynical investigative journalist." The more specific the "backstory," the better the reasoning.

  2. Modular Tasks: Don't give one agent a massive, vague goal. Break it down. One agent finds the facts; the next agent formats them.

  3. The "Search" Tool: To make the Researcher truly powerful, look into Serper.dev or Tavily. These are "Search APIs" that allow your CrewAI agents to browse the live internet in real-time.

To truly bridge the gap between "chatting" and "doing," your Researcher needs a way to look at the world. Adding a search tool is the final piece of the puzzle.

Here is the "3-line upgrade" to make your Researcher agent browse the web in real-time.

🛠️ The Web-Search Upgrade

You will need a free API key from Serper.dev (Google Search API) or Tavily. For this example, we'll use the SerperDevTool, which is natively supported by CrewAI.

Install the tool

Bash

pip install 'crewai[tools]'

Add these 3 lines to your script

Insert these at the top of your existing Python file:

Python

from crewai_tools import SerperDevTool

# Initialize the tool (it looks for SERPER_API_KEY in your .env)
search_tool = SerperDevTool()

# Update your researcher agent to use it
researcher = Agent(
    role='Lead Investigative Researcher',
    # ... (other settings)
    tools=[search_tool] # <--- This is the magic line
)

🏆 Final Summary: You are now an Agent Architect

You’ve covered the full spectrum of Agentic AI today:

  • The Concept: Moving from passive chatbots to active "doers."

  • The Anatomy: Understanding how LLMs use Memory, Planning, and Tools.

  • The Frameworks: Comparing code-heavy (CrewAI) vs. visual (Langflow) tools.

  • The Workflow: Designing a 3-agent "Dream Team" (Researcher → Writer → Editor).

  • The Action: Giving your agents "eyes" with real-time web search.

Your Mission

Go grab an API key, paste that script into a .py file, and run it. The first time you see your Researcher "Thought: I need to find the latest data on AI Agents" and then actually see it Executing Search, you’ll realize you’ve stepped into the next era of computing.

Code

Here is the complete "Dream Team" Python script using the CrewAI framework. This setup creates a sophisticated pipeline: the Researcher finds the facts, the Writer turns them into a story, and the Editor ensures it doesn't sound like a robot wrote it.

The 3-Agent "Dream Team" Script

Python

import os
from crewai import Agent, Task, Crew, Process

# Set your API Key (e.g., OpenAI, Anthropic, or Google Gemini)
os.environ["OPENAI_API_KEY"] = "your_api_key_here"

# 1. THE RESEARCHER: Focuses on data and skepticism
researcher = Agent(
    role='Lead Investigative Researcher',
    goal='Uncover 3 verifiable trends in {topic} for 2026.',
    backstory="""You are a cynical but brilliant data journalist. You 
    distrust marketing fluff and only care about primary sources and 
    hidden pain points that others miss.""",
    verbose=True,
    allow_delegation=False
)

# 2. THE WRITER: Focuses on psychology and conversion
writer = Agent(
    role='Senior Direct-Response Copywriter',
    goal='Write a high-impact post about {topic} based on research.',
    backstory="""You are a master of the PAS (Problem-Agitate-Solve) 
    framework. You turn dry data into emotional stories that drive 
    clicks and engagement.""",
    verbose=True,
    allow_delegation=False
)

# 3. THE EDITOR: Focuses on "Human" quality control
editor = Agent(
    role='Chief Quality Officer',
    goal='Remove all "AI-isms" and ensure the content sounds 100% human.',
    backstory="""You hate generic AI writing. If you see words like 
    'tapestry', 'delve', or 'ever-evolving', you rewrite the sentence 
    to be punchy and real.""",
    verbose=True,
    allow_delegation=True
)

# --- Define the Tasks ---

task_research = Task(
    description="Research the top 3 trends in {topic}. Identify one 'Hidden Pain Point' for each.",
    expected_output="A bulleted report with 3 trends and their specific pain points.",
    agent=researcher
)

task_write = Task(
    description="Using the research, write a 200-word post using the PAS framework.",
    expected_output="A high-converting post draft.",
    agent=writer,
    context=[task_research] # Ensures the writer sees the research
)

task_edit = Task(
    description="Audit the post for 'AI-isms'. Rewrite any section that feels robotic.",
    expected_output="The final, polished version of the post.",
    agent=editor,
    context=[task_write] # Ensures the editor sees the draft
)

# --- Assemble the Crew ---

crew = Crew(
    agents=[researcher, writer, editor],
    tasks=[task_research, task_write, task_edit],
    process=Process.sequential, # Tasks happen one after the other
    verbose=True
)

# Kickoff the process!
result = crew.kickoff(inputs={'topic': 'AI Agents in Healthcare'})
print("\n\n########################")
print("## FINAL OUTPUT ##")
print("########################\n")
print(result)

Why this is "High-Performance"

  1. Context Passing: Notice the context=[...] lines in the tasks. This ensures the Writer isn't just guessing—they are literally handed the Researcher's notes as their "source of truth."

  2. The "Kill Switch" for AI-isms: By giving the Editor the specific goal of removing "robotic" words, you bypass the biggest giveaway that content was generated by a LLM.

  3. Scalability: You can change the {topic} variable to anything—"Solar Energy," "Personal Finance," or "Coffee Trends"—and the entire 3-person team pivots instantly.

Professional-Tip for 2026: "Human-in-the-Loop"

If you want to be the ultimate manager, you can add human_input=True to the Editor's Task. The code will literally pause and ask you for feedback before finishing. It’s the best way to ensure the final result is exactly what you want.

 

Select Chapter