|
1 | | -# Autonomous AI Agents for OCI (Oracle Autonomous Database) |
2 | 1 |
|
3 | | -## Overview |
4 | | - |
5 | | -This repository provides a **modular, extensible framework** for building **OCI AI Agents** using **Oracle Autonomous Database** and **`DBMS_CLOUD_AI_AGENT` (Select AI)**. |
6 | | - |
7 | | -Each OCI service (Vault, Object Storage, Autonomous Database, Network Load Balancer, etc.) is implemented using a **two-layer model**: |
8 | | - |
9 | | -- **Tools Layer** |
10 | | - - Installs reusable PL/SQL functions |
11 | | - - Registers them as AI tools |
12 | | -- **Agent Layer** |
13 | | - - Creates sample tasks, agents, and teams |
14 | | - - Consumes the tools created in the Tools layer |
15 | | - |
16 | | -### Benefits of This Design |
17 | | - |
18 | | -- Reuse tools across multiple agents |
19 | | -- Allow end users to create custom agents and tasks |
20 | | -- Clear separation of: |
21 | | - - Infrastructure logic |
22 | | - - AI orchestration logic |
23 | | - |
24 | | ---- |
25 | | - |
26 | | -## Design Principles |
27 | | - |
28 | | -### 1. Two-Layer Architecture |
29 | | - |
30 | | -Each OCI service is implemented using **two SQL scripts**: |
31 | | - |
32 | | -| Layer | Script Pattern | Purpose | |
33 | | -|------|---------------|---------| |
34 | | -| Tools Layer | `*_tools.sql` | Installs core PL/SQL logic and registers AI tools | |
35 | | -| Agent Layer | `*_agent.sql` | Creates a sample Task, Agent, and Team using those tools | |
36 | | - |
37 | | -This design ensures: |
38 | | -- Tools are reusable across multiple agents |
39 | | -- Agent behavior remains customizable |
40 | | - |
41 | | ---- |
42 | | - |
43 | | -## Tools Scripts (`*_tools.sql`) |
44 | | - |
45 | | -### Purpose |
46 | | - |
47 | | -Tools scripts are responsible for **infrastructure and capability enablement**. |
| 2 | +# Select AI Agents on Oracle Autonomous AI Database |
48 | 3 |
|
49 | | -**Example:** |
50 | | -- `oci_vault_tools.sql` |
51 | | - |
52 | | ---- |
53 | | - |
54 | | -### What a Tools Script Does |
| 4 | +## Overview |
55 | 5 |
|
56 | | -A tools script typically performs the following steps: |
| 6 | +This repository provides a **generic, extensible framework for building Select AI Agents on Oracle Autonomous AI Database** using the **Select AI Agent framework**. |
57 | 7 |
|
58 | | -#### 1. Grant Required Privileges |
| 8 | +Select AI Agents enable natural language interactions with enterprise data by combining large language models (LLMs), database-resident tools, and orchestration logic directly inside Oracle Database. Agents can reason over user input, invoke tools, and return structured, explainable results — all while keeping data governance, security, and execution within the database. |
59 | 9 |
|
60 | | -- Grants access to: |
61 | | - - `DBMS_CLOUD` |
62 | | - - `DBMS_CLOUD_AI` |
63 | | - - `DBMS_CLOUD_AI_AGENT` |
64 | | - - Relevant OCI typed API packages |
65 | | -- Privileges are scoped to the **target schema** |
| 10 | +The agents in this repository are **generic Select AI agents**. While some examples may interact with Oracle services, the framework itself is not limited to any specific domain or platform and can support many different types of agents and workflows. |
66 | 11 |
|
67 | 12 | --- |
68 | 13 |
|
69 | | -#### 2. Create Configuration Table |
| 14 | +## What is a Select AI Agent? |
70 | 15 |
|
71 | | -Creates a generic configuration table: |
| 16 | +Select AI Agents are part of the Oracle Autonomous AI Database Select AI framework. A Select AI Agent: |
72 | 17 |
|
73 | | -```sql |
74 | | -OCI_AGENT_CONFIG |
75 | | -``` |
76 | | - |
77 | | -**Stores configuration such as:** |
78 | | -- Credential name |
79 | | -- Compartment name / OCID |
80 | | -- Resource principal enablement |
81 | | - |
82 | | -> Configuration is **agent-specific** and persisted for runtime use. |
| 18 | +- Accepts natural language input from users |
| 19 | +- Uses an LLM to reason about the request |
| 20 | +- Invokes database-resident tools (PL/SQL functions) |
| 21 | +- Executes logic securely inside the database |
| 22 | +- Returns structured responses |
83 | 23 |
|
84 | | ---- |
| 24 | +Key characteristics of the Select AI Agent framework include: |
85 | 25 |
|
86 | | -#### 3. Initialize Configuration |
| 26 | +- Native integration with Oracle Autonomous AI Database |
| 27 | +- Tool execution through PL/SQL |
| 28 | +- Support for tasks, agents, and teams |
| 29 | +- Centralized governance and monitoring |
| 30 | +- Flexibility to build domain-specific or generic agents |
87 | 31 |
|
88 | | -- Parses optional JSON configuration input |
89 | | -- Enables resource principal authentication if requested |
90 | | -- Persists configuration values |
| 32 | +For full details, refer to the official documentation: |
| 33 | +https://docs.oracle.com/en-us/iaas/autonomous-database-serverless/doc/select-ai-agent.html |
91 | 34 |
|
92 | 35 | --- |
93 | 36 |
|
94 | | -#### 4. Create PL/SQL Package |
95 | | - |
96 | | -**Example package:** |
97 | | - |
98 | | -```sql |
99 | | -oci_vault_agents |
100 | | -``` |
101 | | - |
102 | | -**Package responsibilities:** |
103 | | -- Implements core OCI API logic |
104 | | -- Calls OCI APIs using `DBMS_CLOUD_OCI_*` |
105 | | -- Each function: |
106 | | - - Returns **CLOB JSON** |
107 | | - - Includes: |
108 | | - - Status codes |
109 | | - - Headers |
110 | | - - Response payloads |
| 37 | +## Design Principles |
111 | 38 |
|
112 | | ---- |
| 39 | +### 1. Two-Layer Architecture |
113 | 40 |
|
114 | | -#### 5. Register AI Tools |
| 41 | +Each agent implementation follows a two-layer model using separate SQL scripts. |
115 | 42 |
|
116 | | -- Uses `DBMS_CLOUD_AI_AGENT.CREATE_TOOL` |
117 | | -- Maps each PL/SQL function to an AI tool |
118 | | -- Adds rich instructions describing: |
119 | | - - When to use the tool |
120 | | - - Safety rules (e.g. no secret exposure) |
121 | | - - Expected behavior |
| 43 | +| Layer | Script Pattern | Purpose | |
| 44 | +|--------------|-----------------|---------| |
| 45 | +| Tools Layer | `*_tools.sql` | Installs core PL/SQL logic and registers Select AI tools | |
| 46 | +| Agent Layer | `*_agent.sql` | Creates a sample Task, Agent, and Team using those tools | |
122 | 47 |
|
123 | | ---- |
| 48 | +This design provides: |
124 | 49 |
|
125 | | -### Key Characteristics of Tools |
| 50 | +- **Tools** that are reusable across multiple agents |
| 51 | +- **Agents** as examples for customizable behavior |
126 | 52 |
|
127 | | -- Service-specific but **agent-agnostic** |
128 | | -- Reusable by any task or agent |
129 | | -- Safe to re-run (drop & recreate logic) |
130 | | -- Designed for **human-readable AI responses** |
| 53 | +The clear separation between tools and agents allows infrastructure logic to remain stable while agent behavior can be easily adapted or extended. |
131 | 54 |
|
132 | 55 | --- |
133 | 56 |
|
134 | | -## Agent Scripts (`*_agent.sql`) |
| 57 | +## Repository Structure |
135 | 58 |
|
136 | | -### Purpose |
| 59 | +The repository is organized to align with the Select AI Agent framework: |
137 | 60 |
|
138 | | -Agent scripts create **example AI agents** demonstrating how to use the tools. |
139 | | - |
140 | | -**Example:** |
141 | | -- `oci_vault_agent.sql` |
| 61 | +- Tools scripts define and register reusable PL/SQL functions |
| 62 | +- Agent scripts demonstrate how those tools are composed into tasks, agents, and teams |
| 63 | +- Additional agents can be created without modifying existing tools |
142 | 64 |
|
143 | 65 | --- |
144 | 66 |
|
145 | | -### What an Agent Script Does |
| 67 | +## Agent Configuration (`SELECTAI_AGENT_CONFIG`) |
146 | 68 |
|
147 | | -#### 1. Interactive Execution |
| 69 | +### Overview |
148 | 70 |
|
149 | | -Prompts for: |
150 | | -- Target schema name |
151 | | -- AI Profile name |
| 71 | +Select AI agents use a shared configuration table named `SELECTAI_AGENT_CONFIG` to store **agent-specific configuration parameters**. |
152 | 72 |
|
153 | | -This makes scripts **portable across environments**. |
| 73 | +The table is generic and can be used by any Select AI agent (for example, NL2SQL data retrieval agents or other domain-specific agents). Each agent persists only the configuration keys it requires, while default behavior applies when values are not provided. |
154 | 74 |
|
155 | 75 | --- |
156 | 76 |
|
157 | | -#### 2. Grant Required Privileges |
| 77 | +### Column Description |
158 | 78 |
|
159 | | -Grants: |
160 | | -- `DBMS_CLOUD_AI_AGENT` |
161 | | -- `DBMS_CLOUD` |
| 79 | +| Column | Description | |
| 80 | +|------|------------| |
| 81 | +| `ID` | System-generated unique identifier | |
| 82 | +| `KEY` | Configuration parameter name | |
| 83 | +| `VALUE` | Configuration value (stored as CLOB) | |
| 84 | +| `AGENT` | Logical name of the Select AI agent(Available in tools) | |
162 | 85 |
|
163 | | -To the target schema. |
| 86 | +Configuration entries are uniquely identified by the combination of `KEY` and `AGENT`. |
164 | 87 |
|
165 | 88 | --- |
166 | 89 |
|
167 | | -#### 3. Create Installer Procedure |
| 90 | +### Writing Configuration Entries |
168 | 91 |
|
169 | | -- Creates an installer procedure in the target schema |
170 | | -- Keeps all agent logic **schema-local** |
| 92 | +Configuration values are written during agent installation or setup. |
| 93 | +Only explicitly provided values are persisted; agents apply internal defaults when values are absent. |
171 | 94 |
|
172 | 95 | --- |
173 | 96 |
|
174 | | -#### 4. Create AI Task |
175 | | - |
176 | | -Defines: |
177 | | -- User intent detection |
178 | | -- Allowed tools |
179 | | -- Safety rules |
180 | | -- Formatting expectations |
| 97 | +### Example Configuration Entries |
181 | 98 |
|
182 | | -Enforces: |
183 | | -- Confirmation for destructive actions |
184 | | -- Human-readable output |
| 99 | +#### NL2SQL Data Retrieval Agent |
185 | 100 |
|
186 | | ---- |
| 101 | +```sql |
| 102 | +INSERT INTO SELECTAI_AGENT_CONFIG ("KEY", "VALUE", "AGENT") |
| 103 | +VALUES ('ENABLE_RESOURCE_PRINCIPAL', 'YES', 'NL2SQL_DATA_RETRIEVAL_AGENT'); |
187 | 104 |
|
188 | | -#### 5. Create AI Agent |
| 105 | +INSERT INTO SELECTAI_AGENT_CONFIG ("KEY", "VALUE", "AGENT") |
| 106 | +VALUES ('CREDENTIAL_NAME', 'MY_DB_CREDENTIAL', 'NL2SQL_DATA_RETRIEVAL_AGENT'); |
| 107 | +``` |
189 | 108 |
|
190 | | -- Binds the agent to the specified AI Profile |
191 | | -- Defines the agent’s role and behavior |
| 109 | +### JSON-Based Configuration Input |
192 | 110 |
|
193 | | ---- |
| 111 | +Agent installers may accept configuration as JSON input. |
194 | 112 |
|
195 | | -#### 6. Create AI Team |
| 113 | +Example: |
196 | 114 |
|
197 | | -- Links the agent and task |
198 | | -- Uses **sequential execution** |
| 115 | +```{ |
| 116 | + "use_resource_principal": true, |
| 117 | + "credential_name": "MY_DB_CREDENTIAL" |
| 118 | +} |
| 119 | +``` |
199 | 120 |
|
200 | | ---- |
| 121 | +The installer parses the JSON and stores the relevant values in SELECTAI_AGENT_CONFIG. |
201 | 122 |
|
202 | | -#### 7. Execute Installer |
| 123 | +### Reading Configuration at Runtime |
203 | 124 |
|
204 | | -- Runs the installer procedure |
205 | | -- Completes agent setup |
| 125 | +At runtime, agents read their configuration from SELECTAI_AGENT_CONFIG and consume it as structured JSON. This allows configuration changes without modifying agent code. |
206 | 126 |
|
207 | | ---- |
208 | 127 |
|
209 | | -### Key Characteristics of Agents |
| 128 | +## Supported Use Cases |
210 | 129 |
|
211 | | -- Agents are **examples**, not hard dependencies |
212 | | -- End users can: |
213 | | - - Modify tasks |
214 | | - - Create new agents |
215 | | - - Create multiple teams |
216 | | -- Tools remain unchanged and reusable |
| 130 | +This framework can be used to build Select AI agents for: |
217 | 131 |
|
218 | | ---- |
| 132 | +- Natural language to SQL (NL2SQL) |
| 133 | +- Data retrieval and analytics |
| 134 | +- Database administration and monitoring |
| 135 | +- Operational workflows |
| 136 | +- Custom enterprise automation |
219 | 137 |
|
220 | | -## Example: OCI Vault |
221 | | - |
222 | | -### Files |
223 | | - |
224 | | -| File | Description | |
225 | | -|-----|------------| |
226 | | -| `oci_vault_tools.sql` | Installs Vault PL/SQL package, config table, and AI tools | |
227 | | -| `oci_vault_agent.sql` | Creates a sample Vault task, agent, and team | |
| 138 | +Agents can target database-only workflows, service integrations, or mixed enterprise use cases. |
228 | 139 |
|
229 | 140 | --- |
230 | 141 |
|
231 | | -### Supported Capabilities |
| 142 | +## Compatibility and Release Support |
232 | 143 |
|
233 | | -The Vault tools support: |
| 144 | +Select AI capabilities vary by database release. For details on supported features across Autonomous Database and compatible non-Autonomous Database releases, refer to the official Select AI Capability Matrix: |
234 | 145 |
|
235 | | -- List secrets |
236 | | -- Get secret metadata |
237 | | -- Create secrets |
238 | | -- Update secrets / rotate versions |
239 | | -- List secret versions |
240 | | -- Get specific secret versions |
241 | | -- Schedule and cancel deletions |
242 | | -- Change secret compartment |
243 | | - |
244 | | -**All operations:** |
245 | | -- Use persisted configuration |
246 | | -- Require confirmation for destructive actions |
247 | | -- Never expose secret payloads unintentionally |
| 146 | +https://docs.oracle.com/en/database/oracle/oracle-database/26/saicm/select-ai-capability-matrix.pdf |
248 | 147 |
|
249 | 148 | --- |
250 | 149 |
|
251 | | -## Installation Order (Recommended) |
252 | | - |
253 | | -For each OCI service: |
| 150 | +## Getting Started |
254 | 151 |
|
255 | | -1. Run `*_tools.sql` |
256 | | -2. Run `*_agent.sql` (optional, for sample agent) |
257 | | - |
258 | | -### Example (OCI Vault) |
259 | | - |
260 | | -```sql |
261 | | --- Step 1: Install tools |
262 | | -sqlplus admin@db @oci_vault_tools.sql <INSTALL_SCHEMA> |
263 | | - |
264 | | --- Step 2: Install sample agent |
265 | | -sqlplus admin@db @oci_vault_agent.sql |
266 | | -``` |
| 152 | +1. Run the Tools layer scripts to install and register Select AI tools. |
| 153 | +2. Run the Agent layer scripts to create sample tasks, agents, and teams. |
| 154 | +3. Customize existing agents or create new ones by composing available tools. |
| 155 | +4. Extend the framework by adding new tools and agent definitions. |
267 | 156 |
|
268 | 157 | --- |
269 | 158 |
|
270 | | -## Customization & Extension |
| 159 | +## Intended Audience |
271 | 160 |
|
272 | | -- Create your own tasks, agents, and teams |
273 | | -- Tools remain stable and reusable |
274 | | -- Multiple agents can share the same tools |
275 | | -- Configuration can be updated in: |
| 161 | +This repository is intended for: |
276 | 162 |
|
277 | | -```sql |
278 | | -OCI_AGENT_CONFIG |
279 | | -``` |
| 163 | +- Database developers |
| 164 | +- Data engineers |
| 165 | +- Architects |
| 166 | +- Platform teams |
| 167 | +- AI practitioners working with Oracle Autonomous AI Database |
280 | 168 |
|
281 | | ---- |
282 | | - |
283 | | -## Error Handling & Safety |
284 | | - |
285 | | -- Scripts exit immediately on SQL errors |
286 | | -- All destructive OCI operations require confirmation |
287 | | -- Tools return structured JSON containing: |
288 | | - - Status |
289 | | - - Headers |
290 | | - - Payload |
291 | | -- Fully re-runnable with safe drop-and-create logic |
| 169 | +Anyone looking to build secure, database-native AI agents using Select AI can use this repository as a starting point. |
292 | 170 |
|
293 | 171 | --- |
294 | 172 |
|
295 | 173 | ## License |
296 | 174 |
|
297 | 175 | This project is licensed under the **Universal Permissive License (UPL), Version 1.0**. |
298 | | - |
299 | | -See: |
300 | | -https://oss.oracle.com/licenses/upl/ |
| 176 | +See: https://oss.oracle.com/licenses/upl/ |
0 commit comments