November 19th, 2024
compellingheart13 reactions

Announcing the Public Preview of AI Shell

Steven Bucher
Product Manager

We’re thrilled to unveil the public preview ofAI Shell! AI Shell enhances your shell with AIcapabilities to facilitate your interactions with the command line. AI Shell create an interactiveshell that can interact with various large language model and provides a framework that you can useto build a custom system that meet your needs. Users can interact with the AI agents in aconversational manner.

The AI Shell project includes:

  • The command-line shell (aish) interface
  • A framework for creating AI agents and other assistance providers
  • A PowerShell module for deeper integration with PowerShell.
  • Built in AI agents to get you started assistance immediately

Each AI assistant is known as an agent. The initial release of AI Shell includes two agents:

  1. Azure OpenAI Agent: Powering general-purpose assistance, theAzure OpenAI agent canuse any of the AI models provided by Azure open AI to handle broad queries, natural languageinterpretations or code generation. You can connect it to your deployed Azure OpenAI models ifyou are looking for more privacy, management of the model settings, or have a model trained withyour data. Additionally, you can also utilize OpenAI’s models.
  2. Copilot in Azure: This agent brings the power ofCopilot in Azure directly to your CLI.It specializes in delivering cloud-centric assistance, providing Azure CLI and Azure PowerShellcommands 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.

NOTE

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.

Recognizing that you may have different CLI command needs, AI Shell provides a framework forcreating your own agents. For more information, seeCreating an Agent.

Using and Installing AI Shell

We know every CLI user has their own preferences, so AI Shell offers two flexible modes to fit yourworkflow:

Standalone Executable

You can use AI Shell as a self-contained executable, allowing it to run independently from anyshell. This setup is perfect if you’re looking for a dedicated, streamlined experience that’s easilyaccessible without dependencies.

A GIF of the standalone experience

Side-by-Side Integration with PowerShell 7

This is the recommended method for using AI Shell because it enables an uninterrupted work flow. TheAIShell module connects theaish tool to your PowerShell 7 session for deeply integrated userexperience. AI Shell opens in a side pane right next to your PowerShell 7 session that enables arich communication between panes, results from the chat can be carried seamlessly to your PowerShellsession for easy execution and the AI agent can be used to provide assistance to resolve aPowerShell error.

A GIF of the side-by-side experience

Installation and Getting Started

Some system requirements are needed to run AI Shell.

AI Shell (aish) and theAIShell module are separate downloads. For your convenience, wecreated a script to download and install them for you.

Windows

Some prerequisites are needed to run AI Shell on Windows.

  • Windows 10 or higher
  • PowerShell 7.4.6 or higher
  • Windows Terminal

The following install script will:

  • Installsaish.exe to$env:LOCALAPPDATA\Programs\AIShell and adds it to your PATH
  • Installs theAIShell module to your module path location
MacOS

Some prerequisites are needed to run AI Shell on MacOS.

  • macOS v13 Ventura or higher
  • PowerShell 7.4.6 or higher
  • iTerm2 terminal app

On MacOS, this script:

  • Installs theaish executable to/usr/local/AIShell and creates a symbolic link at/usr/local/bin/aish
  • Due to some limitations, theAIShell module is not installed

NOTE

This script only works on Windows and Mac systems. Linux users need to follow the manual installation instructions.

To install AI Shell, run the following command in your PowerShell session:

Invoke-Expression "& { $(Invoke-RestMethod 'https://aka.ms/install-aishell.ps1') }"

To find details on manual installation please see,Installing AI Shell manually.

After running the install script, you can runStart-AIShell to begin using AI Shell.

A GIF of the start up experience

AI Shell starts in the side by side experience. You can switch between the agents by using the@<agent name> command. For example, to switch to the Azure OpenAI agent you would use the@openai-gpt command. Additionally you can do@<agent name> <question> to send a question to theagent immediately.

A GIF of the agent selection experience

Inserting code into the PowerShell 7 session

Copying and pasting a lot of code can be annoying. AI Shell makes it easy to insert the AI generatedcode directly into your PowerShell 7 session with the/code post command. In your AI Shell, run/code post or use theCtrl+d,Ctrl+d keyboard shortcutto copy the code into your PowerShell session.

A GIF of the code insertion experience

If you are familiar with PowerShell 7 you may be familiar withPredictive Intellisense. Whenyou get multi-step commands in your AI Shell response, you can easily get each subsequent step inyour Predictive Intellisense buffer.

A GIF of the code insertion experience with predictive Intellisense

Resolving errors quicker

If you encounter an error in your working terminal, you can use theResolve-Error cmdlet to sendthat error to the open AI Shell window for resolution. This command asks the AI model to help youresolve the error.

A GIF of the error resolution experience

Invoking AIShell from PowerShell 7

One key scenario we wanted to support is being able to pipe output of one command into the AI Shellto get more information or ask a follow up question on the data given. With theInvoke-AIShellcommand you can easily do this.

A GIF of the Invoke-AIShell experience

Invoke-AIShell can take input from the pipeline but also can just be used to call the AI agentselected in AI Shell without having to switch back and forth.

Some additional tips using AI Shell

There are other chat commands and hot-keys that make using AI Shell easier. For a full listof the chat commands, see theAI Shell reference.

Key bindingsCommandFunctionality
Ctrl+d,Ctrl+c/code copyCopyall the generated code snippets to clipboard
Ctrl+<n>/code copy <n>Copy then-th generated code snippet to clipboard
Ctrl+d,Ctrl+d/code postPostall the generated code snippets to the connected application
Ctrl+d,<n>/code post <n>Post then-th generated code snippet to the connected application

Additionally, you can switch between the panes easier using the following keyboard shortcuts.

Key bindingsFunctionality
Alt+RightArrowMoves your cursor to the right AI Shell pane
Alt+LeftArrowMoves your cursor to the left PowerShell pane

Why Try AI Shell?

AI Shell was built for those who seek intelligence and adaptability from their command-line. Withmulti-agent support, AI Shell aims to be the assistant for any CLI tool. You’ll benefit fromadvanced AI capabilities, deeper integration with your PowerShell session, and an extensibilitymodel to get the assistance you need.

Call to Action!

This public preview is just the beginning. We’d love to hear your feedback and insights as we refineAI Shell to better serve the CLI and PowerShell community. Download it today in PowerShell with

Invoke-Expression "& { $(Invoke-RestMethod 'https://aka.ms/install-aishell.ps1') }"

Be sure to explore the capabilities of the Copilot in Azure and Azure OpenAI agents, and take command-line productivity tothe next level! Feel free to give us feedback on the current tool and sign up for early access tofuture features ataka.ms/AIShell-Feedback.

Thank you so much!

Steven Bucher

Product Manager on the PowerShell/CLI Team

Author

Steven Bucher
Product Manager

6 comments

Discussion is closed.Login to edit/delete existing comments.

Stay informed

Get notified when new posts are published.
Follow this blog
youtube