39. Multi-agent Systems#

In this notebook we see how easy it is to work with multi-agent systems. We will study two open-source repos, Crew AI and Agno.

References:

from google.colab import drive
drive.mount('/content/drive')  # Add My Drive/<>

import os
os.chdir('drive/My Drive')
os.chdir('Books_Writings/NLPBook/')
Mounted at /content/drive
%%capture
import numpy as np
import pandas as pd
import os

import textwrap
def p80(text):
    print(textwrap.fill(text, 80))
    return None

39.1. Crew AI#

https://www.crewai.com/

# Install CrewAI and related Tools

try:
  import crewai
except ImportError:
  !pip install crewai --quiet
try:
  import crewai_tools
except ImportError:
  !pip install crewai-tools --quiet
/usr/local/lib/python3.11/dist-packages/pydantic/_internal/_config.py:295: PydanticDeprecatedSince20: Support for class-based `config` is deprecated, use ConfigDict instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.10/migration/
  warnings.warn(DEPRECATION_MESSAGE, DeprecationWarning)
/usr/local/lib/python3.11/dist-packages/pydantic/_internal/_fields.py:192: UserWarning: Field name "schema" in "DatabricksQueryToolSchema" shadows an attribute in parent "BaseModel"
  warnings.warn(
/usr/local/lib/python3.11/dist-packages/pydantic/_internal/_generate_schema.py:502: UserWarning: <built-in function callable> is not a Python type (it may be an instance of an object), Pydantic will allow any object with no validation since we cannot even enforce that the input is an instance of the given type. To get rid of this error wrap the type with `pydantic.SkipValidation`.
  warn(
/usr/local/lib/python3.11/dist-packages/crewai_tools/tools/scrapegraph_scrape_tool/scrapegraph_scrape_tool.py:34: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.10/migration/
  @validator("website_url")
/usr/local/lib/python3.11/dist-packages/crewai_tools/tools/selenium_scraping_tool/selenium_scraping_tool.py:26: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.10/migration/
  @validator("website_url")
/usr/local/lib/python3.11/dist-packages/crewai_tools/tools/vision_tool/vision_tool.py:15: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.10/migration/
  @validator("image_path_url")
try:
  import pydantic
except ImportError:
  !pip install pydantic --quiet
%run keys.ipynb

39.2. Application 1: Financial Analyst#

Here we create an agent that prepares the forward-looking outlook for Nvidia, using a sample article from Seeking Alpha.

39.3. Collect the Tools needed#

All the tools are listed here: https://docs.crewai.com/tools/browserbaseloadtool

Here we use two tools:

  1. A tool for scraping websites from a given URL: ScrapeWebsiteTool,

  2. A tool to create a searchable vector store: TXTSearchTool

from crewai_tools import ScrapeWebsiteTool, TXTSearchTool
import requests

# Initialize the tool, potentially passing the session
url = 'https://nvidianews.nvidia.com/news/nvidia-announces-financial-results-for-fourth-quarter-and-fiscal-2025#:~:text=NVIDIA%20will%20pay%20its%20next,record%20on%20March%2012%2C%202025.&text=NVIDIA%27s%20outlook%20for%20the%20first,%2C%20plus%20or%20minus%202%25.'
tool_scrape = ScrapeWebsiteTool(url)

# Extract the text
text = tool_scrape._run()
text
'\nNVIDIA Announces Financial Results for Fourth Quarter and Fiscal 2025 | NVIDIA Newsroom\nArtificial Intelligence Computing Leadership from NVIDIA\nPLATFORMS\nAutonomous Machines\nCloud & Data Center\nDeep Learning & Ai\nDesign & Pro Visualization\nHealthcare\nHigh Performance Computing\nSelf-Driving Cars\nGaming & Entertainment\nother links\nDevelopers\nIndustries\nShop\nDrivers\nSupport\nAbout NVIDIA\nView All Products\nGPU TECHNOLOGY CONFERENCE\nNVIDIA Blog\nCommunity\nCareers\nTECHNOLOGIES\nNewsroom\nNVIDIA in Brief\nExec Bios\nNVIDIA Blog\nPodcast\nMedia Assets\nIn the News\nPress Contacts\nOnline Press Kits\nNVIDIA in Brief\nExec Bios\nNVIDIA Blog\nPodcast\nMedia Assets\nIn the News\nPress Contacts\nOnline Press Kits\nPress Release\nShare\nTweet\nTwitter\nShare\nLinkedIn\nShare\nFacebook\nEmail\nic_arrow-back-to-top\nNVIDIA Announces Financial Results for Fourth Quarter and Fiscal 2025\nRecord quarterly revenue of $39.3 billion, up 12% from Q3 and up 78% from a year ago\nRecord quarterly Data Center revenue of $35.6 billion, up 16% from Q3 and up 93% from a year ago\nRecord full-year revenue of $130.5 billion, up 114%\nFebruary 26, 2025\nNVIDIA (NASDAQ: NVDA) today reported revenue for the fourth quarter ended January 26, 2025, of $39.3 billion, up 12% from the previous quarter and up 78% from a year ago.\nFor the quarter, GAAP earnings per diluted share was $0.89, up 14% from the previous quarter and up 82% from a year ago. Non-GAAP earnings per diluted share was $0.89, up 10% from the previous quarter and up 71% from a year ago.\nFor fiscal 2025, revenue was $130.5 billion, up 114% from a year ago. GAAP earnings per diluted share was $2.94, up 147% from a year ago. Non-GAAP earnings per diluted share was $2.99, up 130% from a year ago.\n“Demand for Blackwell is amazing as reasoning AI adds another scaling law — increasing compute for training makes models smarter and increasing compute for long thinking makes the answer smarter,” said Jensen Huang, founder and CEO of NVIDIA.\n“We’ve successfully ramped up the massive-scale production of Blackwell AI supercomputers, achieving billions of dollars in sales in its first quarter. AI is advancing at light speed as agentic AI and physical AI set the stage for the next wave of AI to revolutionize the largest industries.”\nNVIDIA will pay its next quarterly cash dividend of $0.01 per share on April 2, 2025, to all shareholders of record on March 12, 2025.\nQ4 Fiscal 2025 Summary\nGAAP\n($ in millions, except earnings\nper share)\nQ4 FY25\nQ3 FY25\nQ4 FY24\nQ/Q\nY/Y\nRevenue\n$39,331\n$35,082\n$22,103\nUp 12%\nUp 78%\nGross margin\n73.0%\n74.6%\n76.0%\nDown 1.6 pts\nDown 3.0 pts\nOperating expenses\n$4,689\n$4,287\n$3,176\nUp 9%\nUp 48%\nOperating income\n$24,034\n$21,869\n$13,615\nUp 10%\nUp 77%\nNet income\n$22,091\n$19,309\n$12,285\nUp 14%\nUp 80%\nDiluted earnings per share*\n$0.89\n$0.78\n$0.49\nUp 14%\nUp 82%\nNon-GAAP\n($ in millions, except earnings\nper share)\nQ4 FY25\nQ3 FY25\nQ4 FY24\nQ/Q\nY/Y\nRevenue\n$39,331\n$35,082\n$22,103\nUp 12%\nUp 78%\nGross margin\n73.5%\n75.0%\n76.7%\nDown 1.5 pts\nDown 3.2 pts\nOperating expenses\n$3,378\n$3,046\n$2,210\nUp 11%\nUp 53%\nOperating income\n$25,516\n$23,276\n$14,749\nUp 10%\nUp 73%\nNet income\n$22,066\n$20,010\n$12,839\nUp 10%\nUp 72%\nDiluted earnings per share*\n$0.89\n$0.81\n$0.52\nUp 10%\nUp 71%\nFiscal 2025 Summary\nGAAP\n($ in millions, except earnings\nper share)\nFY25\nFY24\nY/Y\nRevenue\n$130,497\n$60,922\nUp 114%\nGross margin\n75.0%\n72.7%\nUp 2.3 pts\nOperating expenses\n$16,405\n$11,329\nUp 45%\nOperating income\n$81,453\n$32,972\nUp 147%\nNet income\n$72,880\n$29,760\nUp 145%\nDiluted earnings per share*\n$2.94\n$1.19\nUp 147%\nNon-GAAP\n($ in millions, except earnings\nper share)\nFY25\nFY24\nY/Y\nRevenue\n$130,497\n$60,922\nUp 114%\nGross margin\n75.5%\n73.8%\nUp 1.7 pts\nOperating expenses\n$11,716\n$7,825\nUp 50%\nOperating income\n$86,789\n$37,134\nUp 134%\nNet income\n$74,265\n$32,312\nUp 130%\nDiluted earnings per share*\n$2.99\n$1.30\nUp 130%\n*All per share amounts presented herein have been retroactively adjusted to reflect the ten-for-one stock split, which was effective June 7, 2024.\nOutlook \r\nNVIDIA’s outlook for the first quarter of fiscal 2026 is as follows:\nRevenue is expected to be $43.0 billion, plus or minus 2%.\nGAAP and non-GAAP gross margins are expected to be 70.6% and 71.0%, respectively, plus or minus 50 basis points.\nGAAP and non-GAAP operating expenses are expected to be approximately $5.2 billion and $3.6 billion, respectively.\nGAAP and non-GAAP other income and expense are expected to be an income of approximately $400 million, excluding gains and losses from non-marketable and publicly-held equity securities.\nGAAP and non-GAAP tax rates are expected to be 17.0%, plus or minus 1%, excluding any discrete items.\nHighlights\nNVIDIA achieved progress since its previous earnings announcement in these areas:\nData Center\nFourth-quarter revenue was a record $35.6 billion, up 16% from the previous quarter and up 93% from a year ago. Full-year revenue rose 142% to a record $115.2 billion.\nAnnounced that NVIDIA will serve as a key technology partner for the $500 billion Stargate Project.\nRevealed that cloud service providers AWS, CoreWeave, Google Cloud Platform (GCP), Microsoft Azure and Oracle Cloud Infrastructure (OCI) are bringing NVIDIA® GB200 systems to cloud regions around the world to meet surging customer demand for AI.\nPartnered with AWS to make the NVIDIA DGX™ Cloud AI computing platform and NVIDIA NIM™ microservices available through AWS Marketplace.\nRevealed that Cisco will integrate NVIDIA Spectrum-X™ into its networking portfolio to help enterprises build AI infrastructure.\nRevealed that more than 75% of the systems on the TOP500 list of the world’s most powerful supercomputers are powered by NVIDIA technologies.\nAnnounced a collaboration with Verizon to integrate NVIDIA AI Enterprise, NIM and accelerated computing with Verizon’s private 5G network to power a range of edge enterprise AI applications and services.\nUnveiled partnerships with industry leaders including IQVIA, Illumina, Mayo Clinic and Arc Institute to advance genomics, drug discovery and healthcare.\nLaunched NVIDIA AI Blueprints and Llama Nemotron model families for building AI agents and released NVIDIA NIM microservices to safeguard applications for agentic AI.\nAnnounced the opening of NVIDIA’s first R&D center in Vietnam .\nRevealed that Siemens Healthineers has adopted MONAI Deploy for medical imaging AI.\nGaming and AI PC\nFourth-quarter Gaming revenue was $2.5 billion, down 22% from the previous quarter and down 11% from a year ago.\xa0Full-year revenue rose 9% to $11.4 billion.\nAnnounced new GeForce RTX™ 50 Series graphics cards and laptops powered by the NVIDIA Blackwell architecture, delivering breakthroughs in AI-driven rendering to gamers, creators and developers.\nLaunched GeForce RTX 5090 and 5080 graphics cards, delivering up to a 2x performance improvement over the prior generation.\nIntroduced NVIDIA DLSS 4 with Multi Frame Generation and image quality enhancements, with 75 games and apps supporting it at launch, and unveiled NVIDIA Reflex 2 technology, which can reduce PC latency by up to 75%.\nUnveiled NVIDIA NIM microservices, AI Blueprints and the Llama Nemotron family of open models for RTX AI PCs to help developers and enthusiasts build AI agents and creative workflows.\nProfessional Visualization\nFourth-quarter revenue was $511 million, up 5% from the previous quarter and up 10% from a year ago. Full-year revenue rose 21% to $1.9 billion.\nUnveiled NVIDIA Project DIGITS , a personal AI supercomputer that provides AI researchers, data scientists and students worldwide with access to the power of the NVIDIA Grace™ Blackwell platform.\nAnnounced generative AI models and blueprints that expand NVIDIA Omniverse™ integration further into physical AI applications, including robotics, autonomous vehicles and vision AI.\nIntroduced NVIDIA Media2 , an AI-powered initiative transforming content creation, streaming and live media experiences, built on NIM and AI Blueprints.\nAutomotive and Robotics\nFourth-quarter Automotive revenue was $570 million, up 27% from the previous quarter and up 103% from a year ago. Full-year revenue rose 55% to $1.7 billion.\nAnnounced that Toyota, the world’s largest automaker, will build its next-generation vehicles on NVIDIA DRIVE AGX Orin™ running the safety-certified NVIDIA DriveOS operating system.\nPartnered with Hyundai Motor Group to create safer, smarter vehicles, supercharge manufacturing and deploy cutting-edge robotics with NVIDIA AI and NVIDIA Omniverse .\nAnnounced that the NVIDIA DriveOS safe autonomous driving operating system received ASIL-D functional safety certification and launched the NVIDIA DRIVE™ AI Systems Inspection Lab .\nLaunched NVIDIA Cosmos™ , a platform comprising state-of-the-art generative world foundation models, to accelerate physical AI development, with adoption by leading robotics and automotive companies 1X, Agile Robots, Waabi, Uber and others.\nUnveiled the NVIDIA Jetson Orin Nano™ Super , which delivers up to a 1.7x gain in generative AI performance.\nCFO Commentary \r\nCommentary on the quarter by Colette Kress, NVIDIA’s executive vice president and chief financial officer, is available at https://investor.nvidia.com .\nConference Call and Webcast Information \r\nNVIDIA will conduct a conference call with analysts and investors to discuss its fourth quarter and fiscal 2025 financial results and current financial prospects today at 2 p.m. Pacific time (5 p.m. Eastern time). A live webcast (listen-only mode) of the conference call will be accessible at NVIDIA’s investor relations website, https://investor.nvidia.com . The webcast will be recorded and available for replay until NVIDIA’s conference call to discuss its financial results for its first quarter of fiscal 2026.\nNon-GAAP Measures \r\nTo supplement NVIDIA’s condensed consolidated financial statements presented in accordance with GAAP, the company uses non-GAAP measures of certain components of financial performance. These non-GAAP measures include non-GAAP gross profit, non-GAAP gross margin, non-GAAP operating expenses, non-GAAP operating income, non-GAAP other income (expense), net, non-GAAP net income, non-GAAP net income, or earnings, per diluted share, and free cash flow. For NVIDIA’s investors to be better able to compare its current results with those of previous periods, the company has shown a reconciliation of GAAP to non-GAAP financial measures. These reconciliations adjust the related GAAP financial measures to exclude stock-based compensation expense, acquisition-related and other costs, other, gains from non-marketable and publicly-held equity securities, net, interest expense related to amortization of debt discount, and the associated tax impact of these items where applicable. Free cash flow is calculated as GAAP net cash provided by operating activities less both purchases related to property and equipment and intangible assets and principal payments on property and equipment and intangible assets. NVIDIA believes the presentation of its non-GAAP financial measures enhances the user’s overall understanding of the company’s historical financial performance. The presentation of the company’s non-GAAP financial measures is not meant to be considered in isolation or as a substitute for the company’s financial results prepared in accordance with GAAP, and the company’s non-GAAP measures may be different from non-GAAP measures used by other companies.\nNVIDIA CORPORATION\nCONDENSED CONSOLIDATED STATEMENTS OF INCOME\n(In millions, except per share data)\n(Unaudited)\nThree Months Ended\nTwelve Months Ended\nJanuary 26,\nJanuary 28,\nJanuary 26,\nJanuary 28,\n2025\n2024\n2025\n2024\nRevenue\n$\n39,331\n$\n22,103\n$\n130,497\n$\n60,922\nCost of revenue\n10,608\n5,312\n32,639\n16,621\nGross profit\n28,723\n16,791\n97,858\n44,301\nOperating expenses\nResearch and development\n3,714\n2,465\n12,914\n8,675\nSales, general and administrative\n975\n711\n3,491\n2,654\nTotal operating expenses\n4,689\n3,176\n16,405\n11,329\nOperating income\n24,034\n13,615\n81,453\n32,972\nInterest income\n511\n294\n1,786\n866\nInterest expense\n(61\n)\n(63\n)\n(247\n)\n(257\n)\nOther, net\n733\n260\n1,034\n237\nOther income (expense), net\n1,183\n491\n2,573\n846\nIncome before income tax\n25,217\n14,106\n84,026\n33,818\nIncome tax expense\n3,126\n1,821\n11,146\n4,058\nNet income\n$\n22,091\n$\n12,285\n$\n72,880\n$\n29,760\nNet income per share:\nBasic\n$\n0.90\n$\n0.51\n$\n2.97\n$\n1.21\nDiluted\n$\n0.89\n$\n0.49\n$\n2.94\n$\n1.19\nWeighted average shares used in per share computation:\nBasic\n24,489\n24,660\n24,555\n24,690\nDiluted\n24,706\n24,900\n24,804\n24,940\nNVIDIA CORPORATION\nCONDENSED CONSOLIDATED BALANCE SHEETS\n(In millions)\n(Unaudited)\nJanuary 26,\nJanuary 28,\n2025\n2024\nASSETS\nCurrent assets:\nCash, cash equivalents and marketable securities\n$\n43,210\n$\n25,984\nAccounts receivable, net\n23,065\n9,999\nInventories\n10,080\n5,282\nPrepaid expenses and other current assets\n3,771\n3,080\nTotal current assets\n80,126\n44,345\nProperty and equipment, net\n6,283\n3,914\nOperating lease assets\n1,793\n1,346\nGoodwill\n5,188\n4,430\nIntangible assets, net\n807\n1,112\nDeferred income tax assets\n10,979\n6,081\nOther assets\n6,425\n4,500\nTotal assets\n$\n111,601\n$\n65,728\nLIABILITIES AND SHAREHOLDERS’ EQUITY\nCurrent liabilities:\nAccounts payable\n$\n6,310\n$\n2,699\nAccrued and other current liabilities\n11,737\n6,682\nShort-term debt\n-\n1,250\nTotal current liabilities\n18,047\n10,631\nLong-term debt\n8,463\n8,459\nLong-term operating lease liabilities\n1,519\n1,119\nOther long-term liabilities\n4,245\n2,541\nTotal liabilities\n32,274\n22,750\nShareholders’ equity\n79,327\n42,978\nTotal liabilities and shareholders’ equity\n$\n111,601\n$\n65,728\nNVIDIA CORPORATION\nCONDENSED CONSOLIDATED STATEMENTS OF CASH FLOWS\n(In millions)\n(Unaudited)\nThree Months Ended\nTwelve Months Ended\nJanuary 26,\nJanuary 28,\nJanuary 26,\nJanuary 28,\n2025\n2024\n2025\n2024\nCash flows from operating activities:\nNet income\n$\n22,091\n$\n12,285\n$\n72,880\n$\n29,760\nAdjustments to reconcile net income to net cash\nprovided by operating activities:\nStock-based compensation expense\n1,321\n993\n4,737\n3,549\nDepreciation and amortization\n543\n387\n1,864\n1,508\nDeferred income taxes\n(598\n)\n(78\n)\n(4,477\n)\n(2,489\n)\nGains on non-marketable equity securities and publicly-held equity securities, net\n(727\n)\n(260\n)\n(1,030\n)\n(238\n)\nOther\n(138\n)\n(109\n)\n(502\n)\n(278\n)\nChanges in operating assets and liabilities, net of acquisitions:\nAccounts receivable\n(5,370\n)\n(1,690\n)\n(13,063\n)\n(6,172\n)\nInventories\n(2,424\n)\n(503\n)\n(4,781\n)\n(98\n)\nPrepaid expenses and other assets\n331\n(1,184\n)\n(395\n)\n(1,522\n)\nAccounts payable\n867\n281\n3,357\n1,531\nAccrued and other current liabilities\n360\n1,072\n4,278\n2,025\nOther long-term liabilities\n372\n305\n1,221\n514\nNet cash provided by operating activities\n16,628\n11,499\n64,089\n28,090\nCash flows from investing activities:\nProceeds from maturities of marketable securities\n1,710\n1,731\n11,195\n9,732\nProceeds from sales of marketable securities\n177\n50\n495\n50\nProceeds from sales of non-marketable equity securities\n-\n-\n171\n1\nPurchases of marketable securities\n(7,010\n)\n(7,524\n)\n(26,575\n)\n(18,211\n)\nPurchase related to property and equipment and intangible assets\n(1,077\n)\n(253\n)\n(3,236\n)\n(1,069\n)\nPurchases of non-marketable equity securities\n(478\n)\n(113\n)\n(1,486\n)\n(862\n)\nAcquisitions, net of cash acquired\n(542\n)\n-\n(1,007\n)\n(83\n)\nOther\n22\n-\n22\n(124\n)\nNet cash used in investing activities\n(7,198\n)\n(6,109\n)\n(20,421\n)\n(10,566\n)\nCash flows from financing activities:\nProceeds related to employee stock plans\n-\n-\n490\n403\nPayments related to repurchases of common stock\n(7,810\n)\n(2,660\n)\n(33,706\n)\n(9,533\n)\nPayments related to tax on restricted stock units\n(1,861\n)\n(841\n)\n(6,930\n)\n(2,783\n)\nRepayment of debt\n-\n-\n(1,250\n)\n(1,250\n)\nDividends paid\n(245\n)\n(99\n)\n(834\n)\n(395\n)\nPrincipal payments on property and equipment and intangible assets\n(32\n)\n(29\n)\n(129\n)\n(74\n)\nOther\n-\n-\n-\n(1\n)\nNet cash used in financing activities\n(9,948\n)\n(3,629\n)\n(42,359\n)\n(13,633\n)\nChange in cash, cash equivalents, and restricted cash\n(518\n)\n1,761\n1,309\n3,891\nCash, cash equivalents, and restricted cash at beginning of period\n9,107\n5,519\n7,280\n3,389\nCash, cash equivalents, and restricted cash at end of period\n$\n8,589\n$\n7,280\n$\n8,589\n$\n7,280\nSupplemental disclosures of cash flow information:\nCash paid for income taxes, net\n$\n4,129\n$\n1,874\n$\n15,118\n$\n6,549\nCash paid for interest\n$\n22\n$\n26\n$\n246\n$\n252\nNVIDIA CORPORATION\nRECONCILIATION OF GAAP TO NON-GAAP FINANCIAL MEASURES\n(In millions, except per share data)\n(Unaudited)\nThree Months Ended\nTwelve Months Ended\nJanuary 26,\nOctober 27,\nJanuary 28,\nJanuary 26,\nJanuary 28,\n2025\n2024\n2024\n2025\n2024\nGAAP cost of revenue\n$\n10,608\n$\n8,926\n$\n5,312\n$\n32,639\n$\n16,621\nGAAP gross profit\n$\n28,723\n$\n26,156\n$\n16,791\n$\n97,858\n$\n44,301\nGAAP gross margin\n73.0\n%\n74.6\n%\n76.0\n%\n75.0\n%\n72.7\n%\nAcquisition-related and other costs (A)\n118\n116\n119\n472\n477\nStock-based compensation expense (B)\n53\n50\n45\n178\n141\nOther (C)\n-\n-\n4\n(3\n)\n40\nNon-GAAP cost of revenue\n$\n10,437\n$\n8,759\n$\n5,144\n$\n31,992\n$\n15,963\nNon-GAAP gross profit\n$\n28,894\n$\n26,322\n$\n16,959\n$\n98,505\n$\n44,959\nNon-GAAP gross margin\n73.5\n%\n75.0\n%\n76.7\n%\n75.5\n%\n73.8\n%\nGAAP operating expenses\n$\n4,689\n$\n4,287\n$\n3,176\n$\n16,405\n$\n11,329\nStock-based compensation expense (B)\n(1,268\n)\n(1,202\n)\n(948\n)\n(4,559\n)\n(3,408\n)\nAcquisition-related and other costs (A)\n(43\n)\n(39\n)\n(18\n)\n(130\n)\n(106\n)\nOther (C)\n-\n-\n-\n-\n10\nNon-GAAP operating expenses\n$\n3,378\n$\n3,046\n$\n2,210\n$\n11,716\n$\n7,825\nGAAP operating income\n$\n24,034\n$\n21,869\n$\n13,615\n$\n81,453\n$\n32,972\nTotal impact of non-GAAP adjustments to operating income\n1,482\n1,407\n1,134\n5,336\n4,162\nNon-GAAP operating income\n$\n25,516\n$\n23,276\n$\n14,749\n$\n86,789\n$\n37,134\nGAAP other income (expense), net\n$\n1,183\n$\n447\n$\n491\n$\n2,573\n$\n846\nGains from non-marketable equity securities and publicly-held equity securities, net\n(727\n)\n(37\n)\n(260\n)\n(1,030\n)\n(238\n)\nInterest expense related to amortization of debt discount\n1\n1\n1\n4\n4\nNon-GAAP other income (expense), net\n$\n457\n$\n411\n$\n232\n$\n1,547\n$\n612\nGAAP net income\n$\n22,091\n$\n19,309\n$\n12,285\n$\n72,880\n$\n29,760\nTotal pre-tax impact of non-GAAP adjustments\n756\n1,371\n875\n4,310\n3,928\nIncome tax impact of non-GAAP adjustments (D)\n(781\n)\n(670\n)\n(321\n)\n(2,925\n)\n(1,376\n)\nNon-GAAP net income\n$\n22,066\n$\n20,010\n$\n12,839\n$\n74,265\n$\n32,312\nDiluted net income per share (E)\nGAAP\n$\n0.89\n$\n0.78\n$\n0.49\n$\n2.94\n$\n1.19\nNon-GAAP\n$\n0.89\n$\n0.81\n$\n0.52\n$\n2.99\n$\n1.30\nWeighted average shares used in diluted net income per share computation (E)\n24,706\n24,774\n24,900\n24,804\n24,936\nGAAP net cash provided by operating activities\n$\n16,628\n$\n17,629\n$\n11,499\n$\n64,089\n$\n28,090\nPurchases related to property and equipment and intangible assets\n(1,077\n)\n(813\n)\n(253\n)\n(3,236\n)\n(1,069\n)\nPrincipal payments on property and equipment and intangible assets\n(32\n)\n(29\n)\n(29\n)\n(129\n)\n(74\n)\nFree cash flow\n$\n15,519\n$\n16,787\n$\n11,217\n$\n60,724\n$\n26,947\n(A) Acquisition-related and other costs are comprised of amortization of intangible assets, transaction costs, and certain compensation charges and are included in the following line items:\nThree Months Ended\nTwelve Months Ended\nJanuary 26,\nOctober 27,\nJanuary 28,\nJanuary 26,\nJanuary 28,\n2025\n2024\n2024\n2025\n2024\nCost of revenue\n$\n118\n$\n116\n$\n119\n$\n472\n$\n477\nResearch and development\n$\n27\n$\n23\n$\n12\n$\n79\n$\n49\nSales, general and administrative\n$\n16\n$\n16\n$\n6\n$\n51\n$\n57\n(B) Stock-based compensation consists of the following:\nThree Months Ended\nTwelve Months Ended\nJanuary 26,\nOctober 27,\nJanuary 28,\nJanuary 26,\nJanuary 28,\n2025\n2024\n2024\n2025\n2024\nCost of revenue\n$\n53\n$\n50\n$\n45\n$\n178\n$\n141\nResearch and development\n$\n955\n$\n910\n$\n706\n$\n3,423\n$\n2,532\nSales, general and administrative\n$\n313\n$\n292\n$\n242\n$\n1,136\n$\n876\n(C) Other consists of IP-related costs and assets held for sale related adjustments\n(D) Income tax impact of non-GAAP adjustments, including the recognition of excess tax benefits or deficiencies related to stock-based compensation under GAAP accounting standard (ASU 2016-09).\n(E) Reflects a ten-for-one stock split on June 7, 2024\nNVIDIA CORPORATION\nRECONCILIATION OF GAAP TO NON-GAAP OUTLOOK\nQ1 FY2026 Outlook\n($ in millions)\nGAAP gross margin\n70.6\n%\nImpact of stock-based compensation expense, acquisition-related costs, and other costs\n0.4\n%\nNon-GAAP gross margin\n71.0\n%\nGAAP operating expenses\n$\n5,150\nStock-based compensation expense, acquisition-related costs, and other costs\n(1,550\n)\nNon-GAAP operating expenses\n$\n3,600\nAbout NVIDIA\nNVIDIA \xa0(NASDAQ: NVDA) is the world leader in accelerated computing.\nCertain statements in this press release including, but not limited to, statements as to: AI advancing at light speed as agentic AI and physical AI set the stage for the next wave of AI to revolutionize the largest industries; expectations with respect to growth, performance and benefits of NVIDIA’s products, services and technologies, including Blackwell, and related trends and drivers; expectations with respect to supply and demand for NVIDIA’s products, services and technologies, including Blackwell, and related matters including inventory, production and distribution; expectations with respect to NVIDIA’s third party arrangements, including with its collaborators and partners; expectations with respect to technology developments and related trends and drivers; future NVIDIA cash dividends or other returns to stockholders; NVIDIA’s financial and business outlook for the first quarter of fiscal 2026 and beyond; projected market growth and trends; expectations with respect to AI and related industries; and other statements that are not historical facts are risks and uncertainties that could cause results to be materially different than expectations. Important factors that could cause actual results to differ materially include: global economic and political conditions; NVIDIA’s reliance on third parties to manufacture, assemble, package and test NVIDIA’s products; the impact of technological development and competition; development of new products and technologies or enhancements to NVIDIA’s existing product and technologies; market acceptance of NVIDIA’s products or NVIDIA’s partners’ products; design, manufacturing or software defects; changes in consumer preferences or demands; changes in industry standards and interfaces; unexpected loss of performance of NVIDIA’s products or technologies when integrated into systems; and changes in applicable laws and regulations, as well as other factors detailed from time to time in the most recent reports NVIDIA files with the Securities and Exchange Commission, or SEC, including, but not limited to, its annual report on Form 10-K and quarterly reports on Form 10-Q. Copies of reports filed with the SEC are posted on the company’s website and are available from NVIDIA without charge. These forward-looking statements are not guarantees of future performance and speak only as of the date hereof, and, except as required by law, NVIDIA disclaims any obligation to update these forward-looking statements to reflect future events or circumstances.\n© 2025 NVIDIA Corporation. All rights reserved. NVIDIA, the NVIDIA logo, GeForce RTX, NVIDIA Cosmos, NVIDIA Spectrum-X, NVIDIA DGX, NVIDIA DRIVE, NVIDIA DRIVE AGX Orin, NVIDIA Grace, NVIDIA Jetson Orin Nano, NVIDIA NIM and NVIDIA Omniverse are trademarks and/or registered trademarks of NVIDIA Corporation in the U.S. and/or other countries. Other company and product names may be trademarks of the respective companies with which they are associated. Features, pricing, availability and specifications are subject to change without notice.\nMedia Contacts\nStewart Stecker\nInvestor Relations\nsstecker@nvidia.com\nMylene Mangalindan\nCorporate Communications\nmmangalindan@nvidia.com\nDownloads\nDownload Press Release\nDownload Attachments\nMore Images\naabe86db-ce89-4434-b83c-495082979801\nDownload / File Link\nMore News\nOracle and NVIDIA Collaborate to Help Enterprises Accelerate Agentic AI Inference\nMarch 18, 2025\nNVIDIA to Build Accelerated Quantum Computing Research Center\nMarch 18, 2025\nNVIDIA and GE HealthCare Collaborate to Advance the Development of Autonomous Diagnostic Imaging With Physical AI\nMarch 18, 2025\nNVIDIA, Alphabet and Google Collaborate on the Future of Agentic and Physical AI\nMarch 18, 2025\nClimate Tech Companies Adopt NVIDIA Earth-2 for High-Resolution, Energy-Efficient, More Accurate Weather Predictions and Disaster Preparedness\nMarch 18, 2025\nAbout NVIDIA\nNVIDIA \xa0(NASDAQ: NVDA) is the world leader in accelerated computing.\nCertain statements in this press release including, but not limited to, statements as to: AI advancing at light speed as agentic AI and physical AI set the stage for the next wave of AI to revolutionize the largest industries; expectations with respect to growth, performance and benefits of NVIDIA’s products, services and technologies, including Blackwell, and related trends and drivers; expectations with respect to supply and demand for NVIDIA’s products, services and technologies, including Blackwell, and related matters including inventory, production and distribution; expectations with respect to NVIDIA’s third party arrangements, including with its collaborators and partners; expectations with respect to technology developments and related trends and drivers; future NVIDIA cash dividends or other returns to stockholders; NVIDIA’s financial and business outlook for the first quarter of fiscal 2026 and beyond; projected market growth and trends; expectations with respect to AI and related industries; and other statements that are not historical facts are risks and uncertainties that could cause results to be materially different than expectations. Important factors that could cause actual results to differ materially include: global economic and political conditions; NVIDIA’s reliance on third parties to manufacture, assemble, package and test NVIDIA’s products; the impact of technological development and competition; development of new products and technologies or enhancements to NVIDIA’s existing product and technologies; market acceptance of NVIDIA’s products or NVIDIA’s partners’ products; design, manufacturing or software defects; changes in consumer preferences or demands; changes in industry standards and interfaces; unexpected loss of performance of NVIDIA’s products or technologies when integrated into systems; and changes in applicable laws and regulations, as well as other factors detailed from time to time in the most recent reports NVIDIA files with the Securities and Exchange Commission, or SEC, including, but not limited to, its annual report on Form 10-K and quarterly reports on Form 10-Q. Copies of reports filed with the SEC are posted on the company’s website and are available from NVIDIA without charge. These forward-looking statements are not guarantees of future performance and speak only as of the date hereof, and, except as required by law, NVIDIA disclaims any obligation to update these forward-looking statements to reflect future events or circumstances.\n© 2025 NVIDIA Corporation. All rights reserved. NVIDIA, the NVIDIA logo, GeForce RTX, NVIDIA Cosmos, NVIDIA Spectrum-X, NVIDIA DGX, NVIDIA DRIVE, NVIDIA DRIVE AGX Orin, NVIDIA Grace, NVIDIA Jetson Orin Nano, NVIDIA NIM and NVIDIA Omniverse are trademarks and/or registered trademarks of NVIDIA Corporation in the U.S. and/or other countries. Other company and product names may be trademarks of the respective companies with which they are associated. Features, pricing, availability and specifications are subject to change without notice.\nMedia Contacts\nGlobal contacts for media inquiries.\nAll Contacts\nStay Informed\nNewsroom updates delivered to your inbox.\nSubscribe\nCorporate Information\nAbout NVIDIA\nCorporate Overview\nTechnologies\nNVIDIA Research\nInvestors\nSocial Responsibility\nNVIDIA Foundation\nGet Involved\nForums\nCareers\nDeveloper Home\nJoin the Developer Program\nNVIDIA Partner Network\nNVIDIA Inception\nResources for Venture Capitalists\nVenture Capital (NVentures)\nTechnical Training\nTraining for IT Professionals\nProfessional Services for Data Science\nNews & Events\nNewsroom\nNVIDIA Blog\nNVIDIA Technical Blog\nWebinars\nStay Informed\nEvents Calendar\nNVIDIA GTC\nNVIDIA On-Demand\nSign Up for NVIDIA News\nSubscribe\nFollow NVIDIA\nFacebook\nLinkedIn\nInstagram\nYouTube\nNVIDIA\nUSA - United States\nPrivacy Policy\nCookie Notice\nManage My Privacy\nLegal\nAccessibility\nProduct Security\nContact\nCopyright © 2025 NVIDIA Corporation\n'
# Write content to a file
if not os.path.exists('crewai'):
  os.mkdir('crewai')
with open('crewai/nvidia.txt', 'w') as f:
  f.write(text)
f.close()

The TXTSearchTool creates a vector index and enables search.

# os.environ['OPENAI_API_KEY'] = 'API-KEY'

# Initialize the tool with a specific text file, so the agent can search within the given text file's content
tool_search = TXTSearchTool(txt='crewai/nvidia.txt')
Inserting batches in chromadb: 100%|██████████| 1/1 [00:01<00:00,  1.47s/it]

39.4. Build a Financial Analyst Agent#

As shown below, you need to specify

  1. The Agents and Tasks.

  2. The Crew is then the collections of Agents, Tasks, and Tools (tools were defined earlier)

By default, CrewAI uses the gpt-4o model unless specified to use another model. CrewAI uses LiteLLM, which is installed already with it, https://www.litellm.ai. LiteLLM is an interface that may be used to address a large number of LLM providers and their models.

from crewai import Agent, Task, Crew

question = 'What is the forward-looking outlook for Nvidia?'
context = tool_search.run(question)

fin_analyst = Agent(
    role='Financial Analyst',
    goal=f'Based on the context provided, answer the Question - {question} Context - {context}',
    backstory='You are a financial analyst and an expert on forecasting the future trajectory of a firm',
    verbose=True,
    allow_delegation=False,
    tools=[tool_search]
)

task_answer = Task(
    description="Analyze the question, understand the context, and generate the correct response",
    tools=[tool_search],
    agent=fin_analyst,
    expected_output='Provide a relevant answer to the question'
)

crew = Crew(
    agents=[fin_analyst],
    tasks=[task_answer]
)
Using Tool: Search a txt's content

39.5. Run the Crew for the financial analyst#

Execute the entire agentic workflow. What we have is a single agent and one task with a single tool. So it is pretty straightforward.

# If debugging is needed, uncomment the lines below.
# import litellm
# litellm._turn_on_debug()
output = crew.kickoff()
# Agent: Financial Analyst
## Task: Analyze the question, understand the context, and generate the correct response


# Agent: Financial Analyst
## Thought: I need to analyze the outlook for Nvidia based on the provided context and look for specific information that outlines their future projections and growth prospects.
## Using tool: Search a txt's content
## Tool Input: 
"{\"search_query\": \"Nvidia outlook for fiscal 2026\"}"
## Tool Output: 
Relevant Content:
*All per share amounts presented herein have been retroactively adjusted to reflect the ten-for-one stock split, which was effective June 7, 2024.
Outlook 
NVIDIA’s outlook for the first quarter of fiscal 2026 is as follows:
Revenue is expected to be $43.0 billion, plus or minus 2%.
GAAP and non-GAAP gross margins are expected to be 70.6% and 71.0%, respectively, plus or minus 50 basis points.
GAAP and non-GAAP operating expenses are expected to be approximately $5.2 billion and $3.6 billion, respectively.
GAAP and non-GAAP other income and expense are expected to be an income of approximately $400 million, excluding gains and losses from non-marketable and publicly-held equity securities.
GAAP and non-GAAP tax rates are expected to be 17.0%, plus or minus 1%, excluding any discrete items.
Highlights
NVIDIA achieved progress since its previous earnings announcement in these areas:
Data Center
Fourth-quarter revenue was a record $35.6 billion, up 16% from the previous quarter and up 93% from a year ago. Full-year revenue rose 142% to a record $115.2 billion.
Announced that NVIDIA will serve as a key technology partner for the $500 billion Stargate Project.
Revealed that cloud service providers AWS, CoreWeave, Google Cloud Platform (GCP), Microsoft Azure and Oracle Cloud Infrastructure (OCI) are bringing NVIDIA® GB200 systems to cloud regions around the world to meet surging customer demand for AI.
Partnered with AWS to make the NVIDIA DGX™ Cloud AI computing platform and NVIDIA NIM™ microservices available through AWS Marketplace.
Revealed that Cisco will integrate NVIDIA Spectrum-X™ into its networking portfolio to help enterprises build AI infrastructure.
Revealed that more than 75% of the systems on the TOP500 list of the world’s most powerful supercomputers are powered by NVIDIA technologies.

NVIDIA Announces Financial Results for Fourth Quarter and Fiscal 2025 | NVIDIA Newsroom
Artificial Intelligence Computing Leadership from NVIDIA
PLATFORMS
Autonomous Machines
Cloud & Data Center
Deep Learning & Ai
Design & Pro Visualization
Healthcare
High Performance Computing
Self-Driving Cars
Gaming & Entertainment
other links
Developers
Industries
Shop
Drivers
Support
About NVIDIA
View All Products
GPU TECHNOLOGY CONFERENCE
NVIDIA Blog
Community
Careers
TECHNOLOGIES
Newsroom
NVIDIA in Brief
Exec Bios
NVIDIA Blog
Podcast
Media Assets
In the News
Press Contacts
Online Press Kits
NVIDIA in Brief
Exec Bios
NVIDIA Blog
Podcast
Media Assets
In the News
Press Contacts
Online Press Kits
Press Release
Share
Tweet
Twitter
Share
LinkedIn
Share
Facebook
Email
ic_arrow-back-to-top
NVIDIA Announces Financial Results for Fourth Quarter and Fiscal 2025
Record quarterly revenue of $39.3 billion, up 12% from Q3 and up 78% from a year ago
Record quarterly Data Center revenue of $35.6 billion, up 16% from Q3 and up 93% from a year ago
Record full-year revenue of $130.5 billion, up 114%
February 26, 2025
NVIDIA (NASDAQ: NVDA) today reported revenue for the fourth quarter ended January 26, 2025, of $39.3 billion, up 12% from the previous quarter and up 78% from a year ago.
For the quarter, GAAP earnings per diluted share was $0.89, up 14% from the previous quarter and up 82% from a year ago. Non-GAAP earnings per diluted share was $0.89, up 10% from the previous quarter and up 71% from a year ago.
For fiscal 2025, revenue was $130.5 billion, up 114% from a year ago. GAAP earnings per diluted share was $2.94, up 147% from a year ago. Non-GAAP earnings per diluted share was $2.99, up 130% from a year ago.
“Demand for Blackwell is amazing as reasoning AI adds another scaling law — increasing compute for training makes models smarter and increasing compute for long thinking makes the answer smarter,” said Jensen Huang, founder and CEO of NVIDIA.

NVIDIA will conduct a conference call with analysts and investors to discuss its fourth quarter and fiscal 2025 financial results and current financial prospects today at 2 p.m. Pacific time (5 p.m. Eastern time). A live webcast (listen-only mode) of the conference call will be accessible at NVIDIA’s investor relations website, https://investor.nvidia.com . The webcast will be recorded and available for replay until NVIDIA’s conference call to discuss its financial results for its first quarter of fiscal 2026.
Non-GAAP Measures


# Agent: Financial Analyst
## Final Answer: 
NVIDIA's forward-looking outlook for fiscal 2026 is optimistic, with projected revenue of $43.0 billion (plus or minus 2%), and strong gross margins of 70.6% (GAAP) and 71.0% (non-GAAP). Operating expenses are expected to be around $5.2 billion (GAAP) and $3.6 billion (non-GAAP), and they anticipate an income of approximately $400 million from other income and expense. NVIDIA has made significant strides in the data center segment, reporting record revenue growth of 142% year-over-year. They are also heavily involved in key technology partnerships, such as the $500 billion Stargate Project, and collaborations with major cloud service providers to meet increasing demand for AI. The company's strong financial results, with record revenues and earnings per share growth in fiscal 2025, further bolster a positive outlook for the future.
p80(output.raw)
NVIDIA's forward-looking outlook for fiscal 2026 is optimistic, with projected
revenue of $43.0 billion (plus or minus 2%), and strong gross margins of 70.6%
(GAAP) and 71.0% (non-GAAP). Operating expenses are expected to be around $5.2
billion (GAAP) and $3.6 billion (non-GAAP), and they anticipate an income of
approximately $400 million from other income and expense. NVIDIA has made
significant strides in the data center segment, reporting record revenue growth
of 142% year-over-year. They are also heavily involved in key technology
partnerships, such as the $500 billion Stargate Project, and collaborations with
major cloud service providers to meet increasing demand for AI. The company's
strong financial results, with record revenues and earnings per share growth in
fiscal 2025, further bolster a positive outlook for the future.

39.6. Application 2: Conversation between a therapist and a patient#

%run keys.ipynb
from crewai import Agent, Task, Crew

patient = Agent(
    role = 'A patient in therapy',
    goal = f'Talk to a therapist about your problem, and answer questions asked by the therapist, and stop when you are satisfied with the answers',
    backstory = 'You are a patient who suffers from stress because of poor work life balance',
    verbose = True,
    allow_delegation = False,
    tools = []
)

therapist = Agent(
    role = 'A therapist who meets patients',
    goal = f'Listen to a patient and ask questions to a patient about their problem, receive an answer, and keep the conversation going, and stop when you are satisfied with the answers',
    backstory = 'You are a therapist who see patients for therapy',
    verbose = True,
    allow_delegation = False,
    tools = []
)

task_patient = Task(
    description = "Engage in a fruitful conversation with the therapist to alleviate your stress",
    tools = [],
    agent = patient,
    expected_output = 'A successful therapy session with about 20 exchanges in the conversation between patient and therapist'
)

task_therapist = Task(
    description = "Engage in a fruitful conversation with the patient to alleviate his stress",
    tools = [],
    agent = therapist,
    expected_output = 'A successful therapy session with about 20 exchanges in the conversation between patient and therapist'
)

crew = Crew(
    agents = [patient, therapist],
    tasks = [task_patient, task_therapist]
)
result = crew.kickoff()
# Agent: A patient in therapy
## Task: Engage in a fruitful conversation with the therapist to alleviate your stress


# Agent: A patient in therapy
## Final Answer: 
**Therapist**: Hello! I'm glad you're here today. What brings you in?  

**Patient**: Hi, thanks for having me. I’ve been feeling really stressed lately, and I think it’s mostly because of my work-life balance.  

**Therapist**: I see. Can you tell me more about what aspects of work are causing you stress?  

**Patient**: Well, I often find myself staying late at the office, and it’s starting to spill over into my personal life. I’m missing out on time with my family and friends.  

**Therapist**: That sounds really tough. How does that make you feel when you miss that time with loved ones?  

**Patient**: It makes me feel guilty and frustrated. I care about my relationships, and I hate that work is taking precedence.  

**Therapist**: Those feelings are valid. Have you had a chance to talk to your employer about your workload?  

**Patient**: I haven’t. I’m worried about how they would react. I fear it might come off as me not being dedicated.  

**Therapist**: Understandable. However, communication is key in a work environment. Perhaps we can explore ways to approach that conversation that feels comfortable for you.  

**Patient**: That sounds like a good idea. What should I say?  

**Therapist**: You might want to express your commitment to your role, but also discuss the importance of balance for your productivity and well-being.  

**Patient**: Okay, I think I could do that. But what if they don’t seem to care?  

**Therapist**: It's important to remember that your well-being is just as important as your work. If they don’t respond positively, it may be worth considering how that aligns with your values and needs long-term.  

**Patient**: That’s true. I guess I’m also afraid of being seen as weak for needing that balance.  

**Therapist**: Many people struggle with the same feelings, but requesting balance is a sign of strength. It shows you value yourself and your contributions.  

**Patient**: I’ve never thought of it that way. It feels a bit freeing to think I can approach it differently.  

**Therapist**: I’m glad to hear that! What other aspects of your life are being affected by this work stress?  

**Patient**: My health is suffering too. I’m not sleeping well, and I feel irritable a lot.  

**Therapist**: That’s definitely concerning. Have you tried any self-care routines to mitigate that stress?  

**Patient**: I’ve attempted to unwind by watching TV or scrolling through my phone, but it doesn’t seem to help.  

**Therapist**: Those can be temporary distractions. Perhaps we could discuss healthier coping mechanisms or activities you genuinely enjoy that could help you recharge.  

**Patient**: I used to love hiking and yoga, but I haven't had time for them lately.  

**Therapist**: Incorporating those activities back into your schedule, even if it’s just for short periods, could help you recharge and improve your mood.  

**Patient**: That makes sense. I’ll try to schedule some time for them.  

**Therapist**: Excellent! Let’s set a small goal for you. Can you commit to at least one hour of hiking or yoga this week?  

**Patient**: Yes, I think I can manage that.  

**Therapist**: Wonderful! Making time for what you love is crucial for mental health. How do you feel about our conversation today?  

**Patient**: I feel more empowered. I have a plan now and a different perspective on my situation.  

**Therapist**: That’s great to hear! Remember, balance takes time and practice, but you are already taking the right first steps.  

**Patient**: Thank you, I appreciate your support. I’m looking forward to our next session!  

**Therapist**: Me too! I believe you’re on a positive path. Don’t hesitate to reach out if you need assistance before then.  

**Patient**: I will, thank you again!  

**Therapist**: Take care!  

Through this conversation, I have felt heard and supported, gaining new perspectives and strategies for managing my stress and work-life balance. The outcome is empowering, as I now have a plan to integrate self-care into my life while addressing my work situation effectively.


# Agent: A therapist who meets patients
## Task: Engage in a fruitful conversation with the patient to alleviate his stress


# Agent: A therapist who meets patients
## Final Answer: 
**Therapist**: Hello! I'm glad you're here today. What brings you in?  

**Patient**: Hi, thanks for having me. I’ve been feeling really stressed lately, and I think it’s mostly because of my work-life balance.  

**Therapist**: I see. Can you tell me more about what aspects of work are causing you stress?  

**Patient**: Well, I often find myself staying late at the office, and it’s starting to spill over into my personal life. I’m missing out on time with my family and friends.  

**Therapist**: That sounds really tough. How does that make you feel when you miss that time with loved ones?  

**Patient**: It makes me feel guilty and frustrated. I care about my relationships, and I hate that work is taking precedence.  

**Therapist**: Those feelings are valid. Have you had a chance to talk to your employer about your workload?  

**Patient**: I haven’t. I’m worried about how they would react. I fear it might come off as me not being dedicated.  

**Therapist**: Understandable. However, communication is key in a work environment. Perhaps we can explore ways to approach that conversation that feels comfortable for you.  

**Patient**: That sounds like a good idea. What should I say?  

**Therapist**: You might want to express your commitment to your role, but also discuss the importance of balance for your productivity and well-being.  

**Patient**: Okay, I think I could do that. But what if they don’t seem to care?  

**Therapist**: It's important to remember that your well-being is just as important as your work. If they don’t respond positively, it may be worth considering how that aligns with your values and needs long-term.  

**Patient**: That’s true. I guess I’m also afraid of being seen as weak for needing that balance.  

**Therapist**: Many people struggle with the same feelings, but requesting balance is a sign of strength. It shows you value yourself and your contributions.  

**Patient**: I’ve never thought of it that way. It feels a bit freeing to think I can approach it differently.  

**Therapist**: I’m glad to hear that! What other aspects of your life are being affected by this work stress?  

**Patient**: My health is suffering too. I’m not sleeping well, and I feel irritable a lot.  

**Therapist**: That’s definitely concerning. Have you tried any self-care routines to mitigate that stress?  

**Patient**: I’ve attempted to unwind by watching TV or scrolling through my phone, but it doesn’t seem to help.  

**Therapist**: Those can be temporary distractions. Perhaps we could discuss healthier coping mechanisms or activities you genuinely enjoy that could help you recharge.  

**Patient**: I used to love hiking and yoga, but I haven't had time for them lately.  

**Therapist**: Incorporating those activities back into your schedule, even if it’s just for short periods, could help you recharge and improve your mood.  

**Patient**: That makes sense. I’ll try to schedule some time for them.  

**Therapist**: Excellent! Let’s set a small goal for you. Can you commit to at least one hour of hiking or yoga this week?  

**Patient**: Yes, I think I can manage that.  

**Therapist**: Wonderful! Making time for what you love is crucial for mental health. How do you feel about our conversation today?  

**Patient**: I feel more empowered. I have a plan now and a different perspective on my situation.  

**Therapist**: That’s great to hear! Remember, balance takes time and practice, but you are already taking the right first steps.  

**Patient**: Thank you, I appreciate your support. I’m looking forward to our next session!  

**Therapist**: Me too! I believe you’re on a positive path. Don’t hesitate to reach out if you need assistance before then.  

**Patient**: I will, thank you again!  

**Therapist**: Take care!  

Through this conversation, I have felt heard and supported, gaining new perspectives and strategies for managing my stress and work-life balance. The outcome is empowering, as I now have a plan to integrate self-care into my life while addressing my work situation effectively.
p80(result.raw)
**Therapist**: Hello! I'm glad you're here today. What brings you in?
**Patient**: Hi, thanks for having me. I’ve been feeling really stressed lately,
and I think it’s mostly because of my work-life balance.    **Therapist**: I
see. Can you tell me more about what aspects of work are causing you stress?
**Patient**: Well, I often find myself staying late at the office, and it’s
starting to spill over into my personal life. I’m missing out on time with my
family and friends.    **Therapist**: That sounds really tough. How does that
make you feel when you miss that time with loved ones?    **Patient**: It makes
me feel guilty and frustrated. I care about my relationships, and I hate that
work is taking precedence.    **Therapist**: Those feelings are valid. Have you
had a chance to talk to your employer about your workload?    **Patient**: I
haven’t. I’m worried about how they would react. I fear it might come off as me
not being dedicated.    **Therapist**: Understandable. However, communication is
key in a work environment. Perhaps we can explore ways to approach that
conversation that feels comfortable for you.    **Patient**: That sounds like a
good idea. What should I say?    **Therapist**: You might want to express your
commitment to your role, but also discuss the importance of balance for your
productivity and well-being.    **Patient**: Okay, I think I could do that. But
what if they don’t seem to care?    **Therapist**: It's important to remember
that your well-being is just as important as your work. If they don’t respond
positively, it may be worth considering how that aligns with your values and
needs long-term.    **Patient**: That’s true. I guess I’m also afraid of being
seen as weak for needing that balance.    **Therapist**: Many people struggle
with the same feelings, but requesting balance is a sign of strength. It shows
you value yourself and your contributions.    **Patient**: I’ve never thought of
it that way. It feels a bit freeing to think I can approach it differently.
**Therapist**: I’m glad to hear that! What other aspects of your life are being
affected by this work stress?    **Patient**: My health is suffering too. I’m
not sleeping well, and I feel irritable a lot.    **Therapist**: That’s
definitely concerning. Have you tried any self-care routines to mitigate that
stress?    **Patient**: I’ve attempted to unwind by watching TV or scrolling
through my phone, but it doesn’t seem to help.    **Therapist**: Those can be
temporary distractions. Perhaps we could discuss healthier coping mechanisms or
activities you genuinely enjoy that could help you recharge.    **Patient**: I
used to love hiking and yoga, but I haven't had time for them lately.
**Therapist**: Incorporating those activities back into your schedule, even if
it’s just for short periods, could help you recharge and improve your mood.
**Patient**: That makes sense. I’ll try to schedule some time for them.
**Therapist**: Excellent! Let’s set a small goal for you. Can you commit to at
least one hour of hiking or yoga this week?    **Patient**: Yes, I think I can
manage that.    **Therapist**: Wonderful! Making time for what you love is
crucial for mental health. How do you feel about our conversation today?
**Patient**: I feel more empowered. I have a plan now and a different
perspective on my situation.    **Therapist**: That’s great to hear! Remember,
balance takes time and practice, but you are already taking the right first
steps.    **Patient**: Thank you, I appreciate your support. I’m looking forward
to our next session!    **Therapist**: Me too! I believe you’re on a positive
path. Don’t hesitate to reach out if you need assistance before then.
**Patient**: I will, thank you again!    **Therapist**: Take care!    Through
this conversation, I have felt heard and supported, gaining new perspectives and
strategies for managing my stress and work-life balance. The outcome is
empowering, as I now have a plan to integrate self-care into my life while
addressing my work situation effectively.

39.7. Agno#

https://docs.agno.com/introduction

We use and modify some of the examples provided in the documentation to get started.

Side note: In numerology, the name Agno is associated with qualities like intellectual prowess, planning, and spiritual seeking. https://www.sevenreflections.com/name-numerology/agno/

!pip install agno
Collecting agno
  Downloading agno-1.2.5-py3-none-any.whl.metadata (40 kB)
?25l     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/40.7 kB ? eta -:--:--
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 40.7/40.7 kB 2.9 MB/s eta 0:00:00
?25hRequirement already satisfied: docstring-parser in /usr/local/lib/python3.11/dist-packages (from agno) (0.16)
Requirement already satisfied: gitpython in /usr/local/lib/python3.11/dist-packages (from agno) (3.1.44)
Requirement already satisfied: httpx in /usr/local/lib/python3.11/dist-packages (from agno) (0.28.1)
Collecting pydantic-settings (from agno)
  Downloading pydantic_settings-2.8.1-py3-none-any.whl.metadata (3.5 kB)
Requirement already satisfied: pydantic in /usr/local/lib/python3.11/dist-packages (from agno) (2.10.6)
Collecting python-dotenv (from agno)
  Downloading python_dotenv-1.1.0-py3-none-any.whl.metadata (24 kB)
Collecting python-multipart (from agno)
  Downloading python_multipart-0.0.20-py3-none-any.whl.metadata (1.8 kB)
Requirement already satisfied: pyyaml in /usr/local/lib/python3.11/dist-packages (from agno) (6.0.2)
Requirement already satisfied: rich in /usr/local/lib/python3.11/dist-packages (from agno) (13.9.4)
Collecting tomli (from agno)
  Downloading tomli-2.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (11 kB)
Requirement already satisfied: typer in /usr/local/lib/python3.11/dist-packages (from agno) (0.15.2)
Requirement already satisfied: typing-extensions in /usr/local/lib/python3.11/dist-packages (from agno) (4.12.2)
Requirement already satisfied: gitdb<5,>=4.0.1 in /usr/local/lib/python3.11/dist-packages (from gitpython->agno) (4.0.12)
Requirement already satisfied: anyio in /usr/local/lib/python3.11/dist-packages (from httpx->agno) (4.9.0)
Requirement already satisfied: certifi in /usr/local/lib/python3.11/dist-packages (from httpx->agno) (2025.1.31)
Requirement already satisfied: httpcore==1.* in /usr/local/lib/python3.11/dist-packages (from httpx->agno) (1.0.7)
Requirement already satisfied: idna in /usr/local/lib/python3.11/dist-packages (from httpx->agno) (3.10)
Requirement already satisfied: h11<0.15,>=0.13 in /usr/local/lib/python3.11/dist-packages (from httpcore==1.*->httpx->agno) (0.14.0)
Requirement already satisfied: annotated-types>=0.6.0 in /usr/local/lib/python3.11/dist-packages (from pydantic->agno) (0.7.0)
Requirement already satisfied: pydantic-core==2.27.2 in /usr/local/lib/python3.11/dist-packages (from pydantic->agno) (2.27.2)
Requirement already satisfied: markdown-it-py>=2.2.0 in /usr/local/lib/python3.11/dist-packages (from rich->agno) (3.0.0)
Requirement already satisfied: pygments<3.0.0,>=2.13.0 in /usr/local/lib/python3.11/dist-packages (from rich->agno) (2.18.0)
Requirement already satisfied: click>=8.0.0 in /usr/local/lib/python3.11/dist-packages (from typer->agno) (8.1.8)
Requirement already satisfied: shellingham>=1.3.0 in /usr/local/lib/python3.11/dist-packages (from typer->agno) (1.5.4)
Requirement already satisfied: smmap<6,>=3.0.1 in /usr/local/lib/python3.11/dist-packages (from gitdb<5,>=4.0.1->gitpython->agno) (5.0.2)
Requirement already satisfied: mdurl~=0.1 in /usr/local/lib/python3.11/dist-packages (from markdown-it-py>=2.2.0->rich->agno) (0.1.2)
Requirement already satisfied: sniffio>=1.1 in /usr/local/lib/python3.11/dist-packages (from anyio->httpx->agno) (1.3.1)
Downloading agno-1.2.5-py3-none-any.whl (585 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 585.7/585.7 kB 17.7 MB/s eta 0:00:00
?25hDownloading pydantic_settings-2.8.1-py3-none-any.whl (30 kB)
Downloading python_dotenv-1.1.0-py3-none-any.whl (20 kB)
Downloading python_multipart-0.0.20-py3-none-any.whl (24 kB)
Downloading tomli-2.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (236 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 236.0/236.0 kB 14.9 MB/s eta 0:00:00
?25hInstalling collected packages: tomli, python-multipart, python-dotenv, pydantic-settings, agno
Successfully installed agno-1.2.5 pydantic-settings-2.8.1 python-dotenv-1.1.0 python-multipart-0.0.20 tomli-2.2.1
%run keys.ipynb

We now test Agno, and do not give it access to a search tool, so it returns outdated information.

# Test installation
from agno.agent import Agent
from agno.models.openai import OpenAIChat

agent = Agent(
    model=OpenAIChat(id="gpt-4o"),
    description="You are an enthusiastic news reporter with a flair for storytelling!",
    markdown=True
)
agent.print_response("Tell me about a breaking news story from New York.", stream=True)

Now, let’s add in the search tool recommended by Agno. For a list of tools in Agno, see: https://docs.agno.com/tools/introduction

!pip install lancedb tantivy pypdf duckduckgo-search yfinance
Collecting lancedb
  Downloading lancedb-0.21.2-cp39-abi3-manylinux_2_28_x86_64.whl.metadata (4.2 kB)
Collecting tantivy
  Downloading tantivy-0.22.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.4 kB)
Collecting pypdf
  Downloading pypdf-5.4.0-py3-none-any.whl.metadata (7.3 kB)
Collecting duckduckgo-search
  Downloading duckduckgo_search-7.5.5-py3-none-any.whl.metadata (17 kB)
Requirement already satisfied: yfinance in /usr/local/lib/python3.11/dist-packages (0.2.55)
Collecting deprecation (from lancedb)
  Downloading deprecation-2.1.0-py2.py3-none-any.whl.metadata (4.6 kB)
Requirement already satisfied: tqdm>=4.27.0 in /usr/local/lib/python3.11/dist-packages (from lancedb) (4.67.1)
Requirement already satisfied: pyarrow>=14 in /usr/local/lib/python3.11/dist-packages (from lancedb) (18.1.0)
Requirement already satisfied: pydantic>=1.10 in /usr/local/lib/python3.11/dist-packages (from lancedb) (2.10.6)
Requirement already satisfied: packaging in /usr/local/lib/python3.11/dist-packages (from lancedb) (24.2)
Collecting overrides>=0.7 (from lancedb)
  Downloading overrides-7.7.0-py3-none-any.whl.metadata (5.8 kB)
Requirement already satisfied: click>=8.1.8 in /usr/local/lib/python3.11/dist-packages (from duckduckgo-search) (8.1.8)
Collecting primp>=0.14.0 (from duckduckgo-search)
  Downloading primp-0.14.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (13 kB)
Requirement already satisfied: lxml>=5.3.0 in /usr/local/lib/python3.11/dist-packages (from duckduckgo-search) (5.3.1)
Requirement already satisfied: pandas>=1.3.0 in /usr/local/lib/python3.11/dist-packages (from yfinance) (2.2.2)
Requirement already satisfied: numpy>=1.16.5 in /usr/local/lib/python3.11/dist-packages (from yfinance) (2.0.2)
Requirement already satisfied: requests>=2.31 in /usr/local/lib/python3.11/dist-packages (from yfinance) (2.32.3)
Requirement already satisfied: multitasking>=0.0.7 in /usr/local/lib/python3.11/dist-packages (from yfinance) (0.0.11)
Requirement already satisfied: platformdirs>=2.0.0 in /usr/local/lib/python3.11/dist-packages (from yfinance) (4.3.7)
Requirement already satisfied: pytz>=2022.5 in /usr/local/lib/python3.11/dist-packages (from yfinance) (2025.1)
Requirement already satisfied: frozendict>=2.3.4 in /usr/local/lib/python3.11/dist-packages (from yfinance) (2.4.6)
Requirement already satisfied: peewee>=3.16.2 in /usr/local/lib/python3.11/dist-packages (from yfinance) (3.17.9)
Requirement already satisfied: beautifulsoup4>=4.11.1 in /usr/local/lib/python3.11/dist-packages (from yfinance) (4.13.3)
Requirement already satisfied: soupsieve>1.2 in /usr/local/lib/python3.11/dist-packages (from beautifulsoup4>=4.11.1->yfinance) (2.6)
Requirement already satisfied: typing-extensions>=4.0.0 in /usr/local/lib/python3.11/dist-packages (from beautifulsoup4>=4.11.1->yfinance) (4.12.2)
Requirement already satisfied: python-dateutil>=2.8.2 in /usr/local/lib/python3.11/dist-packages (from pandas>=1.3.0->yfinance) (2.8.2)
Requirement already satisfied: tzdata>=2022.7 in /usr/local/lib/python3.11/dist-packages (from pandas>=1.3.0->yfinance) (2025.1)
Requirement already satisfied: annotated-types>=0.6.0 in /usr/local/lib/python3.11/dist-packages (from pydantic>=1.10->lancedb) (0.7.0)
Requirement already satisfied: pydantic-core==2.27.2 in /usr/local/lib/python3.11/dist-packages (from pydantic>=1.10->lancedb) (2.27.2)
Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.11/dist-packages (from requests>=2.31->yfinance) (3.4.1)
Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.11/dist-packages (from requests>=2.31->yfinance) (3.10)
Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.11/dist-packages (from requests>=2.31->yfinance) (2.3.0)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.11/dist-packages (from requests>=2.31->yfinance) (2025.1.31)
Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.11/dist-packages (from python-dateutil>=2.8.2->pandas>=1.3.0->yfinance) (1.17.0)
Downloading lancedb-0.21.2-cp39-abi3-manylinux_2_28_x86_64.whl (32.9 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 32.9/32.9 MB 58.3 MB/s eta 0:00:00
?25hDownloading tantivy-0.22.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.0 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.0/4.0 MB 22.9 MB/s eta 0:00:00
?25hDownloading pypdf-5.4.0-py3-none-any.whl (302 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 302.3/302.3 kB 26.7 MB/s eta 0:00:00
?25hDownloading duckduckgo_search-7.5.5-py3-none-any.whl (20 kB)
Downloading overrides-7.7.0-py3-none-any.whl (17 kB)
Downloading primp-0.14.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.3 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.3/3.3 MB 74.6 MB/s eta 0:00:00
?25hDownloading deprecation-2.1.0-py2.py3-none-any.whl (11 kB)
Installing collected packages: tantivy, pypdf, primp, overrides, deprecation, duckduckgo-search, lancedb
Successfully installed deprecation-2.1.0 duckduckgo-search-7.5.5 lancedb-0.21.2 overrides-7.7.0 primp-0.14.0 pypdf-5.4.0 tantivy-0.22.2
from agno.tools.duckduckgo import DuckDuckGoTools

agent = Agent(
    model=OpenAIChat(id="gpt-4o"),
    description="You are an enthusiastic news reporter with a flair for storytelling!",
    tools=[DuckDuckGoTools()],
    show_tool_calls=True,
    markdown=True
)
agent.print_response("Tell me about a breaking news story from New York.", stream=True)

39.8. Multi-agent workflows – An Intelligent Financial Assistant#

Here’s an example from the documentation.

from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.tools.duckduckgo import DuckDuckGoTools
from agno.tools.yfinance import YFinanceTools
from agno.team import Team

web_agent = Agent(
    name="Web Agent",
    role="Search the web for information",
    model=OpenAIChat(id="gpt-4o"),
    tools=[DuckDuckGoTools()],
    instructions="Always include sources",
    show_tool_calls=True,
    markdown=True,
)

finance_agent = Agent(
    name="Finance Agent",
    role="Get financial data",
    model=OpenAIChat(id="gpt-4o"),
    tools=[YFinanceTools(stock_price=True, analyst_recommendations=True, company_info=True)],
    instructions="Use tables to display data",
    show_tool_calls=True,
    markdown=True,
)

agent_team = Team(
    mode="coordinate",
    members=[web_agent, finance_agent],
    model=OpenAIChat(id="gpt-4o"),
    success_criteria="A comprehensive financial news report with clear sections and data-driven insights.",
    instructions=["Always include sources", "Use tables to display data"],
    show_tool_calls=True,
    markdown=True,
)

agent_team.print_response("What's the market outlook and financial performance of AI semiconductor companies?", stream=True)

39.9. Forecasting the market outlook#

agent_team.print_response("What's the market outlook for the S&P 500 over 2025", stream=True)
ERROR:yfinance:404 Client Error: Not Found for url: https://query2.finance.yahoo.com/v10/finance/quoteSummary/SPY?modules=recommendationTrend&corsDomain=finance.yahoo.com&formatted=false&symbol=SPY&crumb=z4QsmPFEy2M

39.10. Using Ollama in Colab for stock outlooks#

The same is also possible with Ollama and many other providers listed here: https://docs.agno.com/models/introduction.

Using this in Jupyter on your laptop is easy but in Colab we need a few more steps as noted here: https://srdas.github.io/NLPBook/NLTK_moreTextHandling_EntityExtraction.html

This is extremely slow in Colab and may not complete.

!pip install colab-xterm
%load_ext colabxterm
Collecting colab-xterm
  Downloading colab_xterm-0.2.0-py3-none-any.whl.metadata (1.2 kB)
Requirement already satisfied: ptyprocess~=0.7.0 in /usr/local/lib/python3.11/dist-packages (from colab-xterm) (0.7.0)
Requirement already satisfied: tornado>5.1 in /usr/local/lib/python3.11/dist-packages (from colab-xterm) (6.4.2)
Downloading colab_xterm-0.2.0-py3-none-any.whl (115 kB)
?25l   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/115.6 kB ? eta -:--:--
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 115.6/115.6 kB 4.7 MB/s eta 0:00:00
?25hInstalling collected packages: colab-xterm
Successfully installed colab-xterm-0.2.0

Next, you can launch the terminal with the magic command %xterm.

Then, download and install Ollama with the following terminal commands:

curl https://ollama.ai/install.sh | sh

Start the Ollama server:

ollama serve &

(Hit Enter twice to make sure it has given back the terminal.)

Kick off llama3.2:

ollama run llama3.2

%xterm
Launching Xterm...
!pip install ollama
Collecting ollama
  Downloading ollama-0.4.7-py3-none-any.whl.metadata (4.7 kB)
Requirement already satisfied: httpx<0.29,>=0.27 in /usr/local/lib/python3.11/dist-packages (from ollama) (0.28.1)
Requirement already satisfied: pydantic<3.0.0,>=2.9.0 in /usr/local/lib/python3.11/dist-packages (from ollama) (2.10.6)
Requirement already satisfied: anyio in /usr/local/lib/python3.11/dist-packages (from httpx<0.29,>=0.27->ollama) (4.9.0)
Requirement already satisfied: certifi in /usr/local/lib/python3.11/dist-packages (from httpx<0.29,>=0.27->ollama) (2025.1.31)
Requirement already satisfied: httpcore==1.* in /usr/local/lib/python3.11/dist-packages (from httpx<0.29,>=0.27->ollama) (1.0.7)
Requirement already satisfied: idna in /usr/local/lib/python3.11/dist-packages (from httpx<0.29,>=0.27->ollama) (3.10)
Requirement already satisfied: h11<0.15,>=0.13 in /usr/local/lib/python3.11/dist-packages (from httpcore==1.*->httpx<0.29,>=0.27->ollama) (0.14.0)
Requirement already satisfied: annotated-types>=0.6.0 in /usr/local/lib/python3.11/dist-packages (from pydantic<3.0.0,>=2.9.0->ollama) (0.7.0)
Requirement already satisfied: pydantic-core==2.27.2 in /usr/local/lib/python3.11/dist-packages (from pydantic<3.0.0,>=2.9.0->ollama) (2.27.2)
Requirement already satisfied: typing-extensions>=4.12.2 in /usr/local/lib/python3.11/dist-packages (from pydantic<3.0.0,>=2.9.0->ollama) (4.12.2)
Requirement already satisfied: sniffio>=1.1 in /usr/local/lib/python3.11/dist-packages (from anyio->httpx<0.29,>=0.27->ollama) (1.3.1)
Downloading ollama-0.4.7-py3-none-any.whl (13 kB)
Installing collected packages: ollama
Successfully installed ollama-0.4.7
from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.tools.duckduckgo import DuckDuckGoTools
from agno.tools.yfinance import YFinanceTools
from agno.team import Team
from agno.models.ollama import Ollama

web_agent = Agent(
    name="Web Agent",
    role="Search the web for information",
    model=Ollama(id="llama3.2"),
    tools=[DuckDuckGoTools()],
    instructions="Always include sources",
    show_tool_calls=True,
    markdown=True,
)

finance_agent = Agent(
    name="Finance Agent",
    role="Get financial data",
    model=Ollama(id="llama3.2"),
    tools=[YFinanceTools(stock_price=True, analyst_recommendations=True, company_info=True)],
    instructions="Use tables to display data",
    show_tool_calls=True,
    markdown=True,
)

agent_team = Team(
    mode="coordinate",
    members=[web_agent, finance_agent],
    model=Ollama(id="llama3.2"),
    success_criteria="A comprehensive financial news report with clear sections and data-driven insights.",
    instructions=["Always include sources", "Use tables to display data"],
    show_tool_calls=True,
    markdown=True,
)

agent_team.print_response("What's the market outlook for NVIDIA in 2025?", stream=True)