{
 "cells": [
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# WebSurferAgent\n",
    "\n",
    "AutoGen provides a proof-of-concept WebSurferAgent that can command a simple text-based browser (similar to [Lynx](https://en.wikipedia.org/wiki/Lynx_(web_browser))) to search the web, visit pages, navigate within pages, download files, etc. The browsing is stateful, meaning that browsing history, viewport state, and other details are maintained throughout the conversation. \n",
    "\n",
    "This work was largely inspired by OpenAI's [WebGPT](https://openai.com/research/webgpt) project from December 2021. \n",
    "\n",
    "## Requirements\n",
    "\n",
    "AutoGen requires `Python>=3.8`. To run this notebook example, please install AutoGen with the optional `websurfer` dependencies:\n",
    "```bash\n",
    "pip install \"autogen-agentchat[websurfer]~=0.2\"\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "# %pip install --quiet \"autogen-agentchat[websurfer]~=0.2\""
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Set your API Endpoint\n",
    "\n",
    "The [`config_list_from_json`](https://microsoft.github.io/autogen/docs/reference/oai/openai_utils#config_list_from_json) function loads a list of configurations from an environment variable or a json file.\n",
    "\n",
    "It first looks for environment variable \"OAI_CONFIG_LIST\" which needs to be a valid json string. If that variable is not found, it then looks for a json file named \"OAI_CONFIG_LIST\". It filters the configs by models (you can filter by other keys as well).\n",
    "\n",
    "The WebSurferAgent uses a combination of models. GPT-4 and GPT-3.5-turbo-16 are recommended.\n",
    "\n",
    "Your json config should look something like the following:\n",
    "```json\n",
    "[\n",
    "    {\n",
    "        \"model\": \"gpt-4\",\n",
    "        \"api_key\": \"<your OpenAI API key here>\"\n",
    "    },\n",
    "    {\n",
    "        \"model\": \"gpt-3.5-turbo-16k\",\n",
    "        \"api_key\": \"<your OpenAI API key here>\"\n",
    "    }\n",
    "]\n",
    "```\n",
    "\n",
    "If you open this notebook in colab, you can upload your files by clicking the file icon on the left panel and then choose \"upload file\" icon.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import autogen  # noqa: E402\n",
    "\n",
    "llm_config = {\n",
    "    \"timeout\": 600,\n",
    "    \"cache_seed\": 44,  # change the seed for different trials\n",
    "    \"config_list\": autogen.config_list_from_json(\n",
    "        \"OAI_CONFIG_LIST\",\n",
    "        filter_dict={\"model\": [\"gpt-4\", \"gpt-4-0613\", \"gpt-4-32k\", \"gpt-4-32k-0613\", \"gpt-4-1106-preview\"]},\n",
    "    ),\n",
    "    \"temperature\": 0,\n",
    "}\n",
    "\n",
    "summarizer_llm_config = {\n",
    "    \"timeout\": 600,\n",
    "    \"cache_seed\": 44,  # change the seed for different trials\n",
    "    \"config_list\": autogen.config_list_from_json(\n",
    "        \"OAI_CONFIG_LIST\",\n",
    "        filter_dict={\"model\": [\"gpt-3.5-turbo-1106\", \"gpt-3.5-turbo-16k-0613\", \"gpt-3.5-turbo-16k\"]},\n",
    "    ),\n",
    "    \"temperature\": 0,\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Configure Bing\n",
    "\n",
    "For WebSurferAgent to be reasonably useful, it needs to be able to search the web -- and that means it needs a Bing API key. \n",
    "You can read more about how to get an API on the [Bing Web Search API](https://www.microsoft.com/en-us/bing/apis/bing-web-search-api) page.\n",
    "\n",
    "Once you have your key, either set it as the `BING_API_KEY` system environment variable, or simply input your key below.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "import os  # noqa: E402\n",
    "\n",
    "bing_api_key = os.environ[\"BING_API_KEY\"]"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Construct Agents\n",
    "\n",
    "We now create out WebSurferAgent, and a UserProxyAgent to surf the web. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "from autogen.agentchat.contrib.web_surfer import WebSurferAgent  # noqa: E402\n",
    "from autogen.browser_utils import BingMarkdownSearch, RequestsMarkdownBrowser  # noqa: E402\n",
    "\n",
    "browser = RequestsMarkdownBrowser(\n",
    "    downloads_folder=os.getcwd(),\n",
    "    search_engine=BingMarkdownSearch(bing_api_key=bing_api_key),\n",
    ")\n",
    "\n",
    "web_surfer = WebSurferAgent(\n",
    "    \"web_surfer\",\n",
    "    llm_config=llm_config,\n",
    "    summarizer_llm_config=summarizer_llm_config,\n",
    "    is_termination_msg=lambda x: x.get(\"content\", \"\").find(\"TERMINATE\") >= 0,\n",
    "    browser=browser,\n",
    ")\n",
    "\n",
    "user_proxy = autogen.UserProxyAgent(\n",
    "    \"user_proxy\",\n",
    "    human_input_mode=\"NEVER\",\n",
    "    code_execution_config=False,\n",
    "    default_auto_reply=\"\",\n",
    "    is_termination_msg=lambda x: True,\n",
    ")"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Example 1: Search, summarize\n",
    "- Search for information about Microsoft AutoGen\n",
    "- Summarize the results\n",
    "- Visit the Getting Started Docs page"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[33muser_proxy\u001b[0m (to web_surfer):\n",
      "\n",
      "\n",
      "Search the web for information about Microsoft AutoGen\n",
      "\n",
      "\n",
      "--------------------------------------------------------------------------------\n",
      "\u001b[31m\n",
      ">>>>>>>> USING AUTO REPLY...\u001b[0m\n",
      "\u001b[35m\n",
      ">>>>>>>> EXECUTING FUNCTION informational_web_search...\u001b[0m\n",
      "\u001b[33mweb_surfer\u001b[0m (to user_proxy):\n",
      "\n",
      "Address: search: Microsoft AutoGen\n",
      "Title: Microsoft AutoGen - Search\n",
      "Viewport position: Showing page 1 of 1.\n",
      "=======================\n",
      "## A Bing search for 'Microsoft AutoGen' found 19 results:\n",
      "\n",
      "1. [AutoGen: Enabling next-generation large language model applications](https://www.microsoft.com/en-us/research/blog/autogen-enabling-next-generation-large-language-model-applications/)\n",
      "AutoGen enables complex LLM-based workflows using multi-agent conversations. (Left) AutoGen agents are customizable and can be based on LLMs, tools, humans, and even a combination of them. (Top-right) Agents can converse to solve tasks. (Bottom-right) The framework supports many additional complex conversation patterns.\n",
      "\n",
      "2. [AutoGen - Microsoft Research](https://www.microsoft.com/en-us/research/project/autogen/)\n",
      "Related projects. AutoGen is an open-source, community-driven project under active development (as a spinoff from FLAML, a fast library for automated machine learning and tuning), which encourages contributions from individuals of all backgrounds.Many Microsoft Research collaborators have made great contributions to this project, including academic contributors like Pennsylvania State ...\n",
      "\n",
      "3. [AutoGen: Downloads - Microsoft Research](https://www.microsoft.com/en-us/research/project/autogen/downloads/)\n",
      "Enable Next-Gen Large Language Model Applications. AutoGen is a framework that enables the development of LLM applications using multiple agents that can converse with each other to solve tasks. AutoGen agents are customizable, conversable, and seamlessly allow human participation. They…. AutoGen allows developers to build LLM applications ...\n",
      "\n",
      "4. [Microsoft Semantic Kernel and AutoGen: Open Source Frameworks for AI ...](https://techcommunity.microsoft.com/t5/educator-developer-blog/microsoft-semantic-kernel-and-autogen-open-source-frameworks-for/ba-p/4051305)\n",
      "Microsoft AutoGen is designed for integrating and controlling multiple LLMs. It’s a research project that shows the potential of using multiple agents together. AutoGen allows for the creation of diverse teams of agents, each with their own specialized skills or goals. These agents can chat with each other, facilitating greater diversity in ...\n",
      "\n",
      "5. [GitHub - microsoft/autogen: A programming framework for agentic AI ...](https://github.com/microsoft/autogen)\n",
      "microsoft.github.io/autogen/ Topics chat chatbot gpt chat-application agent-based-framework agent-oriented-programming gpt-4 chatgpt llmops gpt-35-turbo llm-agent llm-inference agentic llm-framework agentic-agi\n",
      "\n",
      "6. [Getting Started | AutoGen - microsoft.github.io](https://microsoft.github.io/autogen/docs/Getting-Started/)\n",
      "Getting Started. AutoGen is a framework that enables development of LLM applications using multiple agents that can converse with each other to solve tasks. AutoGen agents are customizable, conversable, and seamlessly allow human participation. They can operate in various modes that employ combinations of LLMs, human inputs, and tools.\n",
      "\n",
      "7. [AutoGen | AutoGen - microsoft.github.io](https://microsoft.github.io/autogen/)\n",
      "AutoGen provides multi-agent conversation framework as a high-level abstraction. With this framework, one can conveniently build LLM workflows. Easily Build Diverse Applications. AutoGen offers a collection of working systems spanning a wide range of applications from various domains and complexities.\n",
      "\n",
      "8. [AutoGen Studio: Interactively Explore Multi-Agent Workflows](https://microsoft.github.io/autogen/blog/2023/12/01/AutoGenStudio/)\n",
      "To help you rapidly prototype multi-agent solutions for your tasks, we are introducing AutoGen Studio, an interface powered by AutoGen. It allows you to: Declaratively define and modify agents and multi-agent workflows through a point and click, drag and drop interface (e.g., you can select the parameters of two agents that will communicate to ...\n",
      "\n",
      "9. [AutoGen | Getting Started  A-Z  Install & Run | Easy | Microsoft](https://www.youtube.com/watch?v=UxtJsIDTFZo)\n",
      "Getting Started with AutoGen in 10 mins. AutoGen is a framework that enables the development of LLM applications using multiple agents that can converse with each other to solve tasks. AutoGen agents are customizable, conversable, and seamlessly allow human participation. They can operate in various modes that employ combinations of LLMs, human ...\n",
      "Date published: 2023-10-04\n",
      "\n",
      "10. [AutoGen Tutorial 🚀 Create Custom AI Agents EASILY (Incredible)](https://www.youtube.com/watch?v=vU2S6dVf79M)\n",
      "In this video, I show you how to use AutoGen, which allows anyone to use multi-agent LLMs to power their applications. First, I give an overview of what AutoGen is, and then I show you how to use it with two examples. Currently, AutoGen works with OpenAI's API, but they are already working on adding local models natively, and you can already do ...\n",
      "Date published: 2023-10-03\n",
      "\n",
      "11. [Microsoft Autogen Studio 2 - How to run an army of agents](https://www.youtube.com/watch?v=lRu_-yFY-4M)\n",
      "In this video, we’ll explore how to use and leverage Autogen Studio 2 by creating two agents: one to extract YouTube comments and another to transform those insights into fresh video content ideas. 🔧 Installation is a breeze with just two commands. 👁️‍🗨️ The 'Build' tab's intuitive interface to use different LLMs 🧠 'Skills ...\n",
      "Date published: 2024-02-02\n",
      "\n",
      "12. [AutoGen Studio 2.0 Advanced Tutorial | Build multi-agent GenAI Application!!](https://www.youtube.com/watch?v=MUhRP8QCb9A)\n",
      "In this tutorial we will be covering AutoGen 2.0 from Microsoft which is an open-source library, offers a high-level abstraction for multi-agent conversation frameworks, facilitating next-generation LLM applications with collaborative, teachable, and personalized features to enhance productivity. In this tutorial we will be installing AutoGen ...\n",
      "Date published: 2024-02-02\n",
      "\n",
      "13. [AutoGen Tutorial: Create GODLY Custom AI Agents EASILY (Installation Tutorial)](https://www.youtube.com/watch?v=ijYDTDR4f8k)\n",
      "In this video, we delve into the revolutionary world of AutoGen, a sophisticated framework designed to simplify and streamline the management of workflows involving large language models (LLMs). These workflows are intricate, demanding, and require expertise to design, implement, and optimize effectively. As developers explore complex ...\n",
      "Date published: 2023-10-12\n",
      "\n",
      "14. [AutoGen Tutorial 🤖 Create Collaborating AI Agent teams](https://www.youtube.com/watch?v=0GyJ3FLHR1o)\n",
      "You can now use AutoGen to create multiple AI agents to work together to complete a task that you defined. Let's take a look at what Autogen is, and then I will show you how to quickly start using it. In this video, we will go through the examples of task solving with code generation, execution and debugging and setting up a group chat of more ...\n",
      "Date published: 2023-10-30\n",
      "\n",
      "15. [Autogen - Microsoft's best AI Agent framework that is controllable?](https://www.youtube.com/watch?v=Bq-0ClZttc8)\n",
      "Microsoft just announced a multi agent framework called Autogen, which solved a few problems of existing agent frameworks; Let’s dive in 🔗 Links - Follow me on twitter: https://twitter.com/jasonzhou1993 - Join my AI email list: https://www.ai-jason.com/ - My discord: https://discord.gg/eZXprSaCDE - Github repo & blog: https://ai-jason ...\n",
      "Date published: 2023-10-03\n",
      "\n",
      "16. [Microsoft AUTOGEN STUDIO 2.0 HUGE UPDATE - Create Custom AI Agents | Microsoft AI](https://www.youtube.com/watch?v=kj8nVBI_oiM)\n",
      "Learn everything about Microsoft’s revolutionary Autogen Studio 2.0 - an intuitive graphical interface enabling anyone to build coordinated AI solutions without coding! See how pre-built skills are visually combined into flexible teams handling complex goals through specialization and conversation. From travel planning to content creation ...\n",
      "Date published: 2024-01-17\n",
      "\n",
      "17. [Microsoft's Autogen 2 - Create Custom AI Agents](https://www.youtube.com/watch?v=_LGUXoNuwOo)\n",
      "💬 Access GPT-4 ,Claude-2 and more - chat.forefront.ai/?ref=theaigrid 🎤 Use the best AI Voice Creator - elevenlabs.io/?from=partnerscott3908 ️ Join Our Weekly Newsletter - https://mailchi.mp/6cff54ad7e2e/theaigrid 🐤 Follow us on Twitter https://twitter.com/TheAiGrid 🌐 Checkout Our website - https://theaigrid.com/ https://microsoft ...\n",
      "Date published: 2024-01-14\n",
      "\n",
      "18. [arXiv:2308.08155v2  cs.AI  3 Oct 2023](https://arxiv.org/pdf/2308.08155.pdf)\n",
      "AutoGen: Enabling Next-Gen LLM Applications via Multi-Agent Conversation Qingyun Wu †, Gagan Bansal ∗, Jieyu Zhang±, Yiran Wu , Beibin Li Erkang Zhu ∗, Li Jiang , Xiaoyun Zhang , Shaokun Zhang†, Jiale Liu∓ Ahmed Awadallah ∗, Ryen W. White , Doug Burger , Chi Wang∗1 ∗Microsoft Research, †Pennsylvania State University ±University of Washington,∓Xidian University\n",
      "\n",
      "19. [Releases · microsoft/autogen · GitHub](https://github.com/microsoft/autogen/releases)\n",
      "Notebook. New feature in code execution: Support user defined functions in local CLI executor - similar functionality to the \"skills\" in AutoGen Studio. New agent capability: Vision Capability for ConversableAgents allows them to \"see\" images. New IOStream protocol and support for web sockets!\n",
      "\n",
      "## Related Searches:\n",
      "- microsoft autogen download\n",
      "- microsoft autogen examples\n",
      "- autogenai website\n",
      "- is microsoft autogen free\n",
      "- autogen install\n",
      "- how to install microsoft autogen\n",
      "- autogen microsoft tutorial\n",
      "- autogen openai\n",
      "\n",
      "--------------------------------------------------------------------------------\n"
     ]
    }
   ],
   "source": [
    "task1 = \"\"\"\n",
    "Search the web for information about Microsoft AutoGen\n",
    "\"\"\"\n",
    "\n",
    "user_proxy.initiate_chat(web_surfer, message=task1);"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[33muser_proxy\u001b[0m (to web_surfer):\n",
      "\n",
      "Summarize these results\n",
      "\n",
      "--------------------------------------------------------------------------------\n",
      "\u001b[31m\n",
      ">>>>>>>> USING AUTO REPLY...\u001b[0m\n",
      "\u001b[35m\n",
      ">>>>>>>> EXECUTING FUNCTION summarize_page...\u001b[0m\n",
      "\u001b[33mweb_surfer\u001b[0m (to user_proxy):\n",
      "\n",
      "Microsoft AutoGen is a framework that enables the development of large language model (LLM) applications using multiple agents that can converse with each other to solve tasks. It allows for the creation of diverse teams of agents with specialized skills or goals, facilitating greater diversity in workflows. AutoGen agents are customizable, conversable, and seamlessly allow human participation. The framework supports various conversation patterns and offers a collection of working systems spanning a wide range of applications. AutoGen Studio is an interface powered by AutoGen that allows for the rapid prototyping of multi-agent solutions through a point and click, drag and drop interface. There are also tutorials and videos available to help users get started with AutoGen.\n",
      "\n",
      "--------------------------------------------------------------------------------\n"
     ]
    }
   ],
   "source": [
    "task2 = \"Summarize these results\"\n",
    "user_proxy.initiate_chat(web_surfer, message=task2, clear_history=False);"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[33muser_proxy\u001b[0m (to web_surfer):\n",
      "\n",
      "Click the 'Getting Started' result\n",
      "\n",
      "--------------------------------------------------------------------------------\n",
      "\u001b[31m\n",
      ">>>>>>>> USING AUTO REPLY...\u001b[0m\n",
      "\u001b[35m\n",
      ">>>>>>>> EXECUTING FUNCTION visit_page...\u001b[0m\n",
      "\u001b[33mweb_surfer\u001b[0m (to user_proxy):\n",
      "\n",
      "Address: https://microsoft.github.io/autogen/docs/Getting-Started/\n",
      "Title: Getting Started | AutoGen\n",
      "Viewport position: Showing page 1 of 1.\n",
      "=======================\n",
      "\n",
      "[Skip to main content](#__docusaurus_skipToContent_fallback)What's new in AutoGen? Read [this blog](/autogen/blog/2024/03/03/AutoGen-Update) for an overview of updates[![AutoGen](/autogen/img/ag.svg)![AutoGen](/autogen/img/ag.svg)**AutoGen**](/autogen/)Docs* [Getting Started](/autogen/docs/Getting-Started)\n",
      "* [Installation](/autogen/docs/installation/)\n",
      "* [Tutorial](/autogen/docs/tutorial/introduction)\n",
      "* [User Guide](/autogen/docs/topics)\n",
      "* [API Reference](/autogen/docs/reference/agentchat/conversable_agent)\n",
      "* [FAQs](/autogen/docs/FAQ)\n",
      "* [Ecosystem](/autogen/docs/ecosystem)\n",
      "* [Contribute](/autogen/docs/Contribute)\n",
      "* [Research](/autogen/docs/Research)\n",
      "Examples* [Examples by Category](/autogen/docs/Examples)\n",
      "* [Examples by Notebook](/autogen/docs/notebooks)\n",
      "* [Application Gallery](/autogen/docs/Gallery)\n",
      "Other Languages* [Dotnet](https://microsoft.github.io/autogen-for-net/)\n",
      "[Blog](/autogen/blog)[GitHub](https://github.com/microsoft/autogen)[Discord](https://aka.ms/autogen-dc)[Twitter](https://twitter.com/pyautogen)`ctrl``K`* [Getting Started](/autogen/docs/Getting-Started)\n",
      "* [Installation](/autogen/docs/installation/)\n",
      "* [Tutorial](/autogen/docs/tutorial)\n",
      "\t+ [Introduction](/autogen/docs/tutorial/introduction)\n",
      "\t+ [Chat Termination](/autogen/docs/tutorial/chat-termination)\n",
      "\t+ [Human in the Loop](/autogen/docs/tutorial/human-in-the-loop)\n",
      "\t+ [Code Executors](/autogen/docs/tutorial/code-executors)\n",
      "\t+ [Tool Use](/autogen/docs/tutorial/tool-use)\n",
      "\t+ [Conversation Patterns](/autogen/docs/tutorial/conversation-patterns)\n",
      "\t+ [What Next?](/autogen/docs/tutorial/what-next)\n",
      "* [Use Cases](/autogen/docs/Use-Cases/agent_chat)\n",
      "* [User Guide](/autogen/docs/topics)\n",
      "\t+ [Code Execution](/autogen/docs/topics/code-execution/cli-code-executor)\n",
      "\t+ [Using Non-OpenAI Models](/autogen/docs/topics/non-openai-models/about-using-nonopenai-models)\n",
      "\t+ [LLM Caching](/autogen/docs/topics/llm-caching)\n",
      "\t+ [LLM Configuration](/autogen/docs/topics/llm_configuration)\n",
      "\t+ [Prompting and Reasoning](/autogen/docs/topics/prompting-and-reasoning/react)\n",
      "\t+ [Retrieval Augmentation](/autogen/docs/topics/retrieval_augmentation)\n",
      "\t+ [Task Decomposition](/autogen/docs/topics/task_decomposition)\n",
      "* [API Reference](/autogen/docs/reference/agentchat/conversable_agent)\n",
      "* [FAQs](/autogen/docs/FAQ)\n",
      "* [Ecosystem](/autogen/docs/ecosystem)\n",
      "* [Contributing](/autogen/docs/Contribute)\n",
      "* [Research](/autogen/docs/Research)\n",
      "* [Migration Guide](/autogen/docs/Migration-Guide)\n",
      "*\n",
      "* Getting Started\n",
      "On this page\n",
      "# Getting Started\n",
      "\n",
      "AutoGen is a framework that enables development of LLM applications using\n",
      "multiple agents that can converse with each other to solve tasks. AutoGen agents\n",
      "are customizable, conversable, and seamlessly allow human participation. They\n",
      "can operate in various modes that employ combinations of LLMs, human inputs, and\n",
      "tools.\n",
      "\n",
      "![AutoGen Overview](/autogen/assets/images/autogen_agentchat-250ca64b77b87e70d34766a080bf6ba8.png)\n",
      "\n",
      "### Main Features[​](#main-features \"Direct link to Main Features\")\n",
      "\n",
      "* AutoGen enables building next-gen LLM applications based on [multi-agent\n",
      "conversations](/autogen/docs/Use-Cases/agent_chat) with minimal effort. It simplifies\n",
      "the orchestration, automation, and optimization of a complex LLM workflow. It\n",
      "maximizes the performance of LLM models and overcomes their weaknesses.\n",
      "* It supports [diverse conversation\n",
      "patterns](/autogen/docs/Use-Cases/agent_chat#supporting-diverse-conversation-patterns)\n",
      "for complex workflows. With customizable and conversable agents, developers can\n",
      "use AutoGen to build a wide range of conversation patterns concerning\n",
      "conversation autonomy, the number of agents, and agent conversation topology.\n",
      "* It provides a collection of working systems with different complexities. These\n",
      "systems span a [wide range of\n",
      "applications](/autogen/docs/Use-Cases/agent_chat#diverse-applications-implemented-with-autogen)\n",
      "from various domains and complexities. This demonstrates how AutoGen can\n",
      "easily support diverse conversation patterns.\n",
      "\n",
      "AutoGen is powered by collaborative [research studies](/autogen/docs/Research) from\n",
      "Microsoft, Penn State University, and University of Washington.\n",
      "\n",
      "### Quickstart[​](#quickstart \"Direct link to Quickstart\")\n",
      "\n",
      "```\n",
      "pip install pyautogen\n",
      "\n",
      "```\n",
      "\n",
      "* No code execution\n",
      "* Local execution\n",
      "* Docker execution\n",
      "\n",
      "```\n",
      "from autogen import AssistantAgent, UserProxyAgent\n",
      "\n",
      "llm_config = {\"model\": \"gpt-4\", \"api_key\": os.environ[\"OPENAI_API_KEY\"]}\n",
      "assistant = AssistantAgent(\"assistant\", llm_config=llm_config)\n",
      "user_proxy = UserProxyAgent(\"user_proxy\", code_execution_config=False)\n",
      "\n",
      "# Start the chat\n",
      "user_proxy.initiate_chat(\n",
      "    assistant,\n",
      "    message=\"Tell me a joke about NVDA and TESLA stock prices.\",\n",
      ")\n",
      "\n",
      "```\n",
      "warningWhen asked, be sure to check the generated code before continuing to ensure it is safe to run.\n",
      "\n",
      "```\n",
      "import autogen\n",
      "from autogen import AssistantAgent, UserProxyAgent\n",
      "\n",
      "llm_config = {\"model\": \"gpt-4\", \"api_key\": os.environ[\"OPENAI_API_KEY\"]}\n",
      "assistant = AssistantAgent(\"assistant\", llm_config=llm_config)\n",
      "\n",
      "user_proxy = UserProxyAgent(\n",
      "    \"user_proxy\", code_execution_config={\"executor\": autogen.coding.LocalCommandLineCodeExecutor(work_dir=\"coding\")}\n",
      ")\n",
      "\n",
      "# Start the chat\n",
      "user_proxy.initiate_chat(\n",
      "    assistant,\n",
      "    message=\"Plot a chart of NVDA and TESLA stock price change YTD.\",\n",
      ")\n",
      "\n",
      "```\n",
      "\n",
      "```\n",
      "import autogen\n",
      "from autogen import AssistantAgent, UserProxyAgent\n",
      "\n",
      "llm_config = {\"model\": \"gpt-4\", \"api_key\": os.environ[\"OPENAI_API_KEY\"]}\n",
      "\n",
      "with autogen.coding.DockerCommandLineCodeExecutor(work_dir=\"coding\") as code_executor:\n",
      "    assistant = AssistantAgent(\"assistant\", llm_config=llm_config)\n",
      "    user_proxy = UserProxyAgent(\n",
      "        \"user_proxy\", code_execution_config={\"executor\": code_executor}\n",
      "    )\n",
      "\n",
      "    # Start the chat\n",
      "    user_proxy.initiate_chat(\n",
      "        assistant,\n",
      "        message=\"Plot a chart of NVDA and TESLA stock price change YTD. Save the plot to a file called plot.png\",\n",
      "    )\n",
      "\n",
      "```\n",
      "Open `coding/plot.png` to see the generated plot.\n",
      "\n",
      "tipLearn more about configuring LLMs for agents [here](/autogen/docs/topics/llm_configuration).\n",
      "\n",
      "#### Multi-Agent Conversation Framework[​](#multi-agent-conversation-framework \"Direct link to Multi-Agent Conversation Framework\")\n",
      "\n",
      "Autogen enables the next-gen LLM applications with a generic multi-agent conversation framework. It offers customizable and conversable agents which integrate LLMs, tools, and humans.\n",
      "By automating chat among multiple capable agents, one can easily make them collectively perform tasks autonomously or with human feedback, including tasks that require using tools via code. For [example](https://github.com/microsoft/autogen/blob/0.2/test/twoagent.py),\n",
      "\n",
      "The figure below shows an example conversation flow with AutoGen.\n",
      "\n",
      "![Agent Chat Example](/autogen/assets/images/chat_example-da70a7420ebc817ef9826fa4b1e80951.png)\n",
      "\n",
      "### Where to Go Next?[​](#where-to-go-next \"Direct link to Where to Go Next?\")\n",
      "\n",
      "* Go through the [tutorial](/autogen/docs/tutorial/introduction) to learn more about the core concepts in AutoGen\n",
      "* Read the examples and guides in the [notebooks section](/autogen/docs/notebooks)\n",
      "* Understand the use cases for [multi-agent conversation](/autogen/docs/Use-Cases/agent_chat) and [enhanced LLM inference](/autogen/docs/Use-Cases/enhanced_inference)\n",
      "* Read the [API](/autogen/docs/reference/agentchat/conversable_agent/) docs\n",
      "* Learn about [research](/autogen/docs/Research) around AutoGen\n",
      "* Chat on [Discord](https://aka.ms/autogen-dc)\n",
      "* Follow on [Twitter](https://twitter.com/pyautogen)\n",
      "* See our [roadmaps](https://aka.ms/autogen-roadmap)\n",
      "\n",
      "If you like our project, please give it a [star](https://github.com/microsoft/autogen/stargazers) on GitHub. If you are interested in contributing, please read [Contributor's Guide](/autogen/docs/Contribute).\n",
      "\n",
      "[Edit this page](https://github.com/microsoft/autogen/edit/main/website/docs/Getting-Started.mdx)[NextInstallation](/autogen/docs/installation/)* [Main Features](#main-features)\n",
      "* [Quickstart](#quickstart)\n",
      "* [Where to Go Next?](#where-to-go-next)\n",
      "Community* [Discord](https://aka.ms/autogen-dc)\n",
      "* [Twitter](https://twitter.com/pyautogen)\n",
      "Copyright © 2024 AutoGen Authors | [Privacy and Cookies](https://go.microsoft.com/fwlink/?LinkId=521839)\n",
      "\n",
      "\n",
      "--------------------------------------------------------------------------------\n"
     ]
    }
   ],
   "source": [
    "task3 = \"Click the 'Getting Started' result\"\n",
    "user_proxy.initiate_chat(web_surfer, message=task3, clear_history=False);"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Example 2: Navigational search, scroll, answer questions\n",
    "- Search for Microsoft's wikipedia page, then naviagate to it\n",
    "- Scroll down\n",
    "- Answer questions about the content"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[33muser_proxy\u001b[0m (to web_surfer):\n",
      "\n",
      "Find Microsoft's Wikipedia page.\n",
      "\n",
      "--------------------------------------------------------------------------------\n",
      "\u001b[31m\n",
      ">>>>>>>> USING AUTO REPLY...\u001b[0m\n",
      "\u001b[35m\n",
      ">>>>>>>> EXECUTING FUNCTION navigational_web_search...\u001b[0m\n",
      "\u001b[33mweb_surfer\u001b[0m (to user_proxy):\n",
      "\n",
      "Address: https://en.wikipedia.org/wiki/Microsoft\n",
      "Title: Microsoft\n",
      "Viewport position: Showing page 1 of 34.\n",
      "=======================\n",
      "# Microsoft\n",
      "\n",
      "American multinational technology corporation\n",
      "\n",
      "Microsoft Corporation\n",
      "| [A square divided into four sub-squares, colored red-orange, green, yellow and blue (clockwise), with the company name appearing to its right](/wiki/File%3AMicrosoft_logo_%282012%29.svg) | |\n",
      "| --- | --- |\n",
      "| Aerial view of the [Microsoft Redmond campus](/wiki/Microsoft_Redmond_campus \"Microsoft Redmond campus\") | |\n",
      "| Company type | [Public](/wiki/Public_company \"Public company\") |\n",
      "| [Traded as](/wiki/Ticker_symbol \"Ticker symbol\") | * [Nasdaq](/wiki/Nasdaq \"Nasdaq\"): [MSFT](https://www.nasdaq.com/market-activity/stocks/msft) * [Nasdaq-100](/wiki/Nasdaq-100 \"Nasdaq-100\") component * [DJIA](/wiki/Dow_Jones_Industrial_Average \"Dow Jones Industrial Average\") component * [S&P 100](/wiki/S%26P_100 \"S&P 100\") component * [S&P 500](/wiki/S%26P_500 \"S&P 500\") component |\n",
      "| [ISIN](/wiki/International_Securities_Identification_Number \"International Securities Identification Number\") | [US5949181045](https://isin.toolforge.org/?language=en&isin=US5949181045) |\n",
      "| Industry | [Information technology](/wiki/Information_technology \"Information technology\") |\n",
      "| Founded | April 4, 1975; 48 years ago (1975-04-04) in [Albuquerque, New Mexico](/wiki/Albuquerque%2C_New_Mexico \"Albuquerque, New Mexico\"), U.S. |\n",
      "| Founders | * [Bill Gates](/wiki/Bill_Gates \"Bill Gates\") * [Paul Allen](/wiki/Paul_Allen \"Paul Allen\") |\n",
      "| Headquarters | [One Microsoft Way](/wiki/One_Microsoft_Way \"One Microsoft Way\"), [Redmond, Washington](/wiki/Redmond%2C_Washington \"Redmond, Washington\"), U.S. |\n",
      "| Area served | Worldwide |\n",
      "| Key people | * [Satya Nadella](/wiki/Satya_Nadella \"Satya Nadella\")([Chairman](/wiki/Chairman \"Chairman\") & [CEO](/wiki/Chief_executive_officer \"Chief executive officer\")) * [Brad Smith](/wiki/Brad_Smith_%28American_lawyer%29 \"Brad Smith (American lawyer)\")([Vice Chairman](/wiki/Vice-Chairman \"Vice-Chairman\") & [President](/wiki/President_%28corporate_title%29 \"President (corporate title)\")) * Bill Gates([technical adviser](/wiki/Adviser \"Adviser\")) |\n",
      "| Products | * [Software development](/wiki/Software_development \"Software development\") * [Computer hardware](/wiki/Computer_hardware \"Computer hardware\") * [Consumer electronics](/wiki/Consumer_electronics \"Consumer electronics\") * [Social networking service](/wiki/Social_networking_service \"Social networking service\") * [Cloud computing](/wiki/Cloud_computing \"Cloud computing\") * [Video games](/wiki/Video_game_industry \"Video game industry\") * [Internet](/wiki/Internet \"Internet\") * [Corporate venture capital](/wiki/Corporate_venture_capital \"Corporate venture capital\") |\n",
      "| Brands | * [Windows](/wiki/Microsoft_Windows \"Microsoft Windows\") * [Microsoft 365](/wiki/Microsoft_365 \"Microsoft 365\") * [Skype](/wiki/Skype \"Skype\") * [Visual Studio](/wiki/Visual_Studio \"Visual Studio\") * [Xbox](/wiki/Xbox \"Xbox\") * [Dynamics](/wiki/Microsoft_Dynamics_365 \"Microsoft Dynamics 365\") * [Surface](/wiki/Microsoft_Surface \"Microsoft Surface\") |\n",
      "| Services | * [Edge](/wiki/Microsoft_Edge \"Microsoft Edge\") * [Azure](/wiki/Microsoft_Azure \"Microsoft Azure\") * [Bing](/wiki/Microsoft_Bing \"Microsoft Bing\") * [LinkedIn](/wiki/LinkedIn \"LinkedIn\") * [Yammer](/wiki/Yammer \"Yammer\") * [Microsoft 365](/wiki/Microsoft_365 \"Microsoft 365\") * [OneDrive](/wiki/OneDrive \"OneDrive\") * [Outlook](/wiki/Microsoft_Outlook \"Microsoft Outlook\") * [GitHub](/wiki/GitHub \"GitHub\") * [Microsoft Store](/wiki/Microsoft_Store_%28digital%29 \"Microsoft Store (digital)\") * [Windows Update](/wiki/Windows_Update \"Windows Update\") * [Xbox Game Pass](/wiki/Xbox_Game_Pass \"Xbox Game Pass\") * [Xbox network](/wiki/Xbox_network \"Xbox network\") |\n",
      "| Revenue | Increase [US$](/wiki/United_States_dollar \"United States dollar\")211.9 billion (2023) |\n",
      "| [Operating income](/wiki/Earnings_before_interest_and_taxes \"Earnings before interest and taxes\") | Increase US$88.5 billion (2023) |\n",
      "| [Net income](/wiki/Net_income \"Net income\") | Increase US$73.4 billion (2023) |\n",
      "| [Total assets](/wiki/Asset \"Asset\") | Increase US$411.9 billion (2023) |\n",
      "| [Total equity](/wiki/Equity_%28finance%29 \"Equity (finance)\") | Increase US$206.2 billion (2023) |\n",
      "| Number of employees | 221,000 (2023) |\n",
      "| [Divisions](/wiki/Division_%28business%29 \"Division (business)\") | * [Microsoft Engineering Groups](/wiki/Microsoft_engineering_groups \"Microsoft engineering groups\") * [Microsoft Digital Crimes Unit](/wiki/Microsoft_Digital_Crimes_Unit \"Microsoft Digital Crimes Unit\") * [Microsoft Press](/wiki/Microsoft_Press \"Microsoft Press\") * [Microsoft Gaming](/wiki/Microsoft_Gaming \"Microsoft Gaming\") * Microsoft AI |\n",
      "| [Subsidiaries](/wiki/Subsidiary \"Subsidiary\") | * [Microsoft Japan](/wiki/Microsoft_Japan \"Microsoft Japan\") * [Microsoft India](/wiki/Microsoft_India \"Microsoft India\") * [Microsoft Egypt](/wiki/Microsoft_Egypt \"Microsoft Egypt\") * [GitHub](/wiki/GitHub \"GitHub\") * [LinkedIn](/wiki/LinkedIn \"LinkedIn\") * [Metaswitch](/wiki/Metaswitch \"Metaswitch\") * [Nuance Communications](/wiki/Nuance_Communications \"Nuance Communications\") * [RiskIQ](/wiki/RiskIQ \"RiskIQ\") * [Skype Technologies](/wiki/Skype_Technologies \"Skype Technologies\") * [Xamarin](/wiki/Xamarin \"Xamarin\") * [Xandr](/wiki/Xandr \"Xandr\") |\n",
      "|  | |\n",
      "| [ASN](/wiki/Autonomous_System_Number \"Autonomous System Number\") | * [8075](https://bgp.tools/as/8075) |\n",
      "|  | |\n",
      "| Website | [microsoft.com](https://www.microsoft.com/) |\n",
      "| **Footnotes / references**Financials as of June 30, 2023[[update]](https://en.wikipedia.org/w/index.php?title=Microsoft&action=edit)[[1]](#cite_note-1) | |\n",
      "\n",
      "| | [Bill Gates in 2023](/wiki/File%3ABill_Gates_2017_%28cropped%29.jpg) | This article is part of a series about [Bill Gates](/wiki/Bill_Gates \"Bill Gates\") | | --- | --- | |\n",
      "| --- | --- | --- |\n",
      "| * [Awards and honors](/wiki/Bill_Gates#Recognition \"Bill Gates\") * [Philanthropy](/wiki/Bill_Gates#Philanthropy \"Bill Gates\") * [Political positions](/wiki/Bill_Gates#Political_positions \"Bill Gates\") * [Public image](/wiki/Bill_Gates#Public_image \"Bill Gates\") * [Residence](/wiki/Bill_Gates%27s_house \"Bill Gates's house\")    ---   Companies* [Traf-O-Data](/wiki/Traf-O-Data \"Traf-O-Data\") * Microsoft ([criticism](/wiki/Criticism_of_Microsoft \"Criticism of Microsoft\")) * [BEN](/wiki/Branded_Entertainment_Network \"Branded Entertainment Network\") * [Cascade Investment](/wiki/Cascade_Investment \"Cascade Investment\") * [TerraPower](/wiki/TerraPower \"TerraPower\") * [Gates Ventures](/wiki/Gates_Ventures \"Gates Ventures\")    ---   Charitable organizations* [Bill & Melinda Gates Foundation](/wiki/Bill_%26_Melinda_Gates_Foundation \"Bill & Melinda Gates Foundation\") * [Match for Africa](/wiki/Match_for_Africa \"Match for Africa\") * [The Giving Pledge](/wiki/The_Giving_Pledge \"The Giving Pledge\") * [OER Project](/wiki/OER_Project \"OER Project\") * [Breakthrough Energy](/wiki/Breakthrough_Energy \"Breakthrough Energy\") * [Mission Innovation](/wiki/Mission_Innovation \"Mission Innovation\")    ---   Writings* \"[An Open Letter to Hobbyists](/wiki/An_Open_Letter_to_Hobbyists \"An Open Letter to Hobbyists\")\" * *[The Road Ahead](/wiki/The_Road_Ahead_%28Gates_book%29 \"The Road Ahead (Gates book)\")* * *[Business @ the Speed of Thought](/wiki/Business_%40_the_Speed_of_Thought \"Business @ the Speed of Thought\")* * *[How to Avoid a Climate Disaster](/wiki/How_to_Avoid_a_Climate_Disaster \"How to Avoid a Climate Disaster\")* * *[How to Prevent the Next Pandemic](/wiki/How_to_Prevent_the_Next_Pandemic \"How to Prevent the Next Pandemic\")*    ---   Related* [Bill Gates' flower fly](/wiki/Bill_Gates%27_flower_fly \"Bill Gates' flower fly\") * [Codex Leicester](/wiki/Codex_Leicester \"Codex Leicester\") * *[Lost on the Grand Banks](/wiki/Lost_on_the_Grand_Banks \"Lost on the Grand Banks\")* * [History of Microsoft](/wiki/History_of_Microsoft \"History of Microsoft\") * [Timeline of Microsoft](/wiki/Timeline_of_Microsoft \"Timeline of Microsoft\") * [Paul Allen](/wiki/Paul_Allen \"Paul Allen\")    --- |\n",
      "| * [v](/wiki/Template%3ABill_Gates_series \"Template:Bill Gates series\") * [t](/wiki/Template_talk%3ABill_Gates_series \"Template talk:Bill Gates series\") * [e](/wiki/Special%3AEditPage/Template%3ABill_Gates_series \"Special:EditPage/Template:Bill \n",
      "\n",
      "--------------------------------------------------------------------------------\n"
     ]
    }
   ],
   "source": [
    "task4 = \"\"\"Find Microsoft's Wikipedia page.\"\"\"\n",
    "user_proxy.initiate_chat(web_surfer, message=task4, clear_history=False);"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[33muser_proxy\u001b[0m (to web_surfer):\n",
      "\n",
      "Scroll down.\n",
      "\n",
      "--------------------------------------------------------------------------------\n",
      "\u001b[31m\n",
      ">>>>>>>> USING AUTO REPLY...\u001b[0m\n",
      "\u001b[35m\n",
      ">>>>>>>> EXECUTING FUNCTION page_down...\u001b[0m\n",
      "\u001b[33mweb_surfer\u001b[0m (to user_proxy):\n",
      "\n",
      "Address: https://en.wikipedia.org/wiki/Microsoft\n",
      "Title: Microsoft\n",
      "Viewport position: Showing page 2 of 34.\n",
      "=======================\n",
      "Gates series\") |\n",
      "\n",
      "**Microsoft Corporation** is an American [multinational corporation](/wiki/Multinational_corporation \"Multinational corporation\") and [technology company](/wiki/Technology_company \"Technology company\") headquartered in [Redmond, Washington](/wiki/Redmond%2C_Washington \"Redmond, Washington\").[[2]](#cite_note-2) Microsoft's best-known [software products](/wiki/List_of_Microsoft_software \"List of Microsoft software\") are the [Windows](/wiki/Microsoft_Windows \"Microsoft Windows\") line of [operating systems](/wiki/List_of_Microsoft_operating_systems \"List of Microsoft operating systems\"), the [Microsoft 365](/wiki/Microsoft_365 \"Microsoft 365\") suite of productivity applications, and the [Edge](/wiki/Microsoft_Edge \"Microsoft Edge\") web browser. Its flagship [hardware products](/wiki/List_of_Microsoft_hardware \"List of Microsoft hardware\") are the [Xbox](/wiki/Xbox \"Xbox\") video game consoles and the [Microsoft Surface](/wiki/Microsoft_Surface \"Microsoft Surface\") lineup of [touchscreen](/wiki/Touchscreen \"Touchscreen\") personal computers. Microsoft ranked No. 14 in the 2022 [Fortune 500](/wiki/Fortune_500 \"Fortune 500\") rankings of the largest United States corporations by total revenue;[[3]](#cite_note-3) and it was the world's [largest software maker](/wiki/List_of_the_largest_software_companies \"List of the largest software companies\") by revenue in 2022 according to [Forbes Global 2000](/wiki/Forbes_Global_2000 \"Forbes Global 2000\"). It is considered one of the [Big Five](/wiki/Big_Tech \"Big Tech\") American [information technology](/wiki/Information_technology \"Information technology\") companies, alongside [Alphabet](/wiki/Alphabet_Inc. \"Alphabet Inc.\") (parent company of [Google](/wiki/Google \"Google\")), [Amazon](/wiki/Amazon_%28company%29 \"Amazon (company)\"), [Apple](/wiki/Apple_Inc. \"Apple Inc.\"), and [Meta](/wiki/Meta_Platforms \"Meta Platforms\") (parent company of [Facebook](/wiki/Facebook \"Facebook\")).\n",
      "\n",
      "Microsoft was founded by [Bill Gates](/wiki/Bill_Gates \"Bill Gates\") and [Paul Allen](/wiki/Paul_Allen \"Paul Allen\") on April 4, 1975, to develop and sell [BASIC interpreters](/wiki/BASIC_interpreter \"BASIC interpreter\") for the [Altair 8800](/wiki/Altair_8800 \"Altair 8800\"). It rose to dominate the personal computer operating system market with [MS-DOS](/wiki/MS-DOS \"MS-DOS\") in the mid-1980s, followed by Windows. The company's 1986 [initial public offering](/wiki/Initial_public_offering \"Initial public offering\") (IPO) and subsequent rise in its share price created three billionaires and an estimated 12,000 millionaires among Microsoft employees. Since the 1990s, it has increasingly diversified from the operating system market and has made several [corporate acquisitions](/wiki/List_of_mergers_and_acquisitions_by_Microsoft \"List of mergers and acquisitions by Microsoft\"), the largest being the [acquisition](/wiki/Acquisition_of_Activision_Blizzard_by_Microsoft \"Acquisition of Activision Blizzard by Microsoft\") of [Activision Blizzard](/wiki/Activision_Blizzard \"Activision Blizzard\") for $68.7 billion in October 2023,[[4]](#cite_note-4) followed by its acquisition of [LinkedIn](/wiki/LinkedIn \"LinkedIn\") for $26.2 billion in December 2016,[[5]](#cite_note-5) and its acquisition of [Skype Technologies](/wiki/Skype_Technologies \"Skype Technologies\") for $8.5 billion in May 2011.[[6]](#cite_note-6)\n",
      "\n",
      "As of 2015[[update]](https://en.wikipedia.org/w/index.php?title=Microsoft&action=edit), Microsoft is market-dominant in the [IBM PC compatible](/wiki/IBM_PC_compatible \"IBM PC compatible\") operating system market and the office software suite market, although it has lost the majority of the overall operating system market to [Android](/wiki/Android_%28operating_system%29 \"Android (operating system)\").[[7]](#cite_note-7) The company also produces a wide range of other consumer and enterprise software for desktops, laptops, tabs, gadgets, and servers, including [Internet search](/wiki/Web_search_engine \"Web search engine\") (with [Bing](/wiki/Microsoft_Bing \"Microsoft Bing\")), the digital services market (through [MSN](/wiki/MSN \"MSN\")), [mixed reality](/wiki/Mixed_reality \"Mixed reality\") ([HoloLens](/wiki/Microsoft_HoloLens \"Microsoft HoloLens\")), cloud computing ([Azure](/wiki/Microsoft_Azure \"Microsoft Azure\")), and software development ([Visual Studio](/wiki/Microsoft_Visual_Studio \"Microsoft Visual Studio\")).\n",
      "\n",
      "[Steve Ballmer](/wiki/Steve_Ballmer \"Steve Ballmer\") replaced Gates as CEO in 2000 and later envisioned a \"devices and services\" strategy.[[8]](#cite_note-8) This unfolded with Microsoft acquiring [Danger Inc.](/wiki/Danger_Inc. \"Danger Inc.\") in 2008,[[9]](#cite_note-9) entering the personal computer production market for the first time in June 2012 with the launch of the Microsoft Surface line of [tablet computers](/wiki/Tablet_computer \"Tablet computer\"), and later forming [Microsoft Mobile](/wiki/Microsoft_Mobile \"Microsoft Mobile\") through the acquisition of [Nokia](/wiki/Nokia \"Nokia\")'s devices and services division. Since [Satya Nadella](/wiki/Satya_Nadella \"Satya Nadella\") took over as CEO in 2014, the company has scaled back on hardware and instead focused on [cloud computing](/wiki/Cloud_computing \"Cloud computing\"), a move that helped the company's [shares](/wiki/Share_%28finance%29 \"Share (finance)\") reach their highest value since December 1999.[[10]](#cite_note-10)[[11]](#cite_note-11) Under Nadella's direction, the company has also heavily expanded its gaming business to support the Xbox brand, establishing the [Microsoft Gaming](/wiki/Microsoft_Gaming \"Microsoft Gaming\") division in 2022, dedicated to operating Xbox in addition to its three subsidiaries ([publishers](/wiki/Video_game_publisher \"Video game publisher\")). Microsoft Gaming is the third-largest gaming company in the world by revenue as of 2023.[[12]](#cite_note-12)\n",
      "\n",
      "Earlier dethroned by Apple in 2010, and in 2018, Microsoft reclaimed[*[when?](/wiki/Wikipedia%3AManual_of_Style/Dates_and_numbers#Chronological_items \"Wikipedia:Manual of Style/Dates and numbers\")*] its position as the most valuable publicly traded company in the world.[[13]](#cite_note-13) In April 2019, Microsoft reached a trillion-dollar [market cap](/wiki/Market_capitalization \"Market capitalization\"), becoming the third U.S. public company to be [valued at over $1 trillion](/wiki/Trillion-dollar_company \"Trillion-dollar company\") after Apple and Amazon, respectively. As of 2023[[update]](https://en.wikipedia.org/w/index.php?title=Microsoft&action=edit), Microsoft has the [third-highest](/wiki/List_of_most_valuable_brands \"List of most valuable brands\") global [brand valuation](/wiki/Brand_valuation \"Brand valuation\").\n",
      "\n",
      "Microsoft [has been criticized](/wiki/Criticism_of_Microsoft \"Criticism of Microsoft\") for its monopolistic practices and the company's software has been criticized for problems with [ease of use](/wiki/Ease_of_use \"Ease of use\"), [robustness](/wiki/Robustness_%28computer_science%29 \"Robustness (computer science)\"), and [security](/wiki/Computer_security \"Computer security\").\n",
      "\n",
      "## History\n",
      "\n",
      "Main article: [History of Microsoft](/wiki/History_of_Microsoft \"History of Microsoft\")\n",
      "For a chronological guide, see [Timeline of Microsoft](/wiki/Timeline_of_Microsoft \"Timeline of Microsoft\").\n",
      "\n",
      "### 1972–1985: Founding\n",
      "\n",
      "[![](//upload.wikimedia.org/wikipedia/commons/thumb/d/d7/Altair_8800_and_Model_33_ASR_Teletype_.jpg/256px-Altair_8800_and_Model_33_ASR_Teletype_.jpg)](/wiki/File%3AAltair_8800_and_Model_33_ASR_Teletype_.jpg)\n",
      "\n",
      "An Altair 8800 computer (left) with the popular Model 33 ASR Teletype as terminal, paper tape reader, and paper tape punch\n",
      "\n",
      "[![](//upload.wikimedia.org/wikipedia/en/thumb/4/4f/1981BillPaul.jpg/220px-1981BillPaul.jpg)](/wiki/File%3A1981BillPaul.jpg)\n",
      "\n",
      "[Paul Allen](/wiki/Paul_Allen \"Paul Allen\") and [Bill Gates](/wiki/Bill_Gates \"Bill Gates\") on October 19, 1981, after signing a pivotal contract with [IBM](/wiki/IBM \"IBM\")[[14]](#cite_note-Allan_2001-14): 228\n",
      "\n",
      "[![](//upload.wikimedia.org/wikipedia/commons/thumb/f/f1/Bill_Gates_and_Paul_Allen_Business_Cards.jpg/220px-Bill_Gates_and_Paul_Allen_Business_Cards.jpg)](/wiki/File%3ABill_Gates_and_Paul_Allen_Business_Cards.jpg)\n",
      "\n",
      "\n",
      "--------------------------------------------------------------------------------\n"
     ]
    }
   ],
   "source": [
    "task5 = \"\"\"Scroll down.\"\"\"\n",
    "user_proxy.initiate_chat(web_surfer, message=task5, clear_history=False);"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[33muser_proxy\u001b[0m (to web_surfer):\n",
      "\n",
      "Read the page and answer: Where was the first office location, and when did they move to Redmond?\n",
      "\n",
      "--------------------------------------------------------------------------------\n",
      "\u001b[31m\n",
      ">>>>>>>> USING AUTO REPLY...\u001b[0m\n",
      "\u001b[35m\n",
      ">>>>>>>> EXECUTING FUNCTION read_page_and_answer...\u001b[0m\n",
      "\u001b[33mweb_surfer\u001b[0m (to user_proxy):\n",
      "\n",
      "Microsoft Corporation, an American multinational technology company, was founded on April 4, 1975, in Albuquerque, New Mexico, by Bill Gates and Paul Allen. The company's first office location was in Albuquerque, but they later moved their headquarters to Redmond, Washington. The move to Redmond occurred in January 1979. Since then, Microsoft has become a major player in the technology industry, developing and selling software products such as the Windows operating system, Microsoft Office suite, and Xbox video game consoles. They have also expanded into cloud computing with Microsoft Azure and have made acquisitions such as Nokia's mobile unit and LinkedIn.\n",
      "\n",
      "--------------------------------------------------------------------------------\n"
     ]
    }
   ],
   "source": [
    "task6 = \"\"\"Read the page and answer: Where was the first office location, and when did they move to Redmond?\"\"\"\n",
    "user_proxy.initiate_chat(web_surfer, message=task6, clear_history=False);"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
