Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 130 additions & 0 deletions maximize-aiops-efficiency-genai-agents/agent/deploy_agent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# Install and Configure OCI Generative AI Agents

## Introduction

Once you have Email Delivery configured, you can use it with a wide variety of OCI services. For this lab, we will going to generate SMTP credentials as we are going to use in Email tool. We will also provision Generative AI agent endpoint and Agent client Function tools.

Estimated Lab Time: 45 minutes

### About <Product/Technology>

OCI Generative AI Agents is a fully managed service that combines the power of large language models (LLMsLLM (Generative AI, Generative AI Agents) ) with AI technologies to create intelligent virtual agents that can provide personalized, context-aware, and highly engaging customer experiences.

### Objectives

In this lab, you will:

* Generate SMTP Credentials
* Provisioning an Generative AI agent endpoint using the OCI Console
* Prepare Python Virtual Environment
* Configure Environment variable file
* Deploy OCI Generative AI Agents using python Agent Development Kit(ADK)

### Prerequisites

This lab assumes you have:

* Oracle Cloud account
* All previous labs successfully completed

## Task 1: Generate SMTP Credentials

1. While in the OCI Console, Click on your **Profile** which can be found in the upper-right corner of any screen in the OCI console. Select **My Profile**.
![Open User Profile in Console](images/picture1.png)

2. Click on **SMTP credentials** on the left-hand side of your profile under Resources.

3. Click on the **Generate SMTP Credentials** button.
![Generate SMTP Credentials](images/picture2.png)

4. Enter a description for the credentials and then click on the **Generate credentials** button.

5. Copy the Username and Password. Save them to a secure location for use in the next task. **Close** the Generate credentials window when complete.
![Copy SMTP Credentials](images/picture3.png)

6. There is one more piece of information you need for your Postfix configuration. Before you leave the console, click the **Navigation menu** in the upper left, navigate to **Developer Services** then select **Application Integration - Email Delivery**. Once at the Email Delivery screen, click **Configuration** in the left-hand side.
![Email Delivery Configuration Navigation](images/picture4.png)

7. Copy the Relay Host Public Endpoint and SMTP Ports for use in the next task. Save for use later.
![Email Delivery Relay Host Configuration](images/picture5.png)

## Task 2: Provisioning an Generative AI agent endpoint using the OCI Console

We will going to provision Generative AI Agent using OCI Console. Through endpoint our Generative AI Agent receives and responds to chat or function‑calling requests.This step is about infrastructure setup and we will use OCI Console to do it.

1. Log in to the OCI Console, go to **Analytics & AI**, click **AI Services** and choose **Generative AI Agents**
![Picture 6](./images/picture6.png "Picture 6")

2. Click on **Overview** and select **Create agent**
![Picture 7](./images/picture7.png "Picture 7")

3. Enter **Name** and **Welcome message**
![Picture 8](./images/picture8.png "Picture 8")

4. Since we are going to create Tools using OCI ADK so click on **Next**
![Picture 9](./images/picture9.png "Picture 9")

5. In **Setup agent endpoint** select **Automatically create an endpoint for this agent** and rest with default options
![Picture 10](./images/picture10.png "Picture 10")

6. Go to **Review and Create** and click **Create agent**
![Picture 11](./images/picture11.png "Picture 11")

7. Once the agent creation completed and go to **Endpoints** and click on **endpoint** and copy **OCID**
![Picture 12](./images/picture12.png "Picture 12")
![Picture 13](./images/picture13.png "Picture 13")

## Task 3: Prepare Python Virtual Environment

Here we are preparing virtual environment with all libraries which are required to provison OCI Generative AI Agents. I am assuming you have compute instance where Visual Studio code and Python 3.12 already installed.

1. Create a **project** with a virtual environment
![Picture 14](./images/picture14.png "Picture 14")

2. Install the latest version **Agent Development Kit(ADK)**
![Picture 15](./images/picture15.png "Picture 15")

3. Install all required libraries using **requirement.txt**. Please download this file and run below command:
[requirements.txt](https://c4u04.objectstorage.us-ashburn-1.oci.customer-oci.com/p/EcTjWk2IuZPZeNnD_fYMcgUhdNDIDA6rt9gaFj_WZMiL7VvxPBNMY60837hu5hga/n/c4u04/b/livelabsfiles/o/labfiles%2Frequirements.txt)

``` bash
<copy>
pip install -r requirements.txt
</copy>
```

## Task 4: Configure Environment variable file

Environment variables are key-value pairs used to configure applications without hardcoding sensitive or environment-specific information.
Here you have fill variables as per your environment except **"SLACK_BOT_TOKEN"** and **"SLACK_APP_TOKEN"**. This we will fill after slack configration.
![Picture 16](./images/picture16.png "Picture 16")

**Download .env file**
[.env](https://c4u04.objectstorage.us-ashburn-1.oci.customer-oci.com/p/EcTjWk2IuZPZeNnD_fYMcgUhdNDIDA6rt9gaFj_WZMiL7VvxPBNMY60837hu5hga/n/c4u04/b/livelabsfiles/o/labfiles%2Fenv)

## Task 5: Deploy OCI Generative AI Agents using python Agent Development Kit(ADK)

ADK (Agent Development Kit) is a client-side library that simplifies building agentic applications on top of OCI Generative AI Agents Service.

When pairing ADK with OCI Generative AI Agents Service, you can use simple but powerful primitives to build complex, production-grade agentic applications.
The ADK provides an AgentClient class to simplify handling authentication and management of agent resources. Four authentication types are supported like
**API Key Authentication (Default)**: In this lab we have used this. Request you to setup your API configuration and set profile name as **CHICAGO**. To set up API key authentication, follow the [OCI API key setup guide](https://docs.oracle.com/en-us/iaas/Content/API/Concepts/apisigningkey.htm)

1. Download the **agent-tool-creation.py**. This contains all steps to configure agent:
[agent_tool_creation.py](https://c4u04.objectstorage.us-ashburn-1.oci.customer-oci.com/p/EcTjWk2IuZPZeNnD_fYMcgUhdNDIDA6rt9gaFj_WZMiL7VvxPBNMY60837hu5hga/n/c4u04/b/livelabsfiles/o/labfiles%2Fagent_tool_creation.py)

2. Let's execute this python code. It will start deploying agent tools one by one.
![Picture 17](./images/picture17.png "Picture 17")

3. Validate all tools deployed successfully in OCI Console.
![Picture 18](./images/picture18.png "Picture 18")
![Picture 19](./images/picture19.png "Picture 19")
![Picture 20](./images/picture20.png "Picture 20")
![Picture 21](./images/picture21.png "Picture 21")
![Picture 22](./images/picture22.png "Picture 22")
![Picture 23](./images/picture23.png "Picture 23")

## Acknowledgements

* **Author**
**Nikhil Verma**, Principal Cloud Architect, NACIE
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
134 changes: 134 additions & 0 deletions maximize-aiops-efficiency-genai-agents/compute/compute.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# Deploy OCI Test Compute Instance and Configure Alarms

## Introduction

In this lab, we will learn how to deploy test compute instance, Install Stress test and enable CPU and Memory Alarms in OCI Console.

Estimated Time: 20 minutes

### Objectives

In this lab, you will:

- Deploy Test Compute Instance
- Setting up the compute instance
- Install and configure Stress-ng
- Enable CPU and Memory Alarms in OCI Console

### Prerequisites

This lab assumes you have:

- All previous labs successfully completed

- You already have Deployed VCN

- You have access to deploy compute instances

## Task 1: Deploy Test Compute Instance

1. Go to the OCI console. From the OCI services menu, click Compute > Instances.
![Image1](./images/image1.png "Image 1")

2. Click Create Instance.
![Image2](./images/image2.png "Image 2")

3. Enter a name for your instance and select the compartment you used earlier to create your VCN.
![Image3](./images/image3.png "Image 3")

4. Scroll down on the page. Click Change Image and choose Oracle linux 8 then click on Change Shape and choose VM.Standard.A1.Flex.
![Image4](./images/image4.png "Image 4")

5. Scroll down to Primary VNIC Information section and edit the following:

Virtual cloud network: Choose the VCN you created in Lab 1

Subnet: Choose the Public Subnet under Public Subnets (it should be named Public Subnet-NameOfVCN)

Assign a Public IPv4 address: Automatically assign public IPv4 address
![Image5](./images/image5.png "Image 5")

6. Add SSH Keys: Choose Generate a key pair for me and save private and public keys. If you already have ssh keys, choose Paste public keys or upload public key saved.
![Image6](./images/image6.png "Image 6")
![Image7](./images/image7.png "Image 7")

7. Click Create.

## Task 2: Setting up the compute instance

1. SSH into the compute instance
In cloud shell terminal or your machine's terminal, navigate to the directory where your SSH keys are stored. To get there, enter the command:

``` bash
<copy>cd ~/path_to_ssh_directory</copy>
```

2. Enter **ls** to view the files in this directroy and verify your SSH key file exists.

3. Change the permissions of private key file, enter the command:

``` bash
<copy>
chmod 400 <private_sshkeyname>
</copy>
```

![lab2_task1_4](images/lab2_task1_4.png "lab2_task1_4")

4. Now we will SSH into your compute instance, enter the command:

``` bash
<copy>ssh -i <private_sshkeyname> opc@<PUBLIC_IP_OF_COMPUTE></copy>
```

Check the details of your compute instance in the OCI web console to the **```PUBLIC_IP_ADDRESS```**

**HINT:** If 'Permission denied error' is seen, ensure you are using '-i' in the ssh command. You MUST type the command, do NOT copy and paste ssh command.

5. Enter 'yes' when prompted for the security message.

6. Verify opc@`<COMPUTE_INSTANCE_NAME>` appears on the prompt.
![ssh.png](images/ssh.png " ")

## Task 3: Install and configure Stress-ng

1. Now we will navigate to the home directory of the terminal. To do so, enter:

``` bash
<copy>
cd ~
</copy>
```

2. Let's install the required dependencies:

``` bash
<copy>
sudo dnf install stress-ng -y
</copy>
```

## Task 4: Configure Alarms

1. Go to **Observality & Management** and Choose **Alarm Definitions**
![Image8](./images/image8.png "Image 8")

2. Create Alarm definition for CPU and Memory Alarms.
Let's create CPU_ALARM first, Name of alarm matters as our Generative AI Agent look for this name in Alarm status Dashboard
![Image9](./images/image9.png "Image 9")
![Image10](./images/image10.png "Image 10")

Let's create MEMORY_ALARM first, Name of alarm matters as our Generative AI Agent look for this name in Alarm status Dashboard
![Image11](./images/image11.png "Image 11")
![Image12](./images/image12.png "Image 12")

3. Let's trigger alarms from OCI Instance
![Image13](./images/image13.png "Image 13")

4. Go to **Observality & Management** and Choose **Alarm Status**. You will find alarms here.
![Image14](./images/image14.png "Image 14")

## Acknowledgements

- **Author**
**Nikhil Verma**, Principal Cloud Architect, NACIE
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Introduction

## About this Workshop

This workshop will help you configure OCI Generative AI Agents in your own OCI tenancy.
It enables Support Engineers, SREs, and developers to perform IT operations using the OCI Generative AI Agent Service with runbook-based guidance.
The users can then

- Connect to OCI Generative AI Agent Service from Slack.
- Get responses of their question (in natural language) from OCI Generative AI Agent client function tools.
By following the workshop users can perform IT Operations OCI Generative AI Agent in their own tenancy

![User View](images/image_intro.png)

Estimated Workshop Time: 3 hours

### Objectives

Objective of this workshop is to set-up the required OCI services to create a full Generative AI Agent solution with RAG and client function tool capabilities:

![Architecture Diagram](images/architecture_aiops.png)

- OCI Generative AI Agent Service – Users can configure OCI Generative AI Agent Service (create and configure Knowledge Bases and Agents).
Users can then ingest and perform RAG on the user’s documents in 23ai database, using OCI Generative AI Agent Service.
- Local Client Machine – Users will use Local client machine which will orchestrate all OCI Generative AI agent tools. We will use OCI Agent Development Kit(ADK) a client-side library that simplifies building aganetic application on top of OCI Genrative AI Agent service.
- Slack Application – Users can create slack app in their workspace which will be used to connect from Slack to OCI Generative AI Agent Service.

In this workshop, you will learn how to:

- Create autonomous database and upload documents in the database.
- Setup & configure Generative AI Agent Service (Knowledge Bases and Agents)
- Setup & configure Slack App integration with OCI ADK

### Prerequisites

This lab assumes you have:

- An Oracle Cloud Account
- Access to OCI Generative AI Agents
- Access to a Region where the Agent service is available: Chicago, Frankfurt
- Must have an Administrator Account or Permissions to manage several OCI Services: Generative AI Agents, 23ai database, OCI Instances, Network, Dynamic Groups, Policies, IDCS/Identity Domain Confidential Applications
- Familiarity with Oracle Cloud Infrastructure (OCI) is helpful

## Learn More

- [What Is Generative AI? How Does It Work?](https://www.oracle.com/artificial-intelligence/generative-ai/what-is-generative-ai/)
- [What Is Retrieval-Augmented Generation (RAG)?](https://www.oracle.com/artificial-intelligence/generative-ai/retrieval-augmented-generation-rag/)
- [Overview of Generative AI Service](https://docs.oracle.com/en-us/iaas/Content/generative-ai/overview.htm)

## Acknowledgements

- **Author**
- **Nikhil Verma**, Principal Cloud Architect, NACIE
44 changes: 44 additions & 0 deletions maximize-aiops-efficiency-genai-agents/kb/kb.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Create Knowledge base

## Introduction

This lab walks you through the steps to setup an OCI Generative AI Agent including ingesting a knowledge base from 23ai adb.

Estimated Time: 10 minutes

### About Generative AI Agents

OCI Generative AI Agents is a fully managed service that combines the power of large language models (LLMs) with an intelligent retrieval system to create contextually relevant answers by searching your knowledge base, making your AI applications smart and efficient.

OCI Generative AI Agents supports several ways to onboard your data and then allows you and your customers to interact with your data using a chat interface or API.

### Objectives

In this lab, you will:

* Create Knowledge base

### Prerequisites

This lab assumes you have:

* All previous labs successfully completed
* Permissions to manage OCI Services: Generative AI Agents
* Access to a Region where the Agent service is available: Chicago, Frankfurt

## Task: Create Knowledge Base

This task will help you create a knowledge base using 23ai database as source.

1. Locate Knowledge Bases under Analytics & AI -> Generative AI Agents.

![KB Navigation](images/locate_kb.png)

2. Click on your Create knowledge base. Provide Name, Data store type as Oracle AI Vector Search, Provide Database tool connection and click on Test connection. Once successful provide the vector search function created in the optional lab or your own vector search function. Lastly, click on create to create the Knowledge base.

![KB creation](images/create_kb.png)

## Acknowledgements

* **Author**
**Nikhil Verma**, Principal Cloud Architect, NACIE
Loading