Overview

Tool Name

notebook_manager_tools

Purpose

This tool allows genbots to manage notebooks by creating, updating, or deleting notes and configurations. It is essential for organizing structured documentation, workflows, and operational instructions.

Functions Available

  1. _manage_notebook: Create, list, update, or delete notes or process configurations

  2. create_note: Creates a new note with detailed content and parameters.

  3. update_note: Modifies the content, configuration, or metadata of an existing note.

  4. delete_note: Permanently deletes a note from the system.

  5. list_notes: Lists all available notes, including details like type and identifiers.

  6. get_note_details: Retrieves the full content and metadata of a specific note by its ID.

  7. execute_note: Runs the embedded SQL, Python logic, or processes stored in a specified note.

Key Features

Note Creation

Create new notes with detailed content tailored to specific processes or workflows.

Note Configuration

Update and manage existing notes for maintaining relevant and accurate documentation.

List All Notes For Genbot Workflows

List and delete notes to optimize notebooks for active workflows.

Input Parameters

_manage_notebookManage Notebook
Input ParametersDefinitionFormat
ActionDefines the operation to be performed.String ("CREATE", "UPDATE", "DELETE", "LIST")
"CREATE"Creates a new note.-
"UPDATE"Updates an existing note with revised content.-
"DELETE"Deletes an existing note from the notebook.-
"LIST"Lists all currently available notes and configurations.-
note_id(Required for updates and deletions) A unique identifier for the note.String
note_nameA meaningful name for the note (e.g., “Monthly Report Process”).String
note_typeDefines the note’s type.String ("process", "sql", "snowpark_python")
note_contentThe actual content of the note, including instructions or configurations.String
note_params (Optional)Parameters associated with the note for custom execution.String
create_noteCreate a Note For Genbot Use
Input ParametersDefinition
note_idUnique ID for the note (e.g., note-abcdef123).
note_nameHuman-readable name for the note (e.g., Database Query Guide).
note_typeThe type of note, such as processsnowpark_python, or sql.
note_contentThe text content of the note (e.g., SQL query or process description).
note_params(Optional): Parameters required by the note, provided as key-value pairs.
update_noteUpdate Note Instructions
Input ParametersDefinition
note_idUnique ID of the note to update.
update_detailsFields to modify, such as content, name, or parameters.
delete_noteNote Deletion
Input ParametersDefinition
note_idUnique string identifier for the note being deleted.
list_notesList All Available Notes
Input ParametersDefinition
N/ANo parameters required; retrieves all types of notes stored in the system.
get_note_detailsUpdate Note Instructions
Input ParametersDefinition
note_idSpecifies the note to retrieve in full.
execute_noteGenbot Note Use
Input ParametersDefinition
note_idSpecifies the unique identifier of the note to execute. 

Genbot Tip

Validate note parameters for compatibility with their intended use case, such as SQL or Python snippets. 

How It Works

Users create, update, or delete notes within a notebook structure. Notes act as modular building blocks for workflows. They encapsulate tasks such as querying databases, performing data transformations, or running advanced analytics, making processes reusable, maintainable, and scalable.

Reminder

Deleted notes cannot be retrieved unless backed up elsewhere.

Structure of the Note

  1. Note ID: Each note is assigned a unique identifier for execution.

  2. Note Name: A human-readable title, such as ” XYZ Report Results”, is used to make the purpose clear.

  3. Note Type:   sql, snowpark_python

    • Select SQL for querying databases or Snowpark Python for calculations and programmatically processing the data.
  4. Note Content: For SQL: Ensure the query fetches all necessary fields, applies appropriate conditions and filters, and uses proper joins (if needed). For Snowpark Python: Structure the logic in reusable functions for calculations or data wrangling.

  5. Parameters (if any): Allows flexibility for input values to modify or tailor queries dynamically.

Step-by-Step: How to Create a Note Using Notebook Tools

The example we will be using will be creating the note used in the “Autonomous Actionable Data Analysis” example.

Step 1: Start By Asking To Create A New Note

User: I want to create a new note.

Step 2: Provide The Note Details

User: 
1. DCR Report Result
2. SQL
3. SELECT RESULTS, report_name FROM SAMOOHA_BY_SNOWFLAKE_LOCAL_DB.PUBLIC.REPORTS

We provided the above because:

1. Uses a consistent naming convention that highlights the objective. Upon note creation, the note ID will be automatically populated following a naming convention such as <bot_id>_<task_name>_<random_id>

2. we selected SQL as the note type for querying databases.

3. we ensured the query fetches all necessary fields, applies appropriate conditions and filters, and uses proper joins (if needed).

4. If variability is needed, create placeholders for values such as QUARTER or CAMPAIGN_ID using Genbots parameter variables. Example:

  • Parameterized SQL: WHERE QUARTER = ${quarter}

  • Parameter: quarter = 2024Q2

Note: For this specific note we want to create a static reusable SQL query that the Genbot can’t change when processing.

  • Upon creation of the note, we can now choose to also include it within an autonomous process if needed. To learn more about creating an autonomous process refer to the “How To Use Process Runner Tools” section.

Step 3: Testing The Created Note

Now that the note has been successfully created, you can test the note by simply asking the Genbot to run the note name or note id.