

# Basic usage


**To generate code with the SageMaker Data Agent**

1. Type a natural language prompt describing what you want to accomplish.

1. Press  Alt A  (or  Opt A  on Mac) to trigger code generation.

1. Review the generated code in the suggestion panel.

1. Choose **Accept** to add the code to your cell or **Reject** to dismiss it.

**To use the SageMaker Data Agent chat panel**

1. Open the agent chat panel from the notebook interface.

1. Enter a prompt describing your data analysis needs.

1. Review the agent's plan and suggested approach.

1. The SageMaker Data Agent will generate a collection of cells to implement the analysis plan.

1. Review and execute the generated cells as needed.

**To diagnose errors with the SageMaker Data Agent**

1. When a cell execution results in an exception, look for the **Diagnose with agent** button.

1. Choose the button to get agent-generated suggestions for fixing the error.

1. Review the suggested fixes and code improvements.

1. Apply the suggestions or use them as guidance for manual fixes.