# Instruct the Notebook

### Overview

The **Generate Notebook Instructions** enables users to define *what* and *how* the AI Data Engineer should transform and process source data. Whether you provide instructions manually or let the AI derive them from documentation in a folder, this feature puts you in control of the configuration logic. At the same time, the AI does the heavy lifting.

The interface is divided into two main areas:

1. **Resources** – Where you define and attach your data sources.
2. **Instructions** – Where you specify the details of what to do with that data.

Once you provide these details, the AI Data Engineer will generate a notebook that automates your data workflow.&#x20;

### Auto-Configure Instructions

1. Select **Generate Notebook**

<figure><img src="/files/HQn2DoReyquu6C1QDtzH" alt="" width="375"><figcaption></figcaption></figure>

### Generate Notebook Instructions

<figure><img src="/files/BsOstrBfCAv4qsJtxV6a" alt="" width="563"><figcaption></figcaption></figure>

### **Resources Panel**

Identify all the data inputs the AI Data Engineer will use.

**Adding Resources:**

1. Click **Add resource**.
2. Select files or define static paths (e.g., `/erp/invoices`).
3. Drag and drop resource paths into the panel for quicker setup.
4. Select **Save.**

&#x20;All provided paths are interpreted and included automatically; no extra configuration is needed.

<figure><img src="/files/ZexPvkwxo8jdJHjBK17w" alt="" width="563"><figcaption></figcaption></figure>

<figure><img src="/files/BACDkunSHyy9e2VblPPc" alt="" width="375"><figcaption></figcaption></figure>

#### Resource Guidance

When using resources to generate instructions:

* Limit of **10 files per resource set**
* All files must be relevant to the current data use case
* Accepted formats include DOCX, PDF, TXT, CSV, XLSX, SQL, and code files

1. Select Add resources&#x20;
2. Select Resources

{% hint style="info" %}
Note:  “No resources added yet” means you must attach at least one file or data source before proceeding.
{% endhint %}

### **Instructions Panel**

Define precise tasks for your AI Data Engineer. This is ideal when you have exact requirements or need custom, one-off logic.

**Adding Instructions:**

1. Populate the instructions section with the following structure below.
2. Select **Generate**

**Structure:**

* **# Source:**  Identify what data is being transformed.  This is the path or dataset where the data comes from.\
  \&#xNAN;*Example:* `/erp/invoices`
* **# Destination:** Output path or location where the processed data will be saved. This often pre-populates from your Fabric workspace, but you can also provide instructions to create a table(s). \
  \&#xNAN;*Example:* `/analytics/monthly_summary`
* **# Instructions:** Describe transformations, validation rules, mappings, business logic, or workflow in plain language.\
  \&#xNAN;*Example:*

  ```
  Filter for invoices from the past month,
  convert currency to USD,
  and aggregate totals by client.
  ```

{% hint style="info" %}
Note: You can use **static paths** or **dynamic cues** (e.g., “import remittances on Wednesdays”).
{% endhint %}

These instructions act as *guardrails* for the AI, helping it:

* Stay aligned with business rules
* Ensure data integrity
* Avoid brittle or incorrect transformations

### **Notebook Best Practices**

* Be Specific: Clear, precise instructions produce better results.
* Use Paths Consistently: Ensure your source/destination paths are valid and accessible.
* Describe Transformations in Order: List processing steps sequentially.
* Validate Output Requirements: Confirm the destination matches your data format needs.

### Real-World Example

Let’s say your destination is a `employee_pets` table, and you want the AI to extract employee and pet information from messy spreadsheets.  You could enter instructions such as the following:

<details>

<summary>Sample Instructions</summary>

\# Source files:

All files in "Employee and pets data" folder. You may need to join data from employees' files and pets' files<br>

\# Destination Table or Tables:

employee\_and\_pets

\# Ingestion instructions:

1. &#x20; Marital Status can only take two values - Y and N. Map any values in the source to one of these two values.
2. Join the data in the Person and Pets files using person ID and owner ID
3. Phone number should be in (XXX) XXX-XXXX US phone number format. You can skip the country code
4. Extract or Infer City and State from Address
5. Employee Category can only take one of these 5 values. Figure out how to map any values in the source to one of these five values.

   Full Time

   Part Time

   Contractor

   Temp

   Intern

</details>

The AI will parse that information and present it back to you as an editable instruction template. You can then adjust as needed.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://agenticdocs.osmos.io/ai-data-agents-on-microsoft-fabric/ai-data-wrangler/ai-data-engineer/instruct-the-notebook.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
