

# Getting started with Amazon Q Developer generative AI chat and command line tools


**Note**  
Powered by Amazon Bedrock: Amazon Q Developer is built on Amazon Bedrock and includes [automated abuse detection](https://docs.aws.amazon.com/bedrock/latest/userguide/abuse-detection.html) implemented in Amazon Bedrock to enforce safety, security, and the responsible use of AI.

In this Getting Started procedure, you will use Amazon SageMaker Unified Studio, SageMaker Catalog, Sagemaker Lakehouse sample data, and Amazon Q Developer generative AI tools to analyze code in the JupyterLab IDE. The Amazon Q Developer tools include Q chat and Q CLI. 

Amazon Q Developer provides an agentic chat feature supporting read and write operations in the notebook (Code Editor, JupyterLab) with workspace context awareness. With Amazon Q chat, you can chat about AWS services, your development project, your data pipelines, and related topics. The Amazon Q CLI provides intelligent, contextual assistance for error debugging and development tasks, and it can run complex command line tasks for you.

**Warning**  
Generative AI may give inaccurate responses. Avoid sharing sensitive information. Chats may be visible to others in your organization.

For reference information about implementing Amazon Q Developer in Amazon SageMaker Unified Studio, see [Using Amazon Q Developer with Amazon SageMaker Unified Studio](q-actions.md).

**Topics**
+ [

## Discover Amazon Q Developer in Amazon SageMaker Unified Studio
](#qdeveloper-integration-overview)
+ [

## Considerations for using the Amazon Q Developer feature
](#qdeveloper-integration-considerations)
+ [

## Prerequisites for using the Amazon Q Developer feature
](#qdeveloper-integration-prerequisites)
+ [

# Getting started using Q chat
](qdeveloper-integration-start-chat.md)
+ [

# Getting started with Q CLI
](qdeveloper-integration-start-CLI.md)

## Discover Amazon Q Developer in Amazon SageMaker Unified Studio
Discover

You can use Agentic AI tools through Amazon Q Developer tools that use context and agents to summarize, analyze, perform tasks, and work on your code with you. In your JupyterLab notebook or Code Editor, you can use the Amazon Q chat and Amazon Q CLI tools to understand and configure your Amazon SageMaker Unified Studio project files. For more information about Amazon Q Developer, see [What is Amazon Q Developer](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/what-is.html) in the *Amazon Q Developer User Guide*.

## Considerations for using the Amazon Q Developer feature
Considerations

The following considerations apply for working with Amazon Q Developer in Amazon SageMaker Unified Studio.
+ For Q CLI, for domains using the Amazon Q Free Tier, you will be automatically logged in. For domains using the Amazon Q Pro Tier, you will be prompted to login. You can use the AWS access portal URL (also called the Start URL) associated with the IAM Identity Center login attached to the domain and the IDC region for login. Q CLI will then use the profile and subscription the admin creates following the steps detailed in [Enable Amazon Q Developer Pro](https://docs.aws.amazon.com/sagemaker-unified-studio/latest/adminguide/amazonq.html#amazonq-enable).
**Note**  
If there is only one profile set up, then that is the profile that Q CLI will use. If there are multiple profiles set up, then Q CLI prompts you to choose one. Choose the profile associated with the domain.
+ When you enable Amazon Q, you can choose between the Free or Pro tiers of the service. JupyterLab in the default space supports both the free and paid tiers. However, in additional spaces, JupyterLab and Code Editor support the Free Tier only.
+ The level of use for the Q chat and Q CLI are set by the tier availability as detailed on the pricing page at [Amazon Q Developer Pricing](https://aws.amazon.com/q/developer/pricing/).

**Note**  
When using the Free Tier, request limits are shared at the account level, meaning that one customer can potentially use up all requests. The Pro Tier of Amazon Q is charged at the user level, with limits set at the user level as well. The Pro Tier also lets you manage users and policies with enterprise access control.

## Prerequisites for using the Amazon Q Developer feature
Prerequisites

The following prerequisities are required for this getting started procedure.
+ You must have access to a SageMaker Unified Studio domain and project. Create a project with an **All capabilities** project profile. This project profile sets up your project with access to S3 and Athena resources. For more information, see [Projects](projects.md).
+ To use the Amazon Q Developer chat and CLI features in Amazon SageMaker Unified Studio feature, you need access to a domain where Amazon Q Developer is configured. 

  If the domain is set to use the Free Tier, you will have access to Q chat and Q CLI in JupyterLab without any additional login. For the Pro Tier, your administrator must set up a profile, subscribe users, and attach the profile to the Amazon SageMaker Unified Studio domain. In Q CLI, you can then use the start URL and IDC region to sign in with a Pro Tier license. See [Enable Amazon Q Developer Pro](https://docs.aws.amazon.com/sagemaker-unified-studio/latest/adminguide/amazonq.html#amazonq-enable).

  For more information, see [Using the coding assistant](using-the-coding-assistant.md).

# Getting started using Q chat
Getting started using Q chat

Use Q chat as follows. Make sure you are signed in with an ID that is configured for Q chat access.

1. Log in to your AWS account and navigate to the access portal, such as with your SSO login.

   Open the SageMaker Unified Studio console through the access portal, and then navigate to your project.

1. Open a Jupyter notebook by choosing **Build**, and then choosing **JupyterLab**. A Jupyter notebook cell page opens.

1. Choose the icon on the left for Q chat with Amazon Q Developer. If this is the first time, a message displays for you to acknowledge the AWS policies for responsible AI.   
![\[An image of the Q chat icon.\]](http://docs.aws.amazon.com/sagemaker-unified-studio/latest/userguide/images/q-dev/q_chat_icon.png)

1. Keep the toggle for **Agentic coding** ON.

1. Type questions to interact with Q chat. Type over the **Ask a question... ** line.

You can get started using Q chat with the following examples.

## Example 1: Ask for information about your project
Example 1

This example shows how Q chat can provide context aware responses for your project resources.

1. To open JupyterLab, choose **Build**, and then choose **JupyterLab**. If you are in JupyterLab, you can chat with Q with additional Amazon Q chat contextual awareness. 

1. In the Q chat field, enter the following.

   ```
   Can you tell me about my project?
   ```

   The response returns where Q asks follow-up questions and shows your files.

## Example 2: Create and run a data pipeline
Example 2

This example shows how Q chat can perform complex tasks for you, such as creating and running a data pipeline in your project.

1. To open JupyterLab, choose **Build**, and then choose **JupyterLab**. If you are in JupyterLab, you can chat with Q with additional Amazon Q chat contextual awareness. 

1. In the Q chat field, enter the following.

   ```
   Can you help me set up and run a data pipeline?
   ```

   The following diagram shows the response.  
![\[An example response.\]](http://docs.aws.amazon.com/sagemaker-unified-studio/latest/userguide/images/q-dev/q_chat-pipeline-1.png)

   The following image shows Q asking questions and explaining the task.  
![\[An example response.\]](http://docs.aws.amazon.com/sagemaker-unified-studio/latest/userguide/images/q-dev/q_chat-pipeline-2.png)

   The following image shows Q creating the shell file for you in your workspace.  
![\[An example response.\]](http://docs.aws.amazon.com/sagemaker-unified-studio/latest/userguide/images/q-dev/q_chat-pipeline-4.png)

   The following image shows Q creating the files and describing them.  
![\[An example response.\]](http://docs.aws.amazon.com/sagemaker-unified-studio/latest/userguide/images/q-dev/q_chat-pipeline-5.png)

   The following image shows Q providing the instructions to run the pipeline.  
![\[An example response.\]](http://docs.aws.amazon.com/sagemaker-unified-studio/latest/userguide/images/q-dev/q_chat-pipeline-6.png)

   The following image shows the notebook file that Q created for you in your workspace.  
![\[An example response.\]](http://docs.aws.amazon.com/sagemaker-unified-studio/latest/userguide/images/q-dev/q_chat-pipeline-notebook.png)

1. 

**Get access to data**

   Before visualizing data, you might need to request access to the data by subscribing to data in Amazon SageMaker Catalog.

1. 

**Create new connections**

   You can create connections directly to Amazon Redshift and other third party sources like Oracle and Snowflake from Amazon SageMaker Unified Studio. You configure connection details and credentials securely, and you can manage them within the project. For detailed steps, see [Amazon Redshift compute connections](https://docs.aws.amazon.com/sagemaker-unified-studio/latest/userguide/compute-redshift.html) and [Data connections in lakehouse architecture](https://docs.aws.amazon.com/sagemaker-unified-studio/latest/userguide/lakehouse-data-connection.html).

# Getting started with Q CLI
Getting started with Q CLI

Use Q CLI as follows. Make sure you are signed in with an ID that is configured for Q CLI access. For more information about signing up, see [About signing up](q-actions.md#q-actions-aboutsignup).

1. Log in to your AWS account and navigate to the access portal, such as with your SSO login.

   Open the SageMaker Unified Studio through the access portal, and then navigate to your project.

1. Open a Jupyter notebook by choosing **Build, **and then choosing **JupyterLab**. Choose the icon for the python or console interface. A Jupyter notebook cell page opens.

1. Open a terminal window by choosing **New**, and then **Terminal**.

1. Type the following to open Q CLI.

   ```
   q chat
   ```

You can get started using Q CLI with the following examples.

## Example 1: Create a Glue table and create a python notebook for analysis
Example 1

This example shows how Q CLI can perform complex command line procedures for you, such as creating and visualizing data for a sample python notebook for a data engineer analyzing a Glue table in your project Lakehouse sample data source.

1. Download the diabetic data sample data set from the [sample data](https://archive.ics.uci.edu/dataset/296/diabetes+130-us+hospitals+for+years+1999-2008) site.

1. Create a new Glue table named `diabetic_data` and add the sample data that you just downloaded as a data source. Choose **Create table**. A schema shows for the sample table.  
![\[An image of the Add data screen\]](http://docs.aws.amazon.com/sagemaker-unified-studio/latest/userguide/images/q-dev/q_cli_notebook-1.png)

1. In the terminal for Q CLI, enter the following.

   ```
   You are a machine learning engineer, and you are working with data from the data engineer. Your responsibility is to analyze the output data in your notebook. Can you help me to create a python notebook for the following.
   		- Use the diabetic_data dataset in SageMaker Lakehouse.
   		- Create a notebook to perform typical data engineering tasks for the machine learning experience in JupyterLab.
   		- Make sure to handle missing values, perform descriptive analysis, feature analysis
                 - Create a comprehensive README.md file
   ```

   The following diagram shows the response where Q CLI asks questions and creates sample files.  
![\[An example image with the terminal window Q CLI page.\]](http://docs.aws.amazon.com/sagemaker-unified-studio/latest/userguide/images/q-dev/q_cli_notebook-2.png)

1. The following diagram shows the response where Q CLI interacts with you while creating the files.  
![\[An example image with the terminal window Q CLI page.\]](http://docs.aws.amazon.com/sagemaker-unified-studio/latest/userguide/images/q-dev/q_cli_notebook-3.png)

1. The following diagram shows the response where Q CLI provides the outline and description of what will be created.  
![\[An example image with the terminal window Q CLI page.\]](http://docs.aws.amazon.com/sagemaker-unified-studio/latest/userguide/images/q-dev/q_cli_notebook-4.png)

1. The following diagram shows the response where Q CLI summarizes the files and their purpose.  
![\[An example image with the terminal window Q CLI page.\]](http://docs.aws.amazon.com/sagemaker-unified-studio/latest/userguide/images/q-dev/q_cli_notebook-5.png)

## Example 2: Ask Q CLI to list project information
Example 2

This example shows how Q CLI can provide context aware and complex command line help for your projects and data.
+ In the terminal, enter the following.

  ```
  Can you tell me my project and domain information?
  ```

  The response provides you with project information.