PageSourceSearch

https://www.srk.ai/blog/005-ai-news-agent-crewai

html srk.ai collected 2026-10-05 12:41:12 UTC 101,629 bytes, 92 lines download raw bytes

1<!DOCTYPE html><html lang="en-us" class="__variable_dd5b2f scroll-smooth"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" href="/_next/static/media/36966cca54120369-s.p.woff2" as="font" crossorigin="" type="font/woff2"/><link rel="stylesheet" href="/_next/static/css/824ef1099b5d1bd4.css" crossorigin="" data-precedence="next"/><link rel="stylesheet" href="/_next/static/css/e2a5f4ad9a266020.css" crossorigin="" data-precedence="next"/><link rel="stylesheet" href="/_next/static/css/8c9812502d811a31.css" crossorigin="" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-25257f396bb846df.js" crossorigin=""/>
1<script src="/_next/static/chunks/fd9d1056-e66136bb15f6dde5.js" async="" crossorigin=""></script>
1<script src="/_next/static/chunks/472-1aaea854751ef458.js" async="" crossorigin=""></script>
1<script src="/_next/static/chunks/main-app-892c3dff08e9cd4c.js" async="" crossorigin=""></script>
1<script src="/_next/static/chunks/326-67d0ba2aabdc60e1.js" async=""></script>
1<script src="/_next/static/chunks/app/layout-cfa8f721321ceef5.js" async=""></script>
1<script src="/_next/static/chunks/413-927ced89cacdf70c.js" async=""></script>
1<script src="/_next/static/chunks/app/blog/%5B...slug%5D/page-86dcd0cc51f19186.js" async=""></script>
1<link rel="preload" href="https://analytics.umami.is/script.js" as="script"/><title>News Agent using Crew AI | SRK&#x27;s blog</title><meta name="description" content="A simple news agent using Crew AI to summarize the latest news"/><meta name="robots" content="index, follow"/><meta name="googlebot" content="index, follow, max-video-preview:-1, max-image-preview:large, max-snippet:-1"/><link rel="canonical" href="https://srk.ai/blog/005-ai-news-agent-crewai"/><link rel="alternate" type="application/rss+xml" href="https://srk.ai//feed.xml"/><meta property="og:title" content="News Agent using Crew AI"/><meta property="og:description" content="A simple news agent using Crew AI to summarize the latest news"/><meta property="og:url" content="https://srk.ai/blog/005-ai-news-agent-crewai"/><meta property="og:site_name" content="SRK&#x27;s blog"/><meta property="og:locale" content="en_US"/><meta property="og:image" content="https://srk.ai//static/images/logo.png"/><meta property="og:type" content="article"/><meta property="article:published_time" content="2024-06-26T12:00:00.000Z"/><meta property="article:modified_time" content="2024-06-26T00:00:00.000Z"/><meta property="article:author" content="SRK"/><meta name="twitter:card" content="summary_large_image"/><meta name="twitter:title" content="News Agent using Crew AI"/><meta name="twitter:description" content="A simple news agent using Crew AI to summarize the latest news"/><meta name="twitter:image" content="https://srk.ai/static/images/logo.png"/><meta name="next-size-adjust"/><link rel="apple-touch-icon" sizes="76x76" href="/static/favicons/apple-touch-icon.png"/><link rel="icon" type="image/png" sizes="32x32" href="/static/favicons/favicon-32x32.png"/><link rel="icon" type="image/png" sizes="16x16" href="/static/favicons/favicon-16x16.png"/><link rel="manifest" href="/static/favicons/site.webmanifest"/><link rel="mask-icon" href="/static/favicons/safari-pinned-tab.svg" color="#5bbad5"/><meta name="msapplication-TileColor" content="#000000"/><meta name="theme-color" media="(prefers-color-scheme: light)" content="#fff"/><meta name="theme-color" media="(prefers-color-scheme: dark)" content="#000"/><link rel="alternate" type="application/rss+xml" href="/feed.xml"/>
1<script src="/_next/static/chunks/polyfills-c67a75d1b6f99dc8.js" crossorigin="" noModule=""></script>
1</head><body class="bg-white text-black antialiased dark:bg-gray-950 dark:text-white">
1<script>!function(){try{var d=document.documentElement,c=d.classList;c.remove('light','dark');var e=localStorage.getItem('theme');if('system'===e||(!e&&true)){var t='(prefers-color-scheme: dark)',m=window.matchMedia(t);if(m.media!==t||m.matches){d.style.colorScheme = 'dark';c.add('dark')}else{d.style.colorScheme = 'light';c.add('light')}}else if(e){c.add(e|| '')}if(e==='light'||e==='dark')d.style.colorScheme=e}catch(e){}}()</script>
1<section class="mx-auto max-w-3xl px-4 sm:px-6 xl:max-w-5xl xl:px-0"><div class="flex h-screen flex-col justify-between font-sans"><header class="flex items-center justify-between py-10"><div><a aria-label="SRK.AI" href="/"><div class="flex items-center justify-between"><div class=" h-6 text-2xl font-bold sm:block ">SRK.AI</div></div></a></div><div class="flex items-center space-x-4 leading-5 sm:space-x-6"><a class="hidden font-medium text-gray-900 dark:text-gray-100 sm:block" href="/blog">Blog</a><a class="hidden font-medium text-gray-900 dark:text-gray-100 sm:block" href="/tags">Tags</a><button aria-label="Search"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="h-6 w-6 text-gray-900 dark:text-gray-100"><path stroke-linecap="round" stroke-linejoin="round" d="M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z"></path></svg></button><button aria-label="Toggle Menu" class="sm:hidden"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="h-8 w-8 text-gray-900 dark:text-gray-100"><path fill-rule="evenodd" d="M3 5a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 10a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 15a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z" clip-rule="evenodd"></path></svg></button><div class="fixed left-0 top-0 z-10 h-full w-full transform bg-white opacity-95 duration-300 ease-in-out dark:bg-gray-950 dark:opacity-[0.98] translate-x-full"><div class="flex justify-end"><button class="mr-8 mt-11 h-8 w-8" aria-label="Toggle Menu"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="text-gray-900 dark:text-gray-100"><path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg></button></div><nav class="fixed mt-8 h-full"><div class="px-12 py-4"><a class="text-2xl font-bold tracking-widest text-gray-900 dark:text-gray-100" href="/">Home</a></div><div class="px-12 py-4"><a class="text-2xl font-bold tracking-widest text-gray-900 dark:text-gray-100" href="/blog">Blog</a></div><div class="px-12 py-4"><a class="text-2xl font-bold tracking-widest text-gray-900 dark:text-gray-100" href="/tags">Tags</a></div></nav></div></div></header><main class="mb-auto">
1<script type="application/ld+json">{"@context":"https://schema.org","@type":"BlogPosting","headline":"News Agent using Crew AI","datePublished":"2024-06-26T12:00:00.000Z","dateModified":"2024-06-26T00:00:00.000Z","description":"A simple news agent using Crew AI to summarize the latest news","image":"/static/images/logo.png","url":"https://srk.ai//blog/005-ai-news-agent-crewai","author":[{"@type":"Person","name":"SRK"}]}</script>
1<section class="mx-auto max-w-3xl px-4 sm:px-6 xl:max-w-5xl xl:px-0"><div class="fixed bottom-8 right-8 hidden flex-col gap-3 md:hidden"><button aria-label="Scroll To Top" class="rounded-full bg-gray-200 p-2 text-gray-500 transition-all hover:bg-gray-300 dark:bg-gray-700 dark:text-gray-400 dark:hover:bg-gray-600"><svg class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M3.293 9.707a1 1 0 010-1.414l6-6a1 1 0 011.414 0l6 6a1 1 0 01-1.414 1.414L11 5.414V17a1 1 0 11-2 0V5.414L4.707 9.707a1 1 0 01-1.414 0z" clip-rule="evenodd"></path></svg></button></div><article><div><header><div class="space-y-1 border-b border-gray-200 pb-10 text-center dark:border-gray-700"><dl><div><dt class="sr-only">Published on</dt><dd class="text-base font-medium leading-6 text-gray-500 dark:text-gray-400"><time dateTime="2024-06-26T12:00:00.000Z">June 26, 2024</time></dd></div></dl><div><h1 class="text-3xl font-extrabold leading-9 tracking-tight text-gray-900 dark:text-gray-100 sm:text-4xl sm:leading-10 md:text-5xl md:leading-14">News Agent using Crew AI</h1></div></div></header><div class="grid-rows-[auto_1fr] divide-y divide-gray-200 pb-8 dark:divide-gray-700 xl:divide-y-0"><div class="divide-y divide-gray-200 dark:divide-gray-700 xl:col-span-3 xl:row-span-2 xl:pb-0"><div class="prose max-w-none pb-8 pt-10 dark:prose-invert"><h2 id="summary"><a href="#summary" aria-hidden="true" tabindex="-1"><span class="icon icon-link"></span></a>Summary</h2><p>In this blog post, we will build an agentic workflow to get the latest news on a given topic and then summarize the main points from the news as the output. We will use duckduckgo for fetching the latest news and CrewAI for the agentic framework.</p><h2 id="multi-agent-systems"><a href="#multi-agent-systems" aria-hidden="true" tabindex="-1"><span class="icon icon-link"></span></a>Multi Agent Systems</h2><p>Multi-agent systems are becoming more common these days. Instead of relying on one LLM to get the output, agentic systems make use of multiple LLMs or tools to get the desired output. In most cases, this is achieved by breaking down a complex task into simpler tasks, which are then solved by individual agents..</p><h2 id="agentic-frameworks"><a href="#agentic-frameworks" aria-hidden="true" tabindex="-1"><span class="icon icon-link"></span></a>Agentic Frameworks</h2><p>As agentic systems are gaining more steam, agentic frameworks that help us build these systems are also on the rise. Some of the notable ones are <a target="_blank" rel="noopener noreferrer" href="https://microsoft.github.io/autogen/">AutoGen</a>, <a target="_blank" rel="noopener noreferrer" href="https://docs.crewai.com/">crewAI</a>, <a target="_blank" rel="noopener noreferrer" href="https://langchain-ai.github.io/langgraph/">LangGraph</a>, <a target="_blank" rel="noopener noreferrer" href="https://docs.phidata.com/introduction">phidata</a>.</p><p>In this blog post, we will use crewAI to build our agent system. There is a great course by deeplearning.ai on <a target="_blank" rel="noopener noreferrer" href="https://www.deeplearning.ai/short-courses/multi-ai-agent-systems-with-crewai/">Multi AI Agent Systems with crewAI</a> in case anyone is interested in learning more about it.</p><h2 id="news-agent"><a href="#news-agent" aria-hidden="true" tabindex="-1"><span class="icon icon-link"></span></a>News Agent</h2><p>Suppose say, we are interested in a particular stock or topic and we want to know the latest news on a daily basis. We can go and search for the news daily, try to read all the articles and then understand the core information.</p><p>Some challenges in this are</p><ul><li>It is time consuming to check through each article manually.</li><li>The same news will be repeated multiple times.</li><li>It becomes a repetitive task if we are interested in multiple topics.</li></ul><p>Instead, if we can build an agent system that searches for the latest news and summarizes the important points for us, it will be helpful. Let us try to build a simple agent system for that in this post.</p><h2 id="setting-up-the-environment"><a href="#setting-up-the-environment" aria-hidden="true" tabindex="-1"><span class="icon icon-link"></span></a>
1Setting up the environment</h2><p>We will need the following packages and so let us install them.</p><div class="relative"><pre><code class="code-highlight language-js"><span class="code-line">crewai
2</span><span class="code-line">crewai<span class="token punctuation">[</span>tools<span class="token punctuation">]</span>
3</span><span class="code-line">duckduckgo<span class="token operator">-</span>search
4</span><span class="code-line">openai
5</span></code></pre></div><p>Let us start with importing the necessary modules.</p><div class="relative"><pre><code class="language-python code-highlight"><span class="code-line"><span class="token keyword">import</span> os
6</span><span class="code-line"><span class="token keyword">from</span> crewai <span class="token keyword">import</span> Agent
7</span><span class="code-line"><span class="token keyword">from</span> crewai <span class="token keyword">import</span> Task
8</span><span class="code-line"><span class="token keyword">from</span> crewai_tools <span class="token keyword">import</span> BaseTool
9</span><span class="code-line"><span class="token keyword">from</span> duckduckgo_search <span class="token keyword">import</span> DDGS
10</span><span class="code-line">
11</span><span class="code-line"><span class="token keyword">from</span> dotenv <span class="token keyword">import</span> load_dotenv
12</span><span class="code-line">
13</span><span class="code-line">load_dotenv<span class="token punctuation">(</span><span class="token punctuation">)</span>
14</span></code></pre></div><p>We will use OpenAI <code>gpt-3.5-turbo</code> LLM model for our system and so let us set it up.</p><div class="relative"><pre><code class="language-python code-highlight"><span class="code-line">os<span class="token punctuation">.</span>environ<span class="token punctuation">[</span><span class="token string">&quot;OPENAI_MODEL_NAME&quot;</span><span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token string">&quot;gpt-3.5-turbo&quot;</span>
15</span></code></pre></div><h2 id="latest-news-search-tool"><a href="#latest-news-search-tool" aria-hidden="true" tabindex="-1"><span class="icon icon-link"></span></a>Latest News Search Tool</h2><p>We need to get the latest news on our topic of interest. So, let us create a &#x27;News Search Tool&#x27; for that. A tool generally helps with a specific capability like web scraping, searching the internet, file reading etc. crewAI itself has a lot of <a target="_blank" rel="noopener noreferrer" href="https://docs.crewai.com/core-concepts/Tools/#available-crewai-tools">inbuilt tools</a>, including a search tool using Serper.</p><p>Instead of using the Serper tool, which requires an API key we will make use of DuckDuckGo search. So, let us create a custom tool for the same.</p><div class="relative"><pre><code class="language-python code-highlight"><span class="code-line"><span class="token keyword">class</span> <span class="token class-name">NewsSearchTool</span><span class="token punctuation">(</span>BaseTool<span class="token punctuation">)</span><span class="token punctuation">:</span>
16</span><span class="code-line">    name<span class="token punctuation">:</span> <span class="token builtin">str</span> <span class="token operator">=</span> <span class="token string">&quot;Latest News Search tool&quot;</span>
17</span><span class="code-line">    description<span class="token punctuation">:</span> <span class="token builtin">str</span> <span class="token operator">=</span> <span class="token string">&quot;News search tool that searches the latest news on the given topic from internet and provides the results.&quot;</span>
18</span><span class="code-line">
19</span><span class="code-line">    <span class="token keyword">def</span> <span class="token function">_run</span><span class="token punctuation">(</span>self<span class="token punctuation">,</span> topic<span class="token punctuation">:</span> <span class="token builtin">str</span><span class="token punctuation">)</span> <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token builtin">str</span><span class="token punctuation">:</span>
20</span><span class="code-line">
20        <span class="token comment"># Using the duckduckgo python module</span>
21</span><span class="code-line">        ddgs <span class="token operator">=</span> DDGS<span class="token punctuation">(</span><span class="token punctuation">)</span>
22</span><span class="code-line">        <span class="token comment"># Fetching the latest news from last 1 day on a given topic</span>
23</span><span class="code-line">        results <span class="token operator">=</span> ddgs<span class="token punctuation">.</span>news<span class="token punctuation">(</span>keywords<span class="token operator">=</span>topic<span class="token punctuation">,</span> timelimit<span class="token operator">=</span><span class="token string">&quot;d&quot;</span><span class="token punctuation">,</span> max_results<span class="token operator">=</span><span class="token number">20</span><span class="token punctuation">)</span>
24</span><span class="code-line">        result_string<span class="token operator">=</span><span class="token string">&quot;&quot;</span>
25</span><span class="code-line">        <span class="token comment"># Combine the news topic and description</span>
26</span><span class="code-line">        <span class="token keyword">for</span> result <span class="token keyword">in</span> results<span class="token punctuation">:</span>
27</span><span class="code-line">            result_string <span class="token operator">+=</span> <span class="token string-interpolation"><span class="token string">f&quot;Title: </span><span class="token interpolation"><span class="token punctuation">{</span>result<span class="token punctuation">[</span><span class="token string">&#x27;title&#x27;</span><span class="token punctuation">]</span><span class="token punctuation">}</span></span><span class="token string"> \n Description: </span><span class="token interpolation"><span class="token punctuation">{</span>result<span class="token punctuation">[</span><span class="token string">&#x27;body&#x27;</span><span class="token punctuation">]</span><span class="token punctuation">}</span></span><span class="token string">\n\n&quot;</span></span>
28</span><span class="code-line">        <span class="token comment"># In case if there are no news</span>
29</span><span class="code-line">        <span class="token keyword">if</span> <span class="token builtin">len</span><span class="token punctuation">(</span>result_string<span class="token punctuation">.</span>strip<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token operator">&lt;</span> <span class="token number">2</span><span class="token punctuation">:</span>
30</span><span class="code-line">            result_string<span class="token operator">=</span><span class="token string">&quot;No news found for the given keyword&quot;</span>
31</span><span class="code-line">        <span class="token keyword">return</span> result_string<span class="token punctuation">.</span>strip<span class="token punctuation">(</span><span class="token punctuation">)</span>
32</span><span class="code-line">
33</span><span class="code-line">news_search_tool <span class="token operator">=</span> NewsSearchTool<span class="token punctuation">(</span><span class="token punctuation">)</span>
34</span></code></pre></div><p>Here, we are subclassing the BaseTool in crewAI to create our own tool. We need to provide a clear <code>name</code> and <code>description</code> so that the LLM agent can make use of the tool effectively. We are using <code>DDGS().news()</code> from DuckDuckGo to get the latest 20 news articles and then combining their titles and descriptions to get the final result.</p><h2 id="agents"><a href="#agents" aria-hidden="true" tabindex="-1"><span class="icon icon-link"></span></a>Agents</h2><p>Now let us create agents for our task. We will create two agents:</p><ul><li>Reasearcher agent: This LLM agent will use the news search tool to research about a specific topic and provide the results.</li><li>Summarizer agent: This LLM agent will summarize the news provided by the researcher agent.</li></ul><h4 id="researcher-agent"><a href="#researcher-agent" aria-hidden="true" tabindex="-1"><span class="icon icon-link"></span></a>Researcher Agent</h4><p>In crewAI, we can use the <code>Agent</code> to create the agents. We need to provide the <code>role</code>, <code>goal</code>, <code>backstory</code> and <code>tools</code> to the agent.</p><div class="relative"><pre><code class="language-python code-highlight"><span class="code-line"><span class="token comment"># Creating a researcher agent with memory and verbose mode</span>
35</span><span class="code-line">researcher <span class="token operator">=</span> Agent<span class="token punctuation">(</span>
36</span><span class="code-line">  role<span class="token operator">=</span><span class="token string">&#x27;Researcher&#x27;</span><span class="token punctuation">,</span>
37</span><span class="code-line">  goal<span class="token operator">=</span><span class="token string">&#x27;Get the latest news in {topic}&#x27;</span><span class="token punctuation">,</span>
38</span><span class="code-line">  verbose<span class="token operator">=</span><span class="token boolean">True</span><span class="token punctuation">,</span>
39</span><span class="code-line">  memory<span class="token operator">=</span><span class="token boolean">True</span><span class="token punctuation">,</span>
40</span><span class="code-line">  backstory<span class="token operator">=</span><span class="token punctuation">(</span>
41</span><span class="code-line">
41      <span class="token string">&quot;As a knowledge enthusiast, you always look for new happenings on a given topic &quot;</span>
42</span><span class="code-line">      <span class="token string">&quot;and share the knowledge with broader community.&quot;</span>
43</span><span class="code-line">  <span class="token punctuation">)</span><span class="token punctuation">,</span>
44</span><span class="code-line">  tools<span class="token operator">=</span><span class="token punctuation">[</span>news_search_tool<span class="token punctuation">]</span><span class="token punctuation">,</span>
45</span><span class="code-line"><span class="token punctuation">)</span>
46</span></code></pre></div><h4 id="summarizer-agent"><a href="#summarizer-agent" aria-hidden="true" tabindex="-1"><span class="icon icon-link"></span></a>Summarizer Agent</h4><p>Similarly let us now create a summarizer agent by providing its <code>role</code>, <code>goal</code>, <code>backstory</code> and <code>tools</code>.</p><div class="relative"><pre><code class="language-python code-highlight"><span class="code-line"><span class="token comment"># Creating a summarizer agent with custom tools and delegation capability</span>
47</span><span class="code-line">summarizer <span class="token operator">=</span> Agent<span class="token punctuation">(</span>
48</span><span class="code-line">  role<span class="token operator">=</span><span class="token string">&#x27;Summarizer&#x27;</span><span class="token punctuation">,</span>
49</span><span class="code-line">  goal<span class="token operator">=</span><span class="token string">&#x27;Summarize the latest news in {topic}&#x27;</span><span class="token punctuation">,</span>
50</span><span class="code-line">  verbose<span class="token operator">=</span><span class="token boolean">True</span><span class="token punctuation">,</span>
51</span><span class="code-line">  memory<span class="token operator">=</span><span class="token boolean">True</span><span class="token punctuation">,</span>
52</span><span class="code-line">  backstory<span class="token operator">=</span><span class="token punctuation">(</span>
53</span><span class="code-line">    <span class="token string">&quot;With a flair for simplifying complex topics, you &quot;</span>
54</span><span class="code-line">    <span class="token string">&quot;remove redundant information and summarize the &quot;</span>
55</span><span class="code-line">    <span class="token string">&quot;discoveries in an accessible manner.&quot;</span>
56</span><span class="code-line">  <span class="token punctuation">)</span><span class="token punctuation">,</span>
57</span><span class="code-line">  allow_delegation<span class="token operator">=</span><span class="token boolean">False</span>
58</span><span class="code-line"><span class="token punctuation">)</span>
59</span></code></pre></div><h2 id="tasks"><a href="#tasks" aria-hidden="true" tabindex="-1"><span class="icon icon-link"></span></a>Tasks</h2><p>Now we need to specify the tasks that each of these agents need to perform. We will have two tasks</p><ul><li>Research Task: This task uses the news search tool to get the latest news.</li><li>Summarize Task: This task summarizes the news into 2 or 3 bullet points.</li></ul><div class="relative"><pre><code class="language-python code-highlight"><span class="code-line"><span class="token comment"># Research task</span>
60</span><span class="code-line">research_task <span class="token operator">=</span> Task<span class="token punctuation">(</span>
61</span><span class="code-line">    description<span class="token operator">=</span><span class="token punctuation">(</span>
62</span><span class="code-line">    <span class="token string">&quot;Get the latest news in {topic}.&quot;</span>
63</span><span class="code-line">    <span class="token punctuation">)</span><span class="token punctuation">,</span>
64</span><span class="code-line">    expected_output<span class="token operator">=</span><span class="token string">&#x27;Points covering the latest news on {topic}.&#x27;</span><span class="token punctuation">,</span>
65</span><span class="code-line">    tools<span class="token operator">=</span><span class="token punctuation">[</span>news_search_tool<span class="token punctuation">]</span><span class="token punctuation">,</span>
66</span><span class="code-line">    agent<span class="token operator">=</span>researcher<span class="token punctuation">,</span>
67</span><span class="code-line"><span class="token punctuation">)</span>
68</span><span class="code-line">
69</span><span class="code-line"><span class="token comment"># Summarizer task </span>
70</span><span class="code-line">summarize_task <span class="token operator">=</span> Task<span class="token punctuation">(</span>
71</span><span class="code-line">    description<span class="token operator">=</span><span class="token punctuation">(</span>
72</span><span class="code-line">
72      <span class="token string">&quot;Given all the news about the {topic}, summarize them to 2 or 3 bullet points.&quot;</span>
73</span><span class="code-line">      <span class="token string">&quot;Discard the news which do not have central focus on {topic}.&quot;</span>
74</span><span class="code-line">      <span class="token string">&quot;If no news is relevant, return that no news found for the {topic}&quot;</span>
75</span><span class="code-line">    <span class="token punctuation">)</span><span class="token punctuation">,</span>
76</span><span class="code-line">    expected_output<span class="token operator">=</span><span class="token punctuation">(</span>
77</span><span class="code-line">    <span class="token string">&quot;2 or 3 summarized bullet points, each one focussing on one specific news &quot;</span>
78</span><span class="code-line">    <span class="token string">&quot;about the {topic}. If no news found, return no news found&quot;</span>
79</span><span class="code-line">    <span class="token punctuation">)</span><span class="token punctuation">,</span>
80</span><span class="code-line">    agent<span class="token operator">=</span>summarizer<span class="token punctuation">,</span>
81</span><span class="code-line">    output_file<span class="token operator">=</span><span class="token string">&#x27;news_summary.md&#x27;</span><span class="token punctuation">,</span>  <span class="token comment"># Example of output customization</span>
82</span><span class="code-line"><span class="token punctuation">)</span>
83</span></code></pre></div><p>As seen above, we need to specify the <code>description</code> and the <code>expected_output</code> of the task and the agent to which the task is assigned. We can also optionally specify the <code>output_file</code> to save the output of the task.</p><h2 id="kickoff"><a href="#kickoff" aria-hidden="true" tabindex="-1"><span class="icon icon-link"></span></a>Kickoff</h2><p>Now let us form the crew (agentic system) using the created agents and tasks, and start the process.</p><div class="relative"><pre><code class="language-python code-highlight"><span class="code-line"><span class="token comment"># Forming the tech-focused crew with some enhanced configurations</span>
84</span><span class="code-line">crew <span class="token operator">=</span> Crew<span class="token punctuation">(</span>
85</span><span class="code-line">  agents<span class="token operator">=</span><span class="token punctuation">[</span>researcher<span class="token punctuation">,</span> summarizer<span class="token punctuation">]</span><span class="token punctuation">,</span>
86</span><span class="code-line">  tasks<span class="token operator">=</span><span class="token punctuation">[</span>research_task<span class="token punctuation">,</span> summarize_task<span class="token punctuation">]</span><span class="token punctuation">,</span>
87</span><span class="code-line">  process<span class="token operator">=</span>Process<span class="token punctuation">.</span>sequential<span class="token punctuation">,</span>  <span class="token comment"># Optional: Sequential task execution is default</span>
88</span><span class="code-line"><span class="token punctuation">)</span>
89</span><span class="code-line">
90</span><span class="code-line">result <span class="token operator">=</span> crew<span class="token punctuation">.</span>kickoff<span class="token punctuation">(</span>inputs<span class="token operator">=</span><span class="token punctuation">{</span><span class="token string">&#x27;topic&#x27;</span><span class="token punctuation">:</span> <span class="token string">&#x27;HDFC Bank&#x27;</span><span class="token punctuation">}</span><span class="token punctuation">)</span>
91</span><span class="code-line"><span class="token keyword">print</span><span class="token punctuation">(</span>result<span class="token punctuation">)</span>
92</span></code></pre></div><p>In this example, we have searched for <code>HDFC Bank</code> topic and the crew started working.</p><div><img alt="crew_start" loading="lazy" width="1908" height="404" decoding="async" data-nimg="1" style="color:transparent" srcSet="/_next/image?url=%2Fstatic%2Fimages%2Fblogs%2F005%2Fcrew_start.png&amp;w=1920&amp;q=75 1x, /_next/image?url=%2Fstatic%2Fimages%2Fblogs%2F005%2Fcrew_start.png&amp;w=3840&amp;q=75 2x" src="/_next/image?url=%2Fstatic%2Fimages%2Fblogs%2F005%2Fcrew_start.png&amp;w=3840&amp;q=75"/></div><div>The results are <img alt="crew_result" loading="lazy" width="2176" height="280" decoding="async" data-nimg="1" style="color:transparent" srcSet="/_next/image?url=%2Fstatic%2Fimages%2Fblogs%2F005%2Fcrew_result.png&amp;w=3840&amp;q=75 1x" src="/_next/image?url=%2Fstatic%2Fimages%2Fblogs%2F005%2Fcrew_result.png&amp;w=3840&amp;q=75"/></div><h2 id="conclusion"><a href="#conclusion" aria-hidden="true" tabindex="-1"><span class="icon icon-link"></span></a>Conclusion</h2><p>In this blog post, we saw how to build a simple news agent for our topic of interest using crewAI. Let&#x27;s explore more agentic systems in our future blogs.</p><p>Code used for this blog post is present in this <a target="_blank" rel="noopener noreferrer" href="https://github.com/SudalaiRajkumar/srk_ai_blog/blob/master/005-NewsAgent_CrewAI/005_NewsAgent_CrewAI.ipynb">notebook</a>.</p></div></div><div class="pb-6 pt-6 text-center text-gray-700 dark:text-gray-300" id="comment"></div><footer><div class="flex flex-col text-sm font-medium sm:flex-row sm:justify-between sm:text-base"><div class="pt-4 xl:pt-8"><a class="text-primary-500 hover:text-primary-600 dark:hover:text-primary-400" aria-label="Previous post: RAG - Encoder and Reranker evaluation" href="/blog/004-ai-llm-retrieval-eval-llamaindex">← <!-- -->RAG - Encoder and Reranker evaluation</a></div></div></footer></div></div></article></section></main><footer><div class="mt-16 flex flex-col items-center"><div class="mb-3 flex space-x-4"><a class="text-sm text-gray-500 transition hover:text-gray-600" target="_blank" rel="noopener noreferrer" href="https://github.com/SudalaiRajkumar"><span class="sr-only">github</span><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" class="fill-current text-gray-700 hover:text-primary-500 dark:text-gray-200 dark:hover:text-primary-400 h-6 w-6"><path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"></path></svg></a><a class="text-sm text-gray-500 transition hover:text-gray-600" target="_blank" rel="noopener noreferrer" href="https://www.linkedin.com"><span class="sr-only">linkedin</span><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" class="fill-current text-gray-700 hover:text-primary-500 dark:text-gray-200 dark:hover:text-primary-400 h-6 w-6"><path d="M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 01-2.063-2.065 2.064 2.064 0 112.063 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"></path></svg></a><a class="text-sm text-gray-500 transition hover:text-gray-600" target="_blank" rel="noopener noreferrer" href="https://twitter.com/sudalairajkumar"><span class="sr-only">twitter</span><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" class="fill-current text-gray-700 hover:text-primary-500 dark:text-gray-200 dark:hover:text-primary-400 h-6 w-6"><path d="M23.953 4.57a10 10 0 01-2.825.775 4.958 4.958 0 002.163-2.723c-.951.555-2.005.959-3.127 1.184a4.92 4.92 0 00-8.384 4.482C7.69 8.095 4.067 6.13 1.64 3.162a4.822 4.822 0 00-.666 2.475c0 1.71.87 3.213 2.188 4.096a4.904 4.904 0 01-2.228-.616v.06a4.923 4.923 0 003.946 4.827 4.996 4.996 0 01-2.212.085 4.936 4.936 0 004.604 3.417 9.867 9.867 0 01-6.102 2.105c-.39 0-.779-.023-1.17-.067a13.995 13.995 0 007.557 2.209c9.053 0 13.998-7.496 13.998-13.985 0-.21 0-.42-.015-.63A9.935 9.935 0 0024 4.59z"></path></svg></a><a class="text-sm text-gray-500 transition hover:text-gray-600" target="_blank" rel="noopener noreferrer" href="https://www.kaggle.com/sudalairajkumar"><span class="sr-only">kaggle</span><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" class="fill-current text-gray-700 hover:text-primary-500 dark:text-gray-200 dark:hover:text-primary-400 h-6 w-6"><path d="M.1025 7.3475c-.0681 0-.1022.0341-.1022.102v6.752c0 .0681.034.1022.1022.1022h.7049c.068 0 .1022-.034.1022-.1023v-1.481l.4187-.3985 1.5016 1.91c.041.0477.0884.0716.143.0716h.9091c.0476 0 .0748-.0135.0817-.0407.0135-.041.0066-.075-.0206-.1023l-1.9816-2.4618 1.9002-1.8384c.0204-.0205.0237-.051.01-.092-.0137-.0339-.0408-.051-.0816-.051h-.9398c-.0477 0-.0953.024-.143.0716L.9096 11.607V7.4496c0-.0679-.0342-.102-.1022-.102zm18.0417 0c-.068 0-.102.0341-.102.102v6.752c0 .0681.034.102.102.102h.705c.068 0 .102-.034.102-.102v-6.752c0-.068-.034-.102-.102-.102zM5.961 9.6254c-.5653 0-1.11.1806-1.6343.5415-.0545.0545-.0648.102-.0307.143l.3676.5208c.0272.0477.0717.0545.133.0204.3948-.2722.783-.4086 1.1644-.4086.2927 0 .5158.0886.669.2656.1532.1771.2197.3917.1992.6436-.6606.0681-1.1545.1495-1.4813.245-.8308.2383-1.2461.6913-1.2461 1.3586 0 .4222.1533.7695.4598 1.0419.3132.2654.6845.3982 1.1134.3982.4698 0 .8545-.1125 1.1542-.3372v.1432c0 .0682.0374.102.1123.102h.7048c.068 0 .102-.0338.102-.102V11.372c0-.6604-.2245-1.1406-.6739-1.4403-.3065-.2043-.6776-.3063-1.1134-.3063zm4.3225 0c-.6742 0-1.195.2622-1.5627.7865-.3133.4359-.4699.9671-.4699 1.5936 0 .6604.1634 1.2087.4903 1.6444.3744.4972.892.7455 1.5526.7455.5313 0 .9567-.1327 1.2768-.3982v.531c0 .858-.4122 1.287-1.236 1.287-.361 0-.732-.1907-1.1132-.572a.098.098 0 00-.0716-.0306c-.034 0-.0613.0102-.0817.0307l-.4802.48c-.0408.0613-.0375.1124.0103.1532.1361.1157.2554.2129.3576.2911.102.0783.1905.1413.2656.189.354.1975.7284.2961 1.1235.2961.6808 0 1.207-.1925 1.5781-.577.3711-.3848.5567-.9484.5567-1.6903V9.8196c0-.068-.034-.102-.102-.102h-.705c-.0682 0-.1021.034-.1021.102v.2043c-.3471-.2657-.7763-.3985-1.287-.3985zm4.8021 0c-.6742 0-1.195.2622-1.5627.7865-.3132.4359-.4699.9671-.4699 1.5936 0 .6604.1633 1.2087.4903 1.6444.3744.4972.892.7455 1.5526.7455.5311 0 .9566-.1327 1.2768-.3982v.531c0 .858-.4122 1.287-1.236 1.287-.361 0-.732-.1907-1.1133-.572a.098.098 0 00-.0716-.0306c-.034 0-.0612.0102-.0816.0307l-.48.48c-.0409.0613-.0376.1124.01.1532.1363.1157.2555.2129.3576.2911.1021.0783.1906.
921413.2657.189.354.1975.7285.2961 1.1237.2961.6808 0 1.2068-.1925 1.5781-.577.371-.3848.5565-.9484.5565-1.6903V9.8196c0-.068-.034-.102-.102-.102h-.7049c-.0682 0-.1022.034-.1022.102v.2043c-.3474-.2657-.7763-.3985-1.287-.3985zm6.7457 0c-.6537 0-1.185.211-1.5936.6332-.4427.4632-.664 1.0283-.664 1.6956 0 .7083.225 1.2905.6743 1.7467.463.463 1.042.6945 1.7366.6945.6467 0 1.2154-.1838 1.7057-.5515.0545-.041.0545-.0884 0-.143l-.4802-.4903c-.041-.0409-.0919-.0409-.1533 0-.2998.2112-.6368.3167-1.0112.3167-.4222 0-.7729-.119-1.052-.3576-.2452-.2248-.3882-.5038-.429-.8375h3.3197c.0679 0 .1022-.0341.1022-.1023l.01-.2244c.0341-.6878-.1668-1.26-.6025-1.7162-.4224-.4426-.9432-.664-1.5627-.664zm-.0206.7865c.3268 0 .6062.1056.8377.3166.2452.211.371.4734.378.7865h-2.4618c.0613-.3269.2077-.5925.4392-.7968.2313-.2042.5004-.3063.8069-.3063zm-11.4249.102c.6196 0 1.0146.2181 1.1848.6538v1.6854c-.1702.4358-.5755.6538-1.2155.6538-.3133 0-.5687-.0986-.7661-.2963-.2656-.2518-.3983-.6538-.3983-1.2053 0-.9941.3984-1.4914 1.1951-1.4914zm4.802 0c.6196 0 1.0148.2181 1.1851.6538h-.0002v1.6854c-.1703.4358-.5755.6538-1.2155.6538-.3132 0-.5686-.0986-.7661-.2963-.2655-.2518-.3983-.6538-.3983-1.2053 0-.9941.3983-1.4914 1.195-1.4914zm-8.3586 1.6547v1.0215c-.286.286-.6675.412-1.1441.3779-.1703-.0135-.32-.0663-.4493-.1582-.1294-.0919-.2045-.2129-.2249-.3627-.0341-.2657.1158-.47.4495-.6129.2452-.1088.7013-.1974 1.3688-.2656z"></path></svg></a></div><div class="mb-2 flex space-x-2 text-sm text-gray-500 dark:text-gray-400"><div>Sudalai Rajkumar</div><div> • </div><div>© 2026</div><div> • </div><a href="/">SRK&#x27;s blog</a></div><div class="mb-8 hidden text-sm text-gray-500 dark:text-gray-400"><a target="_blank" rel="noopener noreferrer" href="https://github.com/timlrx/tailwind-nextjs-starter-blog">Tailwind Nextjs Theme</a></div></div></footer></div></section>
92<script src="/_next/static/chunks/webpack-25257f396bb846df.js" crossorigin="" async=""></script>
92<script>(self.__next_f=self.__next_f||[]).push([0]);self.__next_f.push([2,null])</script>
92<script>self.__next_f.push([1,"1:HL[\"/_next/static/media/36966cca54120369-s.p.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n2:HL[\"/_next/static/css/824ef1099b5d1bd4.css\",\"style\",{\"crossOrigin\":\"\"}]\n3:HL[\"/_next/static/css/e2a5f4ad9a266020.css\",\"style\",{\"crossOrigin\":\"\"}]\n0:\"$L4\"\n"])</script>
92<script>self.__next_f.push([1,"5:HL[\"/_next/static/css/8c9812502d811a31.css\",\"style\",{\"crossOrigin\":\"\"}]\n"])</script>
92<script>self.__next_f.push([1,"6:I[3728,[],\"\"]\n8:I[9928,[],\"\"]\n9:I[7821,[\"326\",\"static/chunks/326-67d0ba2aabdc60e1.js\",\"185\",\"static/chunks/app/layout-cfa8f721321ceef5.js\"],\"ThemeProviders\"]\na:I[3994,[\"326\",\"static/chunks/326-67d0ba2aabdc60e1.js\",\"185\",\"static/chunks/app/layout-cfa8f721321ceef5.js\"],\"\"]\nb:I[8251,[\"326\",\"static/chunks/326-67d0ba2aabdc60e1.js\",\"185\",\"static/chunks/app/layout-cfa8f721321ceef5.js\"],\"KBarSearchProvider\"]\nc:I[8326,[\"326\",\"static/chunks/326-67d0ba2aabdc60e1.js\",\"413\",\"static/chunks/413-927ced89cacdf70c.js\",\"797"])</script>
92<script>self.__next_f.push([1,"\",\"static/chunks/app/blog/%5B...slug%5D/page-86dcd0cc51f19186.js\"],\"\"]\nd:I[7005,[\"326\",\"static/chunks/326-67d0ba2aabdc60e1.js\",\"185\",\"static/chunks/app/layout-cfa8f721321ceef5.js\"],\"KBarButton\"]\ne:I[5235,[\"326\",\"static/chunks/326-67d0ba2aabdc60e1.js\",\"185\",\"static/chunks/app/layout-cfa8f721321ceef5.js\"],\"\"]\nf:I[2298,[\"326\",\"static/chunks/326-67d0ba2aabdc60e1.js\",\"185\",\"static/chunks/app/layout-cfa8f721321ceef5.js\"],\"\"]\n10:I[6954,[],\"\"]\n11:I[7264,[],\"\"]\n14:Td7f,"])</script>
92<script>self.__next_f.push([1,"M.1025 7.3475c-.0681 0-.1022.0341-.1022.102v6.752c0 .0681.034.1022.1022.1022h.7049c.068 0 .1022-.034.1022-.1023v-1.481l.4187-.3985 1.5016 1.91c.041.0477.0884.0716.143.0716h.9091c.0476 0 .0748-.0135.0817-.0407.0135-.041.0066-.075-.0206-.1023l-1.9816-2.4618 1.9002-1.8384c.0204-.0205.0237-.051.01-.092-.0137-.0339-.0408-.051-.0816-.051h-.9398c-.0477 0-.0953.024-.143.0716L.9096 11.607V7.4496c0-.0679-.0342-.102-.1022-.102zm18.0417 0c-.068 0-.102.0341-.102.102v6.752c0 .0681.034.102.102.102h.705c.068 0 .102-.034.102-.102v-6.752c0-.068-.034-.102-.102-.102zM5.961 9.6254c-.5653 0-1.11.1806-1.6343.5415-.0545.0545-.0648.102-.0307.143l.3676.5208c.0272.0477.0717.0545.133.0204.3948-.2722.783-.4086 1.1644-.4086.2927 0 .5158.0886.669.2656.1532.1771.2197.3917.1992.6436-.6606.0681-1.1545.1495-1.4813.245-.8308.2383-1.2461.6913-1.2461 1.3586 0 .4222.1533.7695.4598 1.0419.3132.2654.6845.3982 1.1134.3982.4698 0 .8545-.1125 1.1542-.3372v.1432c0 .0682.0374.102.1123.102h.7048c.068 0 .102-.0338.102-.102V11.372c0-.6604-.2245-1.1406-.6739-1.4403-.3065-.2043-.6776-.3063-1.1134-.3063zm4.3225 0c-.6742 0-1.195.2622-1.5627.7865-.3133.4359-.4699.9671-.4699 1.5936 0 .6604.1634 1.2087.4903 1.6444.3744.4972.892.7455 1.5526.7455.5313 0 .9567-.1327 1.2768-.3982v.531c0 .858-.4122 1.287-1.236 1.287-.361 0-.732-.1907-1.1132-.572a.098.098 0 00-.0716-.0306c-.034 0-.0613.0102-.0817.0307l-.4802.48c-.0408.0613-.0375.1124.0103.1532.1361.1157.2554.2129.3576.2911.102.0783.1905.1413.2656.189.354.1975.7284.2961 1.1235.2961.6808 0 1.207-.1925 1.5781-.577.3711-.3848.5567-.9484.5567-1.6903V9.8196c0-.068-.034-.102-.102-.102h-.705c-.0682 0-.1021.034-.1021.102v.2043c-.3471-.2657-.7763-.3985-1.287-.3985zm4.8021 0c-.6742 0-1.195.2622-1.5627.7865-.3132.4359-.4699.9671-.4699 1.5936 0 .6604.1633 1.2087.4903 1.6444.3744.4972.892.7455 1.5526.7455.5311 0 .9566-.1327 1.2768-.3982v.531c0 .858-.4122 1.287-1.236 1.287-.361 0-.732-.1907-1.1133-.572a.098.098 0 00-.0716-.0306c-.034 0-.0612.0102-.0816.0307l-.48.48c-.0409.0613-.0376.1124.01.1532.1363.1157.2555.2129.3576.2911.1021.0783.1906.1413.2657.189.354.1975.7285.2961 1.1237.2961.6808 0 1.2068-.1925 1.5781-.577.371-.3848.5565-.9484.5565-1.6903V9.8196c0-.068-.034-.102-.102-.102h-.7049c-.0682 0-.1022.034-.1022.102v.2043c-.3474-.2657-.7763-.3985-1.287-.3985zm6.7457 0c-.6537 0-1.185.211-1.5936.6332-.4427.4632-.664 1.0283-.664 1.6956 0 .7083.225 1.2905.6743 1.7467.463.463 1.042.6945 1.7366.6945.6467 0 1.2154-.1838 1.7057-.5515.0545-.041.0545-.0884 0-.143l-.4802-.4903c-.041-.0409-.0919-.0409-.1533 0-.2998.2112-.6368.3167-1.0112.3167-.4222 0-.7729-.119-1.052-.3576-.2452-.2248-.3882-.5038-.429-.8375h3.3197c.0679 0 .1022-.0341.1022-.1023l.01-.2244c.0341-.6878-.1668-1.26-.6025-1.7162-.4224-.4426-.9432-.664-1.5627-.664zm-.0206.7865c.3268 0 .6062.1056.8377.3166.2452.211.371.4734.378.7865h-2.4618c.0613-.3269.2077-.5925.4392-.7968.2313-.2042.5004-.3063.8069-.3063zm-11.4249.102c.6196 0 1.0146.2181 1.1848.6538v1.6854c-.1702.4358-.5755.6538-1.2155.6538-.3133 0-.5687-.0986-.7661-.2963-.2656-.2518-.3983-.6538-.3983-1.2053 0-.9941.3984-1.4914 1.1951-1.4914zm4.802 0c.6196 0 1.0148.2181 1.1851.6538h-.0002v1.6854c-.1703.4358-.5755.6538-1.2155.6538-.3132 0-.5686-.0986-.7661-.2963-.2655-.2518-.3983-.6538-.3983-1.2053 0-.9941.3983-1.4914 1.195-1.4914zm-8.3586 1.6547v1.0215c-.286.286-.6675.412-1.1441.3779-.1703-.0135-.32-.0663-.4493-.1582-.1294-.0919-.2045-.2129-.2249-.3627-.0341-.2657.1158-.47.4495-.6129.2452-.1088.7013-.1974 1.3688-.2656z"])</script>
92<script>self.__next_f.push([1,"4:[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/824ef1099b5d1bd4.css\",\"precedence\":\"next\",\"crossOrigin\":\"\"}],[\"$\",\"link\",\"1\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/e2a5f4ad9a266020.css\",\"precedence\":\"next\",\"crossOrigin\":\"\"}]],[\"$\",\"$L6\",null,{\"buildId\":\"QEup1Kc9fjHAfpsfG3nAC\",\"assetPrefix\":\"\",\"initialCanonicalUrl\":\"/blog/005-ai-news-agent-crewai\",\"initialTree\":[\"\",{\"children\":[\"blog\",{\"children\":[[\"slug\",\"005-ai-news-agent-crewai\",\"c\"],{\"children\":[\"__PAGE__?{\\\"slug\\\":[\\\"005-ai-news-agent-crewai\\\"]}\",{}]}]}]},\"$undefined\",\"$undefined\",true],\"initialHead\":[false,\"$L7\"],\"globalErrorComponent\":\"$8\",\"children\":[null,[\"$\",\"html\",null,{\"lang\":\"en-us\",\"className\":\"__variable_dd5b2f scroll-smooth\",\"suppressHydrationWarning\":true,\"children\":[[\"$\",\"link\",null,{\"rel\":\"apple-touch-icon\",\"sizes\":\"76x76\",\"href\":\"/static/favicons/apple-touch-icon.png\"}],[\"$\",\"link\",null,{\"rel\":\"icon\",\"type\":\"image/png\",\"sizes\":\"32x32\",\"href\":\"/static/favicons/favicon-32x32.png\"}],[\"$\",\"link\",null,{\"rel\":\"icon\",\"type\":\"image/png\",\"sizes\":\"16x16\",\"href\":\"/static/favicons/favicon-16x16.png\"}],[\"$\",\"link\",null,{\"rel\":\"manifest\",\"href\":\"/static/favicons/site.webmanifest\"}],[\"$\",\"link\",null,{\"rel\":\"mask-icon\",\"href\":\"/static/favicons/safari-pinned-tab.svg\",\"color\":\"#5bbad5\"}],[\"$\",\"meta\",null,{\"name\":\"msapplication-TileColor\",\"content\":\"#000000\"}],[\"$\",\"meta\",null,{\"name\":\"theme-color\",\"media\":\"(prefers-color-scheme: light)\",\"content\":\"#fff\"}],[\"$\",\"meta\",null,{\"name\":\"theme-color\",\"media\":\"(prefers-color-scheme: dark)\",\"content\":\"#000\"}],[\"$\",\"link\",null,{\"rel\":\"alternate\",\"type\":\"application/rss+xml\",\"href\":\"/feed.xml\"}],[\"$\",\"body\",null,{\"className\":\"bg-white text-black antialiased dark:bg-gray-950 dark:text-white\",\"children\":[\"$\",\"$L9\",null,{\"children\":[[\"$undefined\",\"$undefined\",\"$undefined\",[\"$\",\"$La\",null,{\"async\":true,\"defer\":true,\"data-website-id\":\"$undefined\",\"src\":\"https://analytics.umami.is/script.js\"}],\"$undefined\"],[\"$\",\"section\",null,{\"className\":\"mx-auto max-w-3xl px-4 sm:px-6 xl:max-w-5xl xl:px-0\",\"children\":[\"$\",\"div\",null,{\"className\":\"flex h-screen flex-col justify-between font-sans\",\"children\":[[\"$\",\"$Lb\",null,{\"kbarConfig\":{\"searchDocumentsPath\":\"search.json\"},\"children\":[[\"$\",\"header\",null,{\"className\":\"flex items-center justify-between py-10\",\"children\":[[\"$\",\"div\",null,{\"children\":[\"$\",\"$Lc\",null,{\"href\":\"/\",\"aria-label\":\"SRK.AI\",\"children\":[\"$\",\"div\",null,{\"className\":\"flex items-center justify-between\",\"children\":[\"$\",\"div\",null,{\"className\":\" h-6 text-2xl font-bold sm:block \",\"children\":\"SRK.AI\"}]}]}]}],[\"$\",\"div\",null,{\"className\":\"flex items-center space-x-4 leading-5 sm:space-x-6\",\"children\":[[[\"$\",\"$Lc\",null,{\"href\":\"/blog\",\"className\":\"hidden font-medium text-gray-900 dark:text-gray-100 sm:block\",\"children\":\"Blog\"}],[\"$\",\"$Lc\",null,{\"href\":\"/tags\",\"className\":\"hidden font-medium text-gray-900 dark:text-gray-100 sm:block\",\"children\":\"Tags\"}]],[\"$\",\"$Ld\",null,{\"aria-label\":\"Search\",\"children\":[\"$\",\"svg\",null,{\"xmlns\":\"http://www.w3.org/2000/svg\",\"fill\":\"none\",\"viewBox\":\"0 0 24 24\",\"strokeWidth\":1.5,\"stroke\":\"currentColor\",\"className\":\"h-6 w-6 text-gray-900 dark:text-gray-100\",\"children\":[\"$\",\"path\",null,{\"strokeLinecap\":\"round\",\"strokeLinejoin\":\"round\",\"d\":\"M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z\"}]}]}],[\"$\",\"$Le\",null,{}],[\"$\",\"$Lf\",null,{}]]}]]}],[\"$\",\"main\",null,{\"className\":\"mb-auto\",\"children\":[\"$\",\"$L10\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\"],\"loading\":\"$undefined\",\"loadingStyles\":\"$undefined\",\"loadingScripts\":\"$undefined\",\"hasLoading\":false,\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L11\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[\"$\",\"div\",null,{\"className\":\"flex flex-col items-start justify-start md:mt-24 md:flex-row md:items-center md:justify-center md:space-x-6\",\"children\":[[\"$\",\"div\",null,{\"className\":\"space-x-2 pb-8 pt-6 md:space-y-5\",\"children\":[\"$\",\"h1\",null,{\"className\":\"text-6xl font-extrabold leading-9 tracking-tight text-gray-900 dark:text-gray-100 md:border-r-2 md:px-6 md:text-8xl md:leading-14\",\"children\":\"404\"}]}],[\"$\",\"div\",null,{\"className\":\"max-w-md\",\"children\":[[\"$\",\"p\",null,{\"className\":\"mb-4 text-xl font-bold leading-normal md:text-2xl\",\"children\":\"Sorry we couldn't find this page.\"}],[\"$\",\"p\",null,{\"className\":\"mb-8\",\"children\":\"But dont worry, you can find plenty of other things on our homepage.\"}],[\"$\",\"$Lc\",null,{\"href\":\"/\",\"className\":\"focus:shadow-outline-blue inline rounded-lg border border-transparent bg-blue-600 px-4 py-2 text-sm font-medium leading-5 text-white shadow transition-colors duration-150 hover:bg-blue-700 focus:outline-none dark:hover:bg-blue-500\",\"children\":\"Back to homepage\"}]]}]]}],\"notFoundStyles\":[],\"initialChildNode\":[\"$\",\"$L10\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"blog\",\"children\"],\"loading\":\"$undefined\",\"loadingStyles\":\"$undefined\",\"loadingScripts\":\"$undefined\",\"hasLoading\":false,\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L11\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\",\"initialChildNode\":[\"$\",\"$L10\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"blog\",\"children\",[\"slug\",\"005-ai-news-agent-crewai\",\"c\"],\"children\"],\"loading\":\"$undefined\",\"loadingStyles\":\"$undefined\",\"loadingScripts\":\"$undefined\",\"hasLoading\":false,\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L11\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\",\"initialChildNode\":[\"$L12\",\"$L13\",null],\"childPropSegment\":\"__PAGE__?{\\\"slug\\\":[\\\"005-ai-news-agent-crewai\\\"]}\",\"styles\":[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/8c9812502d811a31.css\",\"precedence\":\"next\",\"crossOrigin\":\"\"}]]}],\"childPropSegment\":[\"slug\",\"005-ai-news-agent-crewai\",\"c\"],\"styles\":null}],\"childPropSegment\":\"blog\",\"styles\":null}]}]]}],[\"$\",\"footer\",null,{\"children\":[\"$\",\"div\",null,{\"className\":\"mt-16 flex flex-col items-center\",\"children\":[[\"$\",\"div\",null,{\"className\":\"mb-3 flex space-x-4\",\"children\":[null,[\"$\",\"a\",null,{\"className\":\"text-sm text-gray-500 transition hover:text-gray-600\",\"target\":\"_blank\",\"rel\":\"noopener noreferrer\",\"href\":\"https://github.com/SudalaiRajkumar\",\"children\":[[\"$\",\"span\",null,{\"className\":\"sr-only\",\"children\":\"github\"}],[\"$\",\"svg\",null,{\"xmlns\":\"http://www.w3.org/2000/svg\",\"viewBox\":\"0 0 24 24\",\"className\":\"fill-current text-gray-700 hover:text-primary-500 dark:text-gray-200 dark:hover:text-primary-400 h-6 w-6\",\"children\":[\"$\",\"path\",null,{\"d\":\"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12\"}]}]]}],null,null,[\"$\",\"a\",null,{\"className\":\"text-sm text-gray-500 transition hover:text-gray-600\",\"target\":\"_blank\",\"rel\":\"noopener noreferrer\",\"href\":\"https://www.linkedin.com\",\"children\":[[\"$\",\"span\",null,{\"className\":\"sr-only\",\"children\":\"linkedin\"}],[\"$\",\"svg\",null,{\"xmlns\":\"http://www.w3.org/2000/svg\",\"viewBox\":\"0 0 24 24\",\"className\":\"fill-current text-gray-700 hover:text-primary-500 dark:text-gray-200 dark:hover:text-primary-400 h-6 w-6\",\"children\":[\"$\",\"path\",null,{\"d\":\"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 01-2.063-2.065 2.064 2.064 0 112.063 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z\"}]}]]}],[\"$\",\"a\",null,{\"className\":\"text-sm text-gray-500 transition hover:text-gray-600\",\"target\":\"_blank\",\"rel\":\"noopener noreferrer\",\"href\":\"https://twitter.com/sudalairajkumar\",\"children\":[[\"$\",\"span\",null,{\"className\":\"sr-only\",\"children\":\"twitter\"}],[\"$\",\"svg\",null,{\"xmlns\":\"http://www.w3.org/2000/svg\",\"viewBox\":\"0 0 24 24\",\"className\":\"fill-current text-gray-700 hover:text-primary-500 dark:text-gray-200 dark:hover:text-primary-400 h-6 w-6\",\"children\":[\"$\",\"path\",null,{\"d\":\"M23.953 4.57a10 10 0 01-2.825.775 4.958 4.958 0 002.163-2.723c-.951.555-2.005.959-3.127 1.184a4.92 4.92 0 00-8.384 4.482C7.69 8.095 4.067 6.13 1.64 3.162a4.822 4.822 0 00-.666 2.475c0 1.71.87 3.213 2.188 4.096a4.904 4.904 0 01-2.228-.616v.06a4.923 4.923 0 003.946 4.827 4.996 4.996 0 01-2.212.085 4.936 4.936 0 004.604 3.417 9.867 9.867 0 01-6.102 2.105c-.39 0-.779-.023-1.17-.067a13.995 13.995 0 007.557 2.209c9.053 0 13.998-7.496 13.998-13.985 0-.21 0-.42-.015-.63A9.935 9.935 0 0024 4.59z\"}]}]]}],[\"$\",\"a\",null,{\"className\":\"text-sm text-gray-500 transition hover:text-gray-600\",\"target\":\"_blank\",\"rel\":\"noopener noreferrer\",\"href\":\"https://www.kaggle.com/sudalairajkumar\",\"children\":[[\"$\",\"span\",null,{\"className\":\"sr-only\",\"children\":\"kaggle\"}],[\"$\",\"svg\",null,{\"role\":\"img\",\"viewBox\":\"0 0 24 24\",\"xmlns\":\"http://www.w3.org/2000/svg\",\"className\":\"fill-current text-gray-700 hover:text-primary-500 dark:text-gray-200 dark:hover:text-primary-400 h-6 w-6\",\"children\":[\"$\",\"path\",null,{\"d\":\"$14\"}]}]]}]]}],[\"$\",\"div\",null,{\"className\":\"mb-2 flex space-x-2 text-sm text-gray-500 dark:text-gray-400\",\"children\":[[\"$\",\"div\",null,{\"children\":\"Sudalai Rajkumar\"}],[\"$\",\"div\",null,{\"children\":\" • \"}],[\"$\",\"div\",null,{\"children\":\"© 2026\"}],[\"$\",\"div\",null,{\"children\":\" • \"}],[\"$\",\"$Lc\",null,{\"href\":\"/\",\"children\":\"SRK's blog\"}]]}],[\"$\",\"div\",null,{\"className\":\"mb-8 hidden text-sm text-gray-500 dark:text-gray-400\",\"children\":[\"$\",\"a\",null,{\"target\":\"_blank\",\"rel\":\"noopener noreferrer\",\"href\":\"https://github.com/timlrx/tailwind-nextjs-starter-blog\",\"children\":\"Tailwind Nextjs Theme\"}]}]]}]}]]}]}]]}]}]]}],null]}]]\n"])</script>
92<script>self.__next_f.push([1,"15:I[1514,[\"326\",\"static/chunks/326-67d0ba2aabdc60e1.js\",\"413\",\"static/chunks/413-927ced89cacdf70c.js\",\"797\",\"static/chunks/app/blog/%5B...slug%5D/page-86dcd0cc51f19186.js\"],\"\"]\n16:I[2529,[\"326\",\"static/chunks/326-67d0ba2aabdc60e1.js\",\"413\",\"static/chunks/413-927ced89cacdf70c.js\",\"797\",\"static/chunks/app/blog/%5B...slug%5D/page-86dcd0cc51f19186.js\"],\"\"]\n17:I[413,[\"326\",\"static/chunks/326-67d0ba2aabdc60e1.js\",\"413\",\"static/chunks/413-927ced89cacdf70c.js\",\"797\",\"static/chunks/app/blog/%5B...slug%5D/page-86dcd"])</script>
92<script>self.__next_f.push([1,"0cc51f19186.js\"],\"Image\"]\n18:I[3291,[\"326\",\"static/chunks/326-67d0ba2aabdc60e1.js\",\"413\",\"static/chunks/413-927ced89cacdf70c.js\",\"797\",\"static/chunks/app/blog/%5B...slug%5D/page-86dcd0cc51f19186.js\"],\"\"]\n"])</script>
92<script>self.__next_f.push([1,"13:[[\"$\",\"script\",null,{\"type\":\"application/ld+json\",\"dangerouslySetInnerHTML\":{\"__html\":\"{\\\"@context\\\":\\\"https://schema.org\\\",\\\"@type\\\":\\\"BlogPosting\\\",\\\"headline\\\":\\\"News Agent using Crew AI\\\",\\\"datePublished\\\":\\\"2024-06-26T12:00:00.000Z\\\",\\\"dateModified\\\":\\\"2024-06-26T00:00:00.000Z\\\",\\\"description\\\":\\\"A simple news agent using Crew AI to summarize the latest news\\\",\\\"image\\\":\\\"/static/images/logo.png\\\",\\\"url\\\":\\\"https://srk.ai//blog/005-ai-news-agent-crewai\\\",\\\"author\\\":[{\\\"@type\\\":\\\"Person\\\",\\\"name\\\":\\\"SRK\\\"}]}\"}}],[\"$\",\"section\",null,{\"className\":\"mx-auto max-w-3xl px-4 sm:px-6 xl:max-w-5xl xl:px-0\",\"children\":[[\"$\",\"$L15\",null,{}],[\"$\",\"article\",null,{\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"header\",null,{\"children\":[\"$\",\"div\",null,{\"className\":\"space-y-1 border-b border-gray-200 pb-10 text-center dark:border-gray-700\",\"children\":[[\"$\",\"dl\",null,{\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"dt\",null,{\"className\":\"sr-only\",\"children\":\"Published on\"}],[\"$\",\"dd\",null,{\"className\":\"text-base font-medium leading-6 text-gray-500 dark:text-gray-400\",\"children\":[\"$\",\"time\",null,{\"dateTime\":\"2024-06-26T12:00:00.000Z\",\"children\":\"June 26, 2024\"}]}]]}]}],[\"$\",\"div\",null,{\"children\":[\"$\",\"h1\",null,{\"className\":\"text-3xl font-extrabold leading-9 tracking-tight text-gray-900 dark:text-gray-100 sm:text-4xl sm:leading-10 md:text-5xl md:leading-14\",\"children\":\"News Agent using Crew AI\"}]}]]}]}],[\"$\",\"div\",null,{\"className\":\"grid-rows-[auto_1fr] divide-y divide-gray-200 pb-8 dark:divide-gray-700 xl:divide-y-0\",\"children\":[[\"$\",\"div\",null,{\"className\":\"divide-y divide-gray-200 dark:divide-gray-700 xl:col-span-3 xl:row-span-2 xl:pb-0\",\"children\":[\"$\",\"div\",null,{\"className\":\"prose max-w-none pb-8 pt-10 dark:prose-invert\",\"children\":[[\"$\",\"h2\",null,{\"id\":\"summary\",\"children\":[[\"$\",\"a\",null,{\"href\":\"#summary\",\"aria-hidden\":\"true\",\"tabIndex\":\"-1\",\"children\":[\"$\",\"span\",null,{\"className\":\"icon icon-link\"}]}],\"Summary\"]}],[\"$\",\"p\",null,{\"children\":\"In this blog post, we will build an agentic workflow to get the latest news on a given topic and then summarize the main points from the news as the output. We will use duckduckgo for fetching the latest news and CrewAI for the agentic framework.\"}],[\"$\",\"h2\",null,{\"id\":\"multi-agent-systems\",\"children\":[[\"$\",\"a\",null,{\"href\":\"#multi-agent-systems\",\"aria-hidden\":\"true\",\"tabIndex\":\"-1\",\"children\":[\"$\",\"span\",null,{\"className\":\"icon icon-link\"}]}],\"Multi Agent Systems\"]}],[\"$\",\"p\",null,{\"children\":\"Multi-agent systems are becoming more common these days. Instead of relying on one LLM to get the output, agentic systems make use of multiple LLMs or tools to get the desired output. In most cases, this is achieved by breaking down a complex task into simpler tasks, which are then solved by individual agents..\"}],[\"$\",\"h2\",null,{\"id\":\"agentic-frameworks\",\"children\":[[\"$\",\"a\",null,{\"href\":\"#agentic-frameworks\",\"aria-hidden\":\"true\",\"tabIndex\":\"-1\",\"children\":[\"$\",\"span\",null,{\"className\":\"icon icon-link\"}]}],\"Agentic Frameworks\"]}],[\"$\",\"p\",null,{\"children\":[\"As agentic systems are gaining more steam, agentic frameworks that help us build these systems are also on the rise. Some of the notable ones are \",[\"$\",\"a\",null,{\"target\":\"_blank\",\"rel\":\"noopener noreferrer\",\"href\":\"https://microsoft.github.io/autogen/\",\"children\":\"AutoGen\"}],\", \",[\"$\",\"a\",null,{\"target\":\"_blank\",\"rel\":\"noopener noreferrer\",\"href\":\"https://docs.crewai.com/\",\"children\":\"crewAI\"}],\", \",[\"$\",\"a\",null,{\"target\":\"_blank\",\"rel\":\"noopener noreferrer\",\"href\":\"https://langchain-ai.github.io/langgraph/\",\"children\":\"LangGraph\"}],\", \",[\"$\",\"a\",null,{\"target\":\"_blank\",\"rel\":\"noopener noreferrer\",\"href\":\"https://docs.phidata.com/introduction\",\"children\":\"phidata\"}],\".\"]}],[\"$\",\"p\",null,{\"children\":[\"In this blog post, we will use crewAI to build our agent system. There is a great course by deeplearning.ai on \",[\"$\",\"a\",null,{\"target\":\"_blank\",\"rel\":\"noopener noreferrer\",\"href\":\"https://www.deeplearning.ai/short-courses/multi-ai-agent-systems-with-crewai/\",\"children\":\"Multi AI Agent Systems with crewAI\"}],\" in case anyone is interested in learning more about it.\"]}],[\"$\",\"h2\",null,{\"id\":\"news-agent\",\"children\":[[\"$\",\"a\",null,{\"href\":\"#news-agent\",\"aria-hidden\":\"true\",\"tabIndex\":\"-1\",\"children\":[\"$\",\"span\",null,{\"className\":\"icon icon-link\"}]}],\"News Agent\"]}
92],[\"$\",\"p\",null,{\"children\":\"Suppose say, we are interested in a particular stock or topic and we want to know the latest news on a daily basis. We can go and search for the news daily, try to read all the articles and then understand the core information.\"}],[\"$\",\"p\",null,{\"children\":\"Some challenges in this are\"}],[\"$\",\"ul\",null,{\"children\":[[\"$\",\"li\",null,{\"children\":\"It is time consuming to check through each article manually.\"}],[\"$\",\"li\",null,{\"children\":\"The same news will be repeated multiple times.\"}],[\"$\",\"li\",null,{\"children\":\"It becomes a repetitive task if we are interested in multiple topics.\"}]]}],[\"$\",\"p\",null,{\"children\":\"Instead, if we can build an agent system that searches for the latest news and summarizes the important points for us, it will be helpful. Let us try to build a simple agent system for that in this post.\"}],[\"$\",\"h2\",null,{\"id\":\"setting-up-the-environment\",\"children\":[[\"$\",\"a\",null,{\"href\":\"#setting-up-the-environment\",\"aria-hidden\":\"true\",\"tabIndex\":\"-1\",\"children\":[\"$\",\"span\",null,{\"className\":\"icon icon-link\"}]}],\"Setting up the environment\"]}],[\"$\",\"p\",null,{\"children\":\"We will need the following packages and so let us install them.\"}],[\"$\",\"$L16\",null,{\"className\":\"language-js\",\"children\":[\"$\",\"code\",null,{\"className\":\"code-highlight language-js\",\"children\":[[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":\"crewai\\n\"}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"crewai\",[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\"[\"}],\"tools\",[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\"]\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"duckduckgo\",[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"-\"}],\"search\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":\"openai\\n\"}]]}]}],[\"$\",\"p\",null,{\"children\":\"Let us start with importing the necessary modules.\"}],[\"$\",\"$L16\",null,{\"className\":\"language-python\",\"children\":[\"$\",\"code\",null,{\"className\":\"language-python code-highlight\",\"children\":[[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[[\"$\",\"span\",null,{\"className\":\"token keyword\",\"children\":\"import\"}],\" os\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[[\"$\",\"span\",null,{\"className\":\"token keyword\",\"children\":\"from\"}],\" crewai \",[\"$\",\"span\",null,{\"className\":\"token keyword\",\"children\":\"import\"}],\" Agent\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[[\"$\",\"span\",null,{\"className\":\"token keyword\",\"children\":\"from\"}],\" crewai \",[\"$\",\"span\",null,{\"className\":\"token keyword\",\"children\":\"import\"}],\" Task\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[[\"$\",\"span\",null,{\"className\":\"token keyword\",\"children\":\"from\"}],\" crewai_tools \",[\"$\",\"span\",null,{\"className\":\"token keyword\",\"children\":\"import\"}],\" BaseTool\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[[\"$\",\"span\",null,{\"className\":\"token keyword\",\"children\":\"from\"}],\" duckduckgo_search \",[\"$\",\"span\",null,{\"className\":\"token keyword\",\"children\":\"import\"}],\" DDGS\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":\"\\n\"}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[[\"$\",\"span\",null,{\"className\":\"token keyword\",\"children\":\"from\"}],\" dotenv \",[\"$\",\"span\",null,{\"className\":\"token keyword\",\"children\":\"import\"}],\" load_dotenv\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":\"\\n\"}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"load_dotenv\",[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\"(\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\")\"}],\"\\n\"]}]]}]}],[\"$\",\"p\",null,{\"children\":[\"We will use OpenAI \",[\"$\",\"code\",null,{\"children\":\"gpt-3.5-turbo\"}],\" LLM model for our system and so let us set it up.\"]}],[\"$\",\"$L16\",null,{\"className\":\"language-python\",\"children\":[\"$\",\"code\",null,{\"className\":\"language-python code-highlight\",\"children\":[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"os\",[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\".\"}],\"environ\",[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\"[\"}],[\"$\",\"span\",null,{\"className\":\"token string\",\"children\":\"\\\"OPENAI_MODEL_NAME\\\"\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\"]\"}],\" \",[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"=\"}],\" \",[\"$\",\"span\",null,{\"className\":\"token string\",\"children\":\"\\\"gpt-3.5-turbo\\\"\"}],\"\\n\"]}]}]}],[\"$\",\"h2\",null,{\"id\":\"latest-news-search-tool\",\"children\":[[\"$\",\"a\",null,{\"href\":\"#latest-news-search-tool\",\"aria-hidden\":\"true\",\"tabIndex\":\"-1\",\"children\":[\"$\",\"span\",null,{\"className\":\"icon icon-link\"}]}],\"Latest News Search Tool\"]}],[\"$\",\"p\",null,{\"children\":[\"We need to get the latest news on our topic of interest. So, let us create a 'News Search Tool' for that. A tool generally helps with a specific capability like web scraping, searching the internet, file reading etc. crewAI itself has a lot of \",[\"$\",\"a\",null,{\"target\":\"_blank\",\"rel\":\"noopener noreferrer\",\"href\":\"https://docs.crewai.com/core-concepts/Tools/#available-crewai-tools\",\"children\":\"inbuilt tools\"}],\", including a search tool using Serper.\"]}],[\"$\",\"p\",null,{\"children\":\"Instead of using the Serper tool, which requires an API key we will make use of DuckDuckGo search. So, let us create a custom tool for the same.\"}],[\"$\",\"$L16\",null,{\"className\":\"language-python\",\"children\":[\"$\",\"code\",null,{\"className\":\"language-python code-highlight\",\"children\":[[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[[\"$\",\"span\",null,{\"className\":\"token keyword\",\"children\":\"class\"}],\" \",[\"$\",\"span\",null,{\"className\":\"token class-name\",\"children\":\"NewsSearchTool\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\"(\"}],\"BaseTool\",[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\")\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\":\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"    name\",[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\":\"}],\" \",[\"$\",\"span\",null,{\"className\":\"token builtin\",\"children\":\"str\"}],\" \",[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"=\"}],\" \",[\"$\",\"span\",null,{\"className\":\"token string\",\"children\":\"\\\"Latest News Search tool\\\"\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"    description\",[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\":\"}],\" \",[\"$\",\"span\",null,{\"className\":\"token builtin\",\"children\":\"str\"}],\" \",[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"=\"}],\" \",[\"$\",\"span\",null,{\"className\":\"token string\",\"children\":\"\\\"News search tool that searches the latest news on the given topic from internet and provides the results.\\\"\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":\"\\n\"}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"    \",[\"$\",\"span\",null,{\"className\":\"token keyword\",\"children\":\"def\"}],\" \",[\"$\",\"span\",null,{\"className\":\"token function\",\"children\":\"_run\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\"(\"}],\"self\",[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\",\"}],\" topic\",[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\":\"}],\" \",[\"$\",\"span\",null,{\"className\":\"token builtin\",\"children\":\"str\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\")\"}],\" \",[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"-\"}],[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"\u003e\"}],\" \",[\"$\",\"span\",null,{\"className\":\"token builtin\",\"children\":\"str\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\":\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"        \",[\"$\",\"span\",null,{\"className\":\"token comment\",\"children\":\"# Using the duckduckgo python module\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"        ddgs \",[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"=\"}],\" DDGS\",[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\"(\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\")\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"        \",[\"$\",\"span\",null,{\"className\":\"token comment\",\"children\":\"# Fetching the latest news from last 1 day on a given topic\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"        results \",[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"=\"}],\" ddgs\",[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\".\"}],\"news\",[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\"(\"}],\"keywords\",[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"=\"}],\"topic\",[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\",\"}],\" timelimit\",[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"=\"}],[\"$\",\"span\",null,{\"className\":\"token string\",\"children\":\"\\\"d\\\"\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\",\"}],\" max_results\",[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"=\"}],[\"$\",\"span\",null,{\"className\":\"token number\",\"children\":\"20\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\")\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"        result_string\",[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"=\"}],[\"$\",\"span\",null,{\"className\":\"token string\",\"children\":\"\\\"\\\"\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"        \",[\"$\",\"span\",null,{\"className\":\"token comment\",\"children\":\"# Combine the news to
92pic and description\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"        \",[\"$\",\"span\",null,{\"className\":\"token keyword\",\"children\":\"for\"}],\" result \",[\"$\",\"span\",null,{\"className\":\"token keyword\",\"children\":\"in\"}],\" results\",[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\":\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"            result_string \",[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"+=\"}],\" \",[\"$\",\"span\",null,{\"className\":\"token string-interpolation\",\"children\":[[\"$\",\"span\",null,{\"className\":\"token string\",\"children\":\"f\\\"Title: \"}],[\"$\",\"span\",null,{\"className\":\"token interpolation\",\"children\":[[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\"{\"}],\"result\",[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\"[\"}],[\"$\",\"span\",null,{\"className\":\"token string\",\"children\":\"'title'\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\"]\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\"}\"}]]}],[\"$\",\"span\",null,{\"className\":\"token string\",\"children\":\" \\\\n De
92scription: \"}],[\"$\",\"span\",null,{\"className\":\"token interpolation\",\"children\":[[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\"{\"}],\"result\",[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\"[\"}],[\"$\",\"span\",null,{\"className\":\"token string\",\"children\":\"'body'\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\"]\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\"}\"}]]}],[\"$\",\"span\",null,{\"className\":\"token string\",\"children\":\"\\\\n\\\\n\\\"\"}]]}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"        \",[\"$\",\"span\",null,{\"className\":\"token comment\",\"children\":\"# In case if there are no news\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"        \",[\"$\",\"span\",null,{\"className\":\"token keyword\",\"children\":\"if\"}],\" \",[\"$\",\"span\",null,{\"className\":\"token builtin\",\"children\":\"len\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\"(\"}],\"result_string\",[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\".\"}],\"strip\",[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\"(\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\")\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\")\"}],\" \",[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"\u003c\"}],\" \",[\"$\",\"span\",null,{\"className\":\"token number\",\"children\":\"2\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\":\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"            result_string\",[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"=\"}],[\"$\",\"span\",null,{\"className\":\"token string\",\"children\":\"\\\"No news found for the given keyword\\\"\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"        \",[\"$\",\"span\",null,{\"className\":\"token keyword\",\"children\":\"return\"}],\" result_string\",[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\".\"}],\"strip\",[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\"(\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\")\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":\"\\n\"}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"news_search_tool \",[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"=\"}],\" NewsSearchTool\",[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\"(\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\")\"}],\"\\n\"]}]]}]}],[\"$\",\"p\",null,{\"children\":[\"Here, we are subclassing the BaseTool in crewAI to create our own tool. We need to provide a clear \",[\"$\",\"code\",null,{\"children\":\"name\"}],\" and \",[\"$\",\"code\",null,{\"children\":\"description\"}],\" so that the LLM agent can make use of the tool effectively. We are using \",[\"$\",\"code\",null,{\"children\":\"DDGS().news()\"}],\" from DuckDuckGo to get the latest 20 news articles and then combining their titles and descriptions to get the final result.\"]}],[\"$\",\"h2\",null,{\"id\":\"agents\",\"children\":[[\"$\",\"a\",null,{\"href\":\"#agents\",\"aria-hidden\":\"true\",\"tabIndex\":\"-1\",\"children\":[\"$\",\"span\",null,{\"className\":\"icon icon-link\"}]}],\"Agents\"]}],[\"$\",\"p\",null,{\"children\":\"Now let us create agents for our task. We will create two agents:\"}],[\"$\",\"ul\",null,{\"children\":[[\"$\",\"li\",null,{\"children\":\"Reasearcher agent: This LLM agent will use the news search tool to research about a specific topic and provide the results.\"}],[\"$\",\"li\",null,{\"children\":\"Summarizer agent: This LLM agent will summarize the news provided by the researcher agent.\"}]]}],[\"$\",\"h4\",null,{\"id\":\"researcher-agent\",\"children\":[[\"$\",\"a\",null,{\"href\":\"#researcher-agent\",\"aria-hidden\":\"true\",\"tabIndex\":\"-1\",\"children\":[\"$\",\"span\",null,{\"className\":\"icon icon-link\"}]}],\"Researcher Agent\"]}],[\"$\",\"p\",null,{\"children\":[\"In crewAI, we can use the \",[\"$\",\"code\",null,{\"children\":\"Agent\"}],\" to create the agents. We need to provide the \",[\"$\",\"code\",null,{\"children\":\"role\"}],\", \",[\"$\",\"code\",null,{\"children\":\"goal\"}],\", \",[\"$\",\"code\",null,{\"children\":\"backstory\"}],\" and \",[\"$\",\"code\",null,{\"children\":\"tools\"}],\" to the agent.\"]}],[\"$\",\"$L16\",null,{\"className\":\"language-python\",\"children\":[\"$\",\"code\",null,{\"className\":\"language-python code-highlight\",\"children\":[[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[[\"$\",\"span\",null,{\"className\":\"token comment\",\"children\":\"# Creating a researcher agent with memory and verbose mode\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"researcher \",[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"=\"}],\" Agent\",[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\"(\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"  role\",[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"=\"}],[\"$\",\"span\",null,{\"className\":\"token string\",\"children\":\"'Researcher'\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\",\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"  goal\",[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"=\"}],[\"$\",\"span\",null,{\"className\":\"token string\",\"children\":\"'Get the latest news in {topic}'\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\",\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"  verbose\",[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"=\"}],[\"$\",\"span\",null,{\"className\":\"token boolean\",\"children\":\"True\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\",\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"  memory\",[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"=\"}],[\"$\",\"span\",null,{\"className\":\"token boolean\",\"children\":\"True\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\",\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"  backstory\",[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"=\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\"(\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"      \",[\"$\",\"span\",null,{\"className\":\"token string\",\"children\":\"\\\"As a knowledge enthusiast, you always look for new happenings on a given topic \\\"\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"      \",[\"$\",\"span\",null,{\"className\":\"token string\",\"children\":\"\\\"and share the knowledge with broader community.\\\"\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"  \",[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\")\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\",\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"  tools\",[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"=\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\"[\"}],\"news_search_tool\",[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\"]\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\",\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\")\"}],\"\\n\"]}]]}]}],[\"$\",\"h4\",null,{\"id\":\"summarizer-agent\",\"children\":[[\"$\",\"a\",null,{\"href\":\"#summarizer-agent\",\"aria-hidden\":\"true\",\"tabIndex\":\"-1\",\"children\":[\"$\",\"span\",null,{\"className\":\"icon icon-link\"}]}],\"Summarizer Agent\"]}],[\"$\",\"p\",null,{\"children\":[\"Similarly let us now create a summarizer agent by providing its \",[\"$\",\"code\",null,{\"children\":\"role\"}],\", \",[\"$\",\"code\",null,{\"children\":\"goal\"}],\", \",[\"$\",\"code\",null,{\"children\":\"backstory\"}],\" and \",[\"$\",\"code\",null,{\"children\":\"tools\"}],\".\"]}],[\"$\",\"$L16\",null,{\"className\":\"language-python\",\"children\":[\"$\",\"code\",null,{\"className\":\"language-python code-highlight\",\"children\":[[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[[\"$\",\"span\",null,{\"className\":\"token comment\",\"children\":\"# Creating a summarizer agent with custom tools and delegation capability\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"summarizer \",[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"=\"}],\" Agent\",[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\"(\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"  role\",[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"=\"}],[\"$\",\"span\",null,{\"className\":\"token string\",\"children\":\"'Summarizer'\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\",\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"  goal\",[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"=\"}],[\"$\",\"span\",null,{\"className\":\"token string\",\"children\":\"'Summarize the latest news in {topic}'\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\",\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"  verbose\",[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"=\"}],[\"$\",\"span\",null,{\"className\":\"token boolean\",\"children\":\"True\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\",\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"  memory\",[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"=\"}],[\"$\",\"span\",null,{\"className\":\"token boolean\",\"children\":\"True\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\",\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"  backstory\",[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"=\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\"(\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"    \",[\"$\",\"span\",null,{\"className\":\"token string\",\"children\":\"\\\"With a flair for simplifying complex topics, you \\\"\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"    \",[\"$\",\"span\",null,{\"className\":\"token string\",\"children\":\"\\\"remove redundant information and summarize the \\\"\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"    \",[\"$\",\"span\",null,{\"className\":\"token string\",\"children\":\"\\\"discoveries in an accessible manner.\\\"\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"  \",[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\")\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\",\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"  allow_delegation\",[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"=\"}],[\"$\",\"span\",null,{\"className\":\"token boolean\",\"children\":\"False\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\")\"}],\"\\n\"]}]]}]}],[\"$\",\"h2\",null,{\"id\":\"tasks\",\"children\":[[\"$\",\"a\",null,{\"href\":\"#tasks\",\"aria-hidden\":\"true\",\"tabIndex\":\"-1\",\"children\":[\"$\",\"span\",null,{\"className\":\"icon icon-link\"}]}],\"Tasks\"]}],[\"$\",\"p\",null,{\"children\":\"Now we need to specify the tasks that each of these agents need to perform. We will have two tasks\"}],[\"$\",\"ul\",null,{\"children\":[[\"$\",\"li\",null,{\"children\":\"Research Task: This task uses the news search tool to get the latest news.\"}],[\"$\",\"li\",null,{\"children\":\"Summarize Task: This task summarizes the news into 2 or 3 bullet points.\"}]]}],[\"$\",\"$L16\",null,{\"className\":\"language-python\",\"children\":[\"$\",\"code\",null,{\"className\":\"language-python code-highlight\",\"children\":[[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[[\"$\",\"span\",null,{\"className\":\"token comment\",\"children\":\"# Research task\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"research_task \",[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"=\"}],\" Task\",[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\"(\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"    description\",[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"=\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\"(\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"    \",[\"$\",\"span\",null,{\"className\":\"token string\",\"children\":\"\\\"Get the latest news in {topic}.\\\"\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"    \",[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\")\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\",\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"    expected_output\",[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"=\"}],[\"$\",\"span\",null,{\"className\":\"token string\",\"children\":\"'Points covering the latest news on {topic}.'\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\",\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"    tools\",[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"=\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\"[\"}],\"news_search_tool\",[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\"]\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\",\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"    agent\",[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"=\"}],\"researcher\",[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\",\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\")\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":\"\\n\"}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[[\"$\",\"span\",null,{\"className\":\"token comment\",\"children\":\"# Summarizer task \"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"summarize_task \",[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"=\"}],\" Task\",[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\"(\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"    description\",[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"=\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\"(\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"      \",[\"$\",\"span\",null,{\"className\":\"token string\",\"children\":\"\\\"Given all the news about the {topic}, summarize them to 2 or 3 bullet points.\\\"\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"      \",[\"$\",\"span\",n
92ull,{\"className\":\"token string\",\"children\":\"\\\"Discard the news which do not have central focus on {topic}.\\\"\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"      \",[\"$\",\"span\",null,{\"className\":\"token string\",\"children\":\"\\\"If no news is relevant, return that no news found for the {topic}\\\"\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"    \",[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\")\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\",\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"    expected_output\",[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"=\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\"(\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"    \",[\"$\",\"span\",null,{\"className\":\"token string\",\"children\":\"\\\"2 or 3 summarized bullet points, each one focussing on one specific news \\\"\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"    \",[\"$\",\"span\",null,{\"className\":\"token string\",\"children\":\"\\\"about the {topic}. If no news found, return no news found\\\"\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"    \",[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\")\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\",\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"    agent\",[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"=\"}],\"summarizer\",[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\",\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"    output_file\",[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"=\"}],[\"$\",\"span\",null,{\"className\":\"token string\",\"children\":\"'news_summary.md'\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\",\"}],\"  \",[\"$\",\"span\",null,{\"className\":\"token comment\",\"children\":\"# Example of output customization\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\")\"}],\"\\n\"]}]]}]}],[\"$\",\"p\",null,{\"children\":[\"As seen above, we need to specify the \",[\"$\",\"code\",null,{\"children\":\"description\"}],\" and the \",[\"$\",\"code\",null,{\"children\":\"expected_output\"}],\" of the task and the agent to which the task is assigned. We can also optionally specify the \",[\"$\",\"code\",null,{\"children\":\"output_file\"}],\" to save the output of the task.\"]}],[\"$\",\"h2\",null,{\"id\":\"kickoff\",\"children\":[[\"$\",\"a\",null,{\"href\":\"#kickoff\",\"aria-hidden\":\"true\",\"tabIndex\":\"-1\",\"children\":[\"$\",\"span\",null,{\"className\":\"icon icon-link\"}]}],\"Kickoff\"]}],[\"$\",\"p\",null,{\"children\":\"Now let us form the crew (agentic system) using the created agents and tasks, and start the process.\"}],[\"$\",\"$L16\",null,{\"className\":\"language-python\",\"children\":[\"$\",\"code\",null,{\"className\":\"language-python code-highlight\",\"children\":[[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[[\"$\",\"span\",null,{\"className\":\"token comment\",\"children\":\"# Forming the tech-focused crew with some enhanced configurations\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"crew \",[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"=\"}],\" Crew\",[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\"(\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"  agents\",[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"=\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\"[\"}],\"researcher\",[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\",\"}],\" summarizer\",[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\"]\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\",\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"  tasks\",[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"=\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\"[\"}],\"research_task\",[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\",\"}],\" summarize_task\",[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\"]\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\",\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"  process\",[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"=\"}],\"Process\",[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\".\"}],\"sequential\",[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\",\"}],\"  \",[\"$\",\"span\",null,{\"className\":\"token comment\",\"children\":\"# Optional: Sequential task execution is default\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\")\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":\"\\n\"}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[\"result \",[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"=\"}],\" crew\",[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\".\"}],\"kickoff\",[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\"(\"}],\"inputs\",[\"$\",\"span\",null,{\"className\":\"token operator\",\"children\":\"=\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\"{\"}],[\"$\",\"span\",null,{\"className\":\"token string\",\"children\":\"'topic'\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\":\"}],\" \",[\"$\",\"span\",null,{\"className\":\"token string\",\"children\":\"'HDFC Bank'\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\"}\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\")\"}],\"\\n\"]}],[\"$\",\"span\",null,{\"className\":\"code-line\",\"children\":[[\"$\",\"span\",null,{\"className\":\"token keyword\",\"children\":\"print\"}],[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\"(\"}],\"result\",[\"$\",\"span\",null,{\"className\":\"token punctuation\",\"children\":\")\"}],\"\\n\"]}]]}]}],[\"$\",\"p\",null,{\"children\":[\"In this example, we have searched for \",[\"$\",\"code\",null,{\"children\":\"HDFC Bank\"}],\" topic and the crew started working.\"]}],[\"$\",\"div\",null,{\"children\":[\"$\",\"$L17\",null,{\"alt\":\"crew_start\",\"src\":\"/static/images/blogs/005/crew_start.png\",\"width\":\"1908\",\"height\"
92:\"404\"}]}],[\"$\",\"div\",null,{\"children\":[\"The results are \",[\"$\",\"$L17\",null,{\"alt\":\"crew_result\",\"src\":\"/static/images/blogs/005/crew_result.png\",\"width\":\"2176\",\"height\":\"280\"}]]}],[\"$\",\"h2\",null,{\"id\":\"conclusion\",\"children\":[[\"$\",\"a\",null,{\"href\":\"#conclusion\",\"aria-hidden\":\"true\",\"tabIndex\":\"-1\",\"children\":[\"$\",\"span\",null,{\"className\":\"icon icon-link\"}]}],\"Conclusion\"]}],[\"$\",\"p\",null,{\"children\":\"In this blog post, we saw how to build a simple news agent for our topic of interest using crewAI. Let's explore more agentic systems in our future blogs.\"}],[\"$\",\"p\",null,{\"children\":[\"Code used for this blog post is present in this \",[\"$\",\"a\",null,{\"target\":\"_blank\",\"rel\":\"noopener noreferrer\",\"href\":\"https://github.com/SudalaiRajkumar/srk_ai_blog/blob/master/005-NewsAgent_CrewAI/005_NewsAgent_CrewAI.ipynb\",\"children\":\"notebook\"}],\".\"]}]]}]}],[\"$\",\"div\",null,{\"className\":\"pb-6 pt-6 text-center text-gray-700 dark:text-gray-300\",\"id\":\"comment\",\"children\":[\"$\",\"$L18\",null,{\"slug\":\"005-ai-news-agent-crewai\"}]}],[\"$\",\"footer\",null,{\"children\":[\"$\",\"div\",null,{\"className\":\"flex flex-col text-sm font-medium sm:flex-row sm:justify-between sm:text-base\",\"children\":[[\"$\",\"div\",null,{\"className\":\"pt-4 xl:pt-8\",\"children\":[\"$\",\"$Lc\",null,{\"href\":\"/blog/004-ai-llm-retrieval-eval-llamaindex\",\"className\":\"text-primary-500 hover:text-primary-600 dark:hover:text-primary-400\",\"aria-label\":\"Previous post: RAG - Encoder and Reranker evaluation\",\"children\":[\"← \",\"RAG - Encoder and Reranker evaluation\"]}]}],\"$undefined\"]}]}]]}]]}]}]]}]]\n"])</script>
92<script>self.__next_f.push([1,"7:[[\"$\",\"meta\",\"0\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}],[\"$\",\"meta\",\"1\",{\"charSet\":\"utf-8\"}],[\"$\",\"title\",\"2\",{\"children\":\"News Agent using Crew AI | SRK's blog\"}],[\"$\",\"meta\",\"3\",{\"name\":\"description\",\"content\":\"A simple news agent using Crew AI to summarize the latest news\"}],[\"$\",\"meta\",\"4\",{\"name\":\"robots\",\"content\":\"index, follow\"}],[\"$\",\"meta\",\"5\",{\"name\":\"googlebot\",\"content\":\"index, follow, max-video-preview:-1, max-image-preview:large, max-snippet:-1\"}],[\"$\",\"link\",\"6\",{\"rel\":\"canonical\",\"href\":\"https://srk.ai/blog/005-ai-news-agent-crewai\"}],[\"$\",\"link\",\"7\",{\"rel\":\"alternate\",\"type\":\"application/rss+xml\",\"href\":\"https://srk.ai//feed.xml\"}],[\"$\",\"meta\",\"8\",{\"property\":\"og:title\",\"content\":\"News Agent using Crew AI\"}],[\"$\",\"meta\",\"9\",{\"property\":\"og:description\",\"content\":\"A simple news agent using Crew AI to summarize the latest news\"}],[\"$\",\"meta\",\"10\",{\"property\":\"og:url\",\"content\":\"https://srk.ai/blog/005-ai-news-agent-crewai\"}],[\"$\",\"meta\",\"11\",{\"property\":\"og:site_name\",\"content\":\"SRK's blog\"}],[\"$\",\"meta\",\"12\",{\"property\":\"og:locale\",\"content\":\"en_US\"}],[\"$\",\"meta\",\"13\",{\"property\":\"og:image\",\"content\":\"https://srk.ai//static/images/logo.png\"}],[\"$\",\"meta\",\"14\",{\"property\":\"og:type\",\"content\":\"article\"}],[\"$\",\"meta\",\"15\",{\"property\":\"article:published_time\",\"content\":\"2024-06-26T12:00:00.000Z\"}],[\"$\",\"meta\",\"16\",{\"property\":\"article:modified_time\",\"content\":\"2024-06-26T00:00:00.000Z\"}],[\"$\",\"meta\",\"17\",{\"property\":\"article:author\",\"content\":\"SRK\"}],[\"$\",\"meta\",\"18\",{\"name\":\"twitter:card\",\"content\":\"summary_large_image\"}],[\"$\",\"meta\",\"19\",{\"name\":\"twitter:title\",\"content\":\"News Agent using Crew AI\"}],[\"$\",\"meta\",\"20\",{\"name\":\"twitter:description\",\"content\":\"A simple news agent using Crew AI to summarize the latest news\"}],[\"$\",\"meta\",\"21\",{\"name\":\"twitter:image\",\"content\":\"https://srk.ai/static/images/logo.png\"}],[\"$\",\"meta\",\"22\",{\"name\":\"next-size-adjust\"}]]\n"])</script>
92<script>self.__next_f.push([1,"12:null\n"])</script>
92<script>self.__next_f.push([1,""])</script>
92</body></html>

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.