{"id":20632,"date":"2024-11-19T12:28:06","date_gmt":"2024-11-19T20:28:06","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/powershell\/?p=20632"},"modified":"2024-12-04T08:55:49","modified_gmt":"2024-12-04T16:55:49","slug":"announcing-the-public-preview-of-ai-shell","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/powershell\/announcing-the-public-preview-of-ai-shell\/","title":{"rendered":"Announcing the Public Preview of AI Shell"},"content":{"rendered":"<p><!-- markdownlint-disable MD041 --><\/p>\n<p>We&#8217;re thrilled to unveil the public preview of <strong>AI Shell<\/strong>! AI Shell enhances your shell with AI\ncapabilities to facilitate your interactions with the command line. AI Shell create an interactive\nshell that can interact with various large language model and provides a framework that you can use\nto build a custom system that meet your needs. Users can interact with the AI agents in a\nconversational manner.<\/p>\n<p>The AI Shell project includes:<\/p>\n<ul>\n<li>The command-line shell (<code>aish<\/code>) interface<\/li>\n<li>A framework for creating AI agents and other assistance providers<\/li>\n<li>A PowerShell module for deeper integration with PowerShell.<\/li>\n<li>Built in AI agents to get you started assistance immediately<\/li>\n<\/ul>\n<p>Each AI assistant is known as an agent. The initial release of AI Shell includes two agents:<\/p>\n<ol>\n<li><strong>Azure OpenAI Agent<\/strong>: Powering general-purpose assistance, the <a href=\"https:\/\/azure.microsoft.com\/products\/ai-services\/openai-service\">Azure OpenAI<\/a> agent can\nuse any of the AI models provided by Azure open AI to handle broad queries, natural language\ninterpretations or code generation. You can connect it to your deployed Azure OpenAI models if\nyou are looking for more privacy, management of the model settings, or have a model trained with\nyour data. Additionally, you can also utilize OpenAI&#8217;s models.<\/li>\n<li><strong>Copilot in Azure<\/strong>: This agent brings the power of <a href=\"https:\/\/learn.microsoft.com\/azure\/copilot\/overview\">Copilot in Azure<\/a> directly to your CLI.\nIt specializes in delivering cloud-centric assistance, providing Azure CLI and Azure PowerShell\ncommands and helping you automate your Azure-specific tasks.To get started with the Copilot in Azure agent you need sign in to Azure with Azure CLI with an account that has the IAM role for accessing Copilot in Azure.<\/li>\n<\/ol>\n<p style=\"padding-left: 40px;\"><div class=\"alert alert-primary\"><p class=\"alert-divider\"><i class=\"fabric-icon fabric-icon--Info\"><\/i><strong>NOTE<\/strong><\/p>The Azure OpenAI agent needs additional configuration to connect to your Azure OpenAI instance. To get started, follow the instructions provided when you start start the agent.<\/div><\/p>\n<p>Recognizing that you may have different CLI command needs, AI Shell provides a framework for\ncreating your own agents. For more information, see <a href=\"https:\/\/learn.microsoft.com\/\/powershell\/utility-modules\/aishell\/developer\/create-ollama-agent\">Creating an Agent<\/a>.<\/p>\n<h2>Using and Installing AI Shell<\/h2>\n<p>We know every CLI user has their own preferences, so AI Shell offers two flexible modes to fit your\nworkflow:<\/p>\n<h3><strong>Standalone Executable<\/strong><\/h3>\n<p>You can use AI Shell as a self-contained executable, allowing it to run independently from any\nshell. This setup is perfect if you&#8217;re looking for a dedicated, streamlined experience that&#8217;s easily\naccessible without dependencies.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/powershell\/wp-content\/uploads\/sites\/30\/2024\/11\/standalone.gif\" alt=\"A GIF of the standalone experience\" \/><\/p>\n<h3>Side-by-Side Integration with PowerShell 7<\/h3>\n<p>This is the recommended method for using AI Shell because it enables an uninterrupted work flow. The\n<strong>AIShell<\/strong> module connects the <code>aish<\/code> tool to your PowerShell 7 session for deeply integrated user\nexperience. AI Shell opens in a side pane right next to your PowerShell 7 session that enables a\nrich communication between panes, results from the chat can be carried seamlessly to your PowerShell\nsession for easy execution and the AI agent can be used to provide assistance to resolve a\nPowerShell error.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/powershell\/wp-content\/uploads\/sites\/30\/2024\/11\/side-by-side-1.gif\"><img decoding=\"async\" class=\"alignnone size-full wp-image-20635\" src=\"https:\/\/devblogs.microsoft.com\/powershell\/wp-content\/uploads\/sites\/30\/2024\/11\/side-by-side-1.gif\" alt=\"A GIF of the side-by-side experience\" width=\"1199\" height=\"637\" \/><\/a><\/p>\n<h4>Installation and Getting Started<\/h4>\n<p>Some system requirements are needed to run AI Shell.<\/p>\n<p>AI Shell (<code>aish<\/code>) and the <strong>AIShell<\/strong> module are separate downloads. For your convenience, we\ncreated a script to download and install them for you.<\/p>\n<h5>Windows<\/h5>\n<p>Some prerequisites are needed to run AI Shell on Windows.<\/p>\n<ul>\n<li>Windows 10 or higher<\/li>\n<li>PowerShell 7.4.6 or higher<\/li>\n<li>Windows Terminal<\/li>\n<\/ul>\n<p>The following install script will:<\/p>\n<ul>\n<li>Installs <code>aish.exe<\/code> to <code>$env:LOCALAPPDATA\\Programs\\AIShell<\/code> and adds it to your PATH<\/li>\n<li>Installs the <strong>AIShell<\/strong> module to your module path location<\/li>\n<\/ul>\n<h5>MacOS<\/h5>\n<p>Some prerequisites are needed to run AI Shell on MacOS.<\/p>\n<ul>\n<li>macOS v13 Ventura or higher<\/li>\n<li>PowerShell 7.4.6 or higher<\/li>\n<li>\n<div>\n<div>iTerm2 terminal app<\/div>\n<\/div>\n<\/li>\n<\/ul>\n<p>On MacOS, this script:<\/p>\n<ul>\n<li>Installs the <code>aish<\/code> executable to <code>\/usr\/local\/AIShell<\/code> and creates a symbolic link at\n<code>\/usr\/local\/bin\/aish<\/code><\/li>\n<li>Due to some limitations, the <strong>AIShell<\/strong> module is not installed<\/li>\n<\/ul>\n<p><div class=\"alert alert-primary\"><p class=\"alert-divider\"><i class=\"fabric-icon fabric-icon--Info\"><\/i><strong>NOTE<\/strong><\/p>This script only works on Windows and Mac systems. Linux users need to follow the manual installation instructions.<\/div><\/p>\n<p>To install AI Shell, run the following command in your PowerShell session:<\/p>\n<pre><code class=\"language-powershell\">Invoke-Expression \"&amp; { $(Invoke-RestMethod 'https:\/\/aka.ms\/install-aishell.ps1') }\"<\/code><\/pre>\n<p>To find details on manual installation please see, <a href=\"https:\/\/learn.microsoft.com\/powershell\/utility-modules\/aishell\/install-aishell?view=ps-modules&amp;tabs=windows#install-ai-shell-1\">Installing AI Shell manually<\/a>.<\/p>\n<p>After running the install script, you can run <code>Start-AIShell<\/code> to begin using AI Shell.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/powershell\/wp-content\/uploads\/sites\/30\/2024\/11\/startup.gif\" alt=\"A GIF of the start up experience\" \/><\/p>\n<p>AI Shell starts in the side by side experience. You can switch between the agents by using the\n<code>@&lt;agent name&gt;<\/code> command. For example, to switch to the Azure OpenAI agent you would use the\n<code>@openai-gpt<\/code> command. Additionally you can do <code>@&lt;agent name&gt; &lt;question&gt;<\/code> to send a question to the\nagent immediately.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/powershell\/wp-content\/uploads\/sites\/30\/2024\/11\/SwitchAgents.gif\" alt=\"A GIF of the agent selection experience\" \/><\/p>\n<h3>Inserting code into the PowerShell 7 session<\/h3>\n<p>Copying and pasting a lot of code can be annoying. AI Shell makes it easy to insert the AI generated\ncode directly into your PowerShell 7 session with the <code>\/code post<\/code> command. In your AI Shell, run\n<code>\/code post<\/code> or use the <kbd>Ctrl<\/kbd>+<kbd>d<\/kbd>,<kbd>Ctrl<\/kbd>+<kbd>d<\/kbd> keyboard shortcut\nto copy the code into your PowerShell session.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/powershell\/wp-content\/uploads\/sites\/30\/2024\/11\/SwitchAgents.gif\" alt=\"A GIF of the code insertion experience\" \/><\/p>\n<p>If you are familiar with PowerShell 7 you may be familiar with <a href=\"https:\/\/devblogs.microsoft.com\/powershell\/announcing-psreadline-2-1-with-predictive-intellisense\/\">Predictive Intellisense<\/a>. When\nyou get multi-step commands in your AI Shell response, you can easily get each subsequent step in\nyour Predictive Intellisense buffer.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/powershell\/wp-content\/uploads\/sites\/30\/2024\/11\/predictiveintellisensedemo.gif\" alt=\"A GIF of the code insertion experience with predictive Intellisense\" \/><\/p>\n<h3>Resolving errors quicker<\/h3>\n<p>If you encounter an error in your working terminal, you can use the <code>Resolve-Error<\/code> cmdlet to send\nthat error to the open AI Shell window for resolution. This command asks the AI model to help you\nresolve the error.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/powershell\/wp-content\/uploads\/sites\/30\/2024\/11\/Resolve-error.gif\" alt=\"A GIF of the error resolution experience\" \/><\/p>\n<h3>Invoking AIShell from PowerShell 7<\/h3>\n<p>One key scenario we wanted to support is being able to pipe output of one command into the AI Shell\nto get more information or ask a follow up question on the data given. With the <code>Invoke-AIShell<\/code>\ncommand you can easily do this.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/powershell\/wp-content\/uploads\/sites\/30\/2024\/11\/Invoke-AIShell.gif\" alt=\"A GIF of the Invoke-AIShell experience\" \/><\/p>\n<p><code>Invoke-AIShell<\/code> can take input from the pipeline but also can just be used to call the AI agent\nselected in AI Shell without having to switch back and forth.<\/p>\n<h3>Some additional tips using AI Shell<\/h3>\n<p>There are other chat commands and hot-keys that make using AI Shell easier. For a full list\nof the chat commands, see the <a href=\"https:\/\/learn.microsoft.com\/powershell\/utility-modules\/aishell\/how-to\/aishell-reference\">AI Shell reference<\/a>.<\/p>\n<table>\n<thead>\n<tr>\n<th>Key bindings<\/th>\n<th>Command<\/th>\n<th>Functionality<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><kbd>Ctrl<\/kbd>+<kbd>d<\/kbd>, <kbd>Ctrl<\/kbd>+<kbd>c<\/kbd><\/td>\n<td><code>\/code copy<\/code><\/td>\n<td>Copy <em>all<\/em> the generated code snippets to clipboard<\/td>\n<\/tr>\n<tr>\n<td><kbd>Ctrl<\/kbd>+<kbd>&lt;n&gt;<\/kbd><\/td>\n<td><code>\/code copy &lt;n&gt;<\/code><\/td>\n<td>Copy the <em>n-th<\/em> generated code snippet to clipboard<\/td>\n<\/tr>\n<tr>\n<td><kbd>Ctrl<\/kbd>+<kbd>d<\/kbd>, <kbd>Ctrl<\/kbd>+<kbd>d<\/kbd><\/td>\n<td><code>\/code post<\/code><\/td>\n<td>Post <em>all<\/em> the generated code snippets to the connected application<\/td>\n<\/tr>\n<tr>\n<td><kbd>Ctrl<\/kbd>+<kbd>d<\/kbd>,<kbd>&lt;n&gt;<\/kbd><\/td>\n<td><code>\/code post &lt;n&gt;<\/code><\/td>\n<td>Post the <em>n-th<\/em> generated code snippet to the connected application<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Additionally, you can switch between the panes easier using the following keyboard shortcuts.<\/p>\n<table>\n<thead>\n<tr>\n<th>Key bindings<\/th>\n<th>Functionality<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><kbd>Alt<\/kbd>+<kbd>RightArrow<\/kbd><\/td>\n<td>Moves your cursor to the right AI Shell pane<\/td>\n<\/tr>\n<tr>\n<td><kbd>Alt<\/kbd>+<kbd>LeftArrow<\/kbd><\/td>\n<td>Moves your cursor to the left PowerShell pane<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Why Try AI Shell?<\/h2>\n<p>AI Shell was built for those who seek intelligence and adaptability from their command-line. With\nmulti-agent support, AI Shell aims to be the assistant for any CLI tool. You&#8217;ll benefit from\nadvanced AI capabilities, deeper integration with your PowerShell session, and an extensibility\nmodel to get the assistance you need.<\/p>\n<h2>Call to Action!<\/h2>\n<p>This public preview is just the beginning. We&#8217;d love to hear your feedback and insights as we refine\nAI Shell to better serve the CLI and PowerShell community. Download it today in PowerShell with<\/p>\n<p><code class=\"language-powershell\">Invoke-Expression \"&amp; { $(Invoke-RestMethod 'https:\/\/aka.ms\/install-aishell.ps1') }\"<\/code><\/p>\n<p>Be sure to explore the capabilities of the Copilot in Azure and Azure OpenAI agents, and take command-line productivity to\nthe next level! Feel free to give us feedback on the current tool and sign up for early access to\nfuture features at <a href=\"https:\/\/aka.ms\/AIShell-Feedback\">aka.ms\/AIShell-Feedback<\/a>.<\/p>\n<p>Thank you so much!<\/p>\n<p>Steven Bucher<\/p>\n<p>Product Manager on the PowerShell\/CLI Team<\/p>\n<p><!-- link reference --><\/p>\n","protected":false},"excerpt":{"rendered":"<p>We are pleased to announce the public preview of AI Shell.<\/p>\n","protected":false},"author":98569,"featured_media":20640,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[3196,3193,3195,3194,248],"class_list":["post-20632","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell","tag-ai","tag-ai-shell","tag-azure-openai","tag-copilot-in-azure","tag-powershell"],"acf":[],"blog_post_summary":"<p>We are pleased to announce the public preview of AI Shell.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/20632","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/users\/98569"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/comments?post=20632"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/20632\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media\/20640"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media?parent=20632"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/categories?post=20632"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/tags?post=20632"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}