DBMS_CLOUD_AI_AGENT Package
This package defines and manages Select AI agents, tasks, tools, and orchestration.
See Also:
Summary of DBMS_CLOUD_AI_AGENT Subprograms
This section covers the Select AI Agent's
DBMS_CLOUD_AI_AGENT
subprograms provided with Autonomous Database.
Subprogram | Description |
---|---|
This procedure creates an agent. |
|
Provides attributes for creating an agent. |
|
This procedure enables an agent. |
|
This procedure disables an agent. |
|
This procedure drops an existing agent. |
|
This procedure creates a task that an agent and agent team can include. |
|
Provides attributes for creating an agent task. |
|
This procedure enables an agent task. |
|
This procedure disables an agent task. |
|
This procedure drops an existing agent task. |
|
This procedure creates custom tools that an agent can include. |
|
Provides attributes for creating tools. |
|
This procedure enables a registered tool. |
|
This procedure disables a registered tool. |
|
This procedure drops an existing tool. |
|
This procedure creates an agent team and includes agents and tasks. |
|
Provides attributes for creating an agent team. |
|
This procedure sets the agent team in the current session. |
|
This procedure returns the agent team set in the current session. |
|
This procedure clears the agent team set in the current session. |
|
This procedure creates a new agent or runs a paused one. |
|
This procedure enables an agent team. |
|
This procedure disables an agent team. |
|
This procedure drops an existing agent team. |
CREATE_AGENT Procedure
Use the DBMS_CLOUD_AI_AGENT.CREATE_AGENT
procedure to register a new
AI agent in the Select AI Agent framework. Define the agent’s identity using
agent_name
, configure its behavior with the attributes parameter, and
optionally provide a
description.
Syntax
DBMS_CLOUD_AI_AGENT.CREATE_AGENT
(
agent_name IN VARCHAR2,
attributes IN CLOB,
status IN VARCHAR2 DEFAULT NULL,
description IN CLOB DEFAULT NULL
);
Parameters
Parameter | Description |
---|---|
|
A name for the AI agent. The agent name must follow the naming rules of Oracle SQL identifier. Maximum length of name is 125 characters. This is a mandatory parameter. |
|
Custom attributes for the AI agent. See CREATE_AGENT Attributes for more details. |
status |
Status of the agent. The default value is |
|
User-specified description for the AI agent. The default value is NULL. |
Example
The following example creates an agent to process customer product returns. For a complete example, see Example: Create a Product Return Agent.
BEGIN
DBMS_CLOUD_AI_AGENT.CREATE_AGENT
(
agent_name => 'CustomerAgent',
attributes => '{
"profile_name": "GOOGLE",
"role": "You are an experienced customer agent who deals with customers return request."
}'
);
END;
/
PL/SQL procedure successfully completed.
CREATE_AGENT Attributes
Attributes
Attribute Name | Default Value | Description |
---|---|---|
|
- |
The AI profile that the agent is using to send request to LLM. This is a mandatory parameter. |
|
NULL |
Define the agent’s function and provide context to the agent. This is sent to LLM. This is a mandatory parameter. |
|
|
Enable agent to ask questions to the user for information or clarification. |
BEGIN
DBMS_CLOUD_AI_AGENT.CREATE_AGENT
(
agent_name => 'Customer_Return_Agent',
attributes => '{
"profile_name": "GOOGLE",
"role": "You are an experienced customer agent who deals with customers return request.",
"enable_human_tool": "False"
}'
);
END;
/
PL/SQL procedure successfully completed
ENABLE_AGENT Procedure
This procedure enables the AI
agent that the user specifies. The procedure changes the status of the AI agent to
ENABLED
.
Syntax
DBMS_CLOUD_AI_AGENT.ENABLE_AGENT
(
agent_name IN VARCHAR2
);
Parameters
Parameter | Description |
---|---|
|
Name for the AI agent to enable. This parameter is mandatory. |
Example to Enable AI Profile
BEGIN
DBMS_CLOUD_AI_AGENT.ENABLE_AGENT
(
agent_name => 'Customer_Return_Agent'
);
END;
/
DISABLE_AGENT Procedure
This procedure disables the AI agent in the
current database. The status of the AI agent is changed to DISABLED
by this
procedure.
Syntax
DBMS_CLOUD_AI_AGENT.DISABLE_AGENT
(
agent_name IN VARCHAR2
);
Parameters
Parameter | Description |
---|---|
|
Name for the AI agent. This parameter is mandatory. |
Example
BEGIN
DBMS_CLOUD_AI_AGENT.DISABLE_AGENT
(
agent_name => 'Customer_Return_Agent'
);
END;
/
DROP_AGENT Procedure
The procedure drops an existing AI agent. If the agent does not exist, then the procedure throws an error.
Syntax
DBMS_CLOUD_AI_AGENT.DROP_AGENT
(
agent_name IN VARCHAR2,
force IN BOOLEAN DEFAULT FALSE
);
Parameters
Parameter | Description |
---|---|
|
Name of the AI agent. This is a mandatory parameter. |
|
If The default value for this parameter is
|
Example
BEGIN
DBMS_CLOUD_AI_AGENT.DROP_AGENT
(agent_name => 'Customer_Return_Agent);
END;
/
Usage Notes
Use force
to drop an agent and ignore errors if AI
agent does not exist.
CREATE_TASK Procedure
Use the DBMS_CLOUD_AI_AGENT.CREATE_TASK
procedure to define a task
that a Select AI agent can include in its reasoning process. Each task has a unique name and
a set of attributes that specify the agent’s behavior when planning and performing the
task.
You can define dependencies between tasks using the
input
attribute, allowing Select AI to pass the output of one
task into another. This supports chained reasoning and multi-step workflows.
Syntax
DBMS_CLOUD_AI_AGENT.CREATE_TASK
(
task_name IN VARCHAR2,
attributes IN CLOB,
status IN VARCHAR2 DEFAULT NULL,
description IN CLOB DEFAULT NULL
);
Parameters
Parameter | Description |
---|---|
|
A unique name for the task. This is a mandatory parameter. |
|
JSON object containing task-specific attributes. See CREATE_TASK Attributes. |
status |
Status of the task. The default value is |
|
User-defined description to help identify the task. This value is stored in the database but not sent to the LLM. The default value is NULL. |
|
Enable agent to ask questions to user when it requires information or clarification during a task. Default value is true. Note: Task |
Example
The following example creates a task to process a product return from a customer.
BEGIN
DBMS_CLOUD_AI_AGENT.CREATE_TASK
(
task_name => 'Return_And_Price_Match',
attributes => '{"instruction": "Process a product return request from a customer:{query}' ||
'1. Ask customer the reason for return (price match or defective)' ||
'2. If price match:' ||
' a. Request customer to provide a price match link' ||
' b. Use websearch tool to get the price for that price match link' ||
' c. Ask customer if they want a refund.' ||
' d. Send email notification only if customer accept the refund.' ||
'3. If defective:' ||
' a. Process the defective return",
"tools": ["WebSearch", "Email"]}'
);
END;
/
CREATE_TASK Attributes
Attributes
Attribute Name | Default Value | Description |
---|---|---|
|
- |
A clear, concise statement that describes what the
task should accomplish. This text is included in the prompt sent
to the LLM. You can include a
{query}
placeholder to represent the your natural language input. For
example:
This is a mandatory parameter. |
|
- |
A JSON array of tool names that the agent can use to
complete the task. For example: This is a mandatory parameter. |
|
- |
Identifies other tasks whose outputs should be used as input for this task. Select AI automatically provides these outputs to the LLM. |
ENABLE_TASK Procedure
Use the DBMS_CLOUD_AI_AGENT.ENABLE_TASK
procedure to
enable a previously defined task. This changes the task’s status to
ENABLED
, allowing the agent to use it during processing.
Syntax
DBMS_CLOUD_AI_AGENT.ENABLE_TASK
(
task_name IN VARCHAR2
);
Parameters
Parameter | Description |
---|---|
|
Name for the task to enable. This parameter is mandatory. |
Usage Notes
The task must already exist in the system. This procedure updates the task status, making it available for agent process during reasoning workflows.
Example to Enable a Task
BEGIN
DBMS_CLOUD_AI_AGENT.ENABLE_TASK
(
task_name => 'Return_And_Price_Match'
);
END;
/
DISABLE_TASK Procedure
Use the DBMS_CLOUD_AI_AGENT.DISABLE_TASK
procedure to disable a task
in the current database. This changes the task’s status to DISABLED
,
preventing the agent from using it during processing.
Syntax
DBMS_CLOUD_AI_AGENT.DISABLE_TASK
(
task_name IN VARCHAR2
);
Parameters
Parameter | Description |
---|---|
|
Name of the task to disable. This parameter is mandatory. |
Usage Notes
Disabling a task does not delete it; you can re-enable it later using DBMS_CLOUD_AI_AGENT.ENABLE_TASK
. Once disabled, the
task becomes inactive and the agent no longer considers it during task
selection.
Example
The following example disables an existing task.
BEGIN
DBMS_CLOUD_AI_AGENT.DISABLE_TASK
(
task_name => 'Return_And_Price_Match'
);
END;
/
DROP_TASK Procedure
Use the DBMS_CLOUD_AI_AGENT.DROP_TASK
procedure to remove a
previously defined task from the database. If the task does not exist, you can suppress the
error by setting the force
parameter to TRUE
.
Syntax
DBMS_CLOUD_AI_AGENT.DROP_TASK
(
task_name IN VARCHAR2,
force IN BOOLEAN DEFAULT FALSE
);
Parameters
Parameter | Description |
---|---|
|
Name of the task to drop. This is a mandatory parameter. |
|
If The default value for this parameter is
|
Example
BEGIN
DBMS_CLOUD_AI_AGENT.DROP_TASK
(task_name => 'Return_And_Price_Match');
END;
/
Usage Notes
Use force
to drop a task and ignore errors if the task does not
exist.
CREATE_TOOL Procedure
Use the DBMS_CLOUD_AI_AGENT.CREATE_TOOL
procedure to register a
custom tool that an agent can use during task processing. Each tool is identified by a
unique tool_name
and includes attributes that define its purpose,
implementation logic, and metadata.
The tools can be custom PL/SQL procedures or functions, or built-in tool types such as RAG, SQL, WEBSEARCH, or NOTIFICATION.
Syntax
DBMS_CLOUD_AI_AGENT.CREATE_TOOL
(
tool_name IN VARCHAR2,
attributes IN CLOB,
status IN VARCHAR2 DEFAULT NULL,
description IN CLOB DEFAULT NULL
);
Parameters
Parameter | Description |
---|---|
|
A unique name to identify the tool. This is a mandatory parameter. |
|
Tool attributes in JSON format. See CREATE_TOOL Attributes. This is a mandatory parameter. |
status |
Status of the tool. The default value is |
|
User-defined description to help identify the tool. This value is stored in the database but not sent to the LLM. The default value is NULL. |
Example
The following example creates a tool for to generate an email to the recipient.
BEGIN
DBMS_CLOUD_AI_AGENT.CREATE_TOOL
(
tool_name => 'NOTIFICATION',
attributes => '{"tool_type": "EMAIL"}'
);
END;
/
CREATE_TOOL Attributes
Attributes
Attribute Name | Default Value | Description |
---|---|---|
|
- |
A clear, concise statement that describes what the tool should accomplish and how to do it. This text is included in the prompt sent to the LLM. This is a mandatory parameter. |
|
- |
Specifies the PL/SQL procedure or function to call when the tool is used. This is a mandatory parameter for custom tools. |
|
- |
Specifies a built-in tool type. If set,
The possible values are:
You can create built-in tools with customized names
and parameters. You can also create multiple built-in tools with
same |
|
- |
Specifies parameters for registering built-in tools. |
|
- |
Describes input arguments. Similar to column comments in a table. For example:
|
Prerequisites for Built-In Tool
Perform these steps before you use built-in tools:
RAG Tool
- Create an AI profile that references a vector index. See Select AI with Retrieval Augmented Generation (RAG).
NOTIFICATION Tool
The following are supported: SLACK
and
EMAIL
.
SLACK Tool:
- Set up a Slack application to receive messages from Autonomous Database.
- Create a credential using
DBMS_CLOUD_NOTIFICATION
to send Slack notifications from Autonomous Database. See Send Slack Notifications from Autonomous Database.
EMAIL Tool:
Note:
The email tool sends email notification from OCI.- Identify your SMTP endpoint. For example, select one of the
SMTP endpoints:
smtp.us-phoenix-1.oraclecloud.com smtp.us-ashburn-1.oraclecloud.com smtp.email.uk-london-1.oci.oraclecloud.com smtp.email.eu-frankfurt-1.oci.oraclecloud.com
- Grant SMTP access using an ACL. See Configuring SMTP Connection.
- Generate SMTP credentials for email delivery. The
UTL_SMTP
package uses credentials to authenticate with email delivery servers when you send an email. See Generate SMTP Credentials for a User for more information. - Create approved senders. Complete this step for all email
addresses you use as the
From
address withUTL_SMTP.MAIL
subprogram. See Managing Approved Senders for more information. - Grant SMTP access to the user by adding Access Control Entry (ACE). For more details, see Send Email from Autonomous Database Using DBMS_CLOUD_NOTIFICATION.
HTTP Tool:
Grant network access using ACL to the user-specified endpoint to enable http request:
BEGIN
DBMS_NETWORK_ACL_ADMIN.APPEND_HOST_ACE(
host => 'www.example.com',
ace => xs$ace_type(
privilege_list => xs$name_list('http'),
principal_name => 'ADB_USER',
principal_type => xs_acl.ptype_db
)
);
END;
/
Built-In Tool Types in DBMS_CLOUD_AI_AGENT Package
You can register built-in tools using the tool_type
and
tool_params
attributes.
Tool Type | Description | Mandatory Parameters |
---|---|---|
|
Translates natural language into SQL queries. |
|
|
Performs Retrieval-Augmented Generation through vector search. |
|
|
Sends messages to a Slack channel or sends emails
using SMTP. Available options:
|
When When |
|
Searches information from the web. |
|
ENABLE_TOOL Procedure
Use the DBMS_CLOUD_AI_AGENT.ENABLE_TOOL
procedure to
enable a previously registered tool. This changes the tool's status to
ENABLED
, allowing the agent to use it tasks.
Syntax
DBMS_CLOUD_AI_AGENT.ENABLE_TOOL
(
tool_name IN VARCHAR2
);
Parameters
Parameter | Description |
---|---|
|
Name for the tool to enable. This parameter is mandatory. |
Example
BEGIN
DBMS_CLOUD_AI_AGENT.ENABLE_TOOL
(
tool_name => 'SQL'
);
END;
/
DISABLE_TOOL Procedure
Use the DBMS_CLOUD_AI_AGENT.DISABLE_TOOL
procedure to disable a
registered tool. This changes the tool's status to DISABLED
, preventing the
agent from using it in tasks.
Syntax
DBMS_CLOUD_AI_AGENT.DISABLE_TOOL
(
tool_name IN VARCHAR2
);
Parameters
Parameter | Description |
---|---|
|
Name of the tool to disable. This parameter is mandatory. |
Example
The following example disables an existing tool.
BEGIN
DBMS_CLOUD_AI_AGENT.DISABLE_TOOL
(
tool_name => 'SQL'
);
END;
/
DROP_TOOL Procedure
Use the DBMS_CLOUD_AI_AGENT.DROP_TOOL
procedure to remove a
previously registered tool with the agent. If the task does not exist, you can suppress the
error by setting the force
parameter to TRUE
.
Syntax
DBMS_CLOUD_AI_AGENT.DROP_TOOL
(
tool_name IN VARCHAR2,
force IN BOOLEAN DEFAULT FALSE
);
Parameters
Parameter | Description |
---|---|
|
Name of the tool to drop. This is a mandatory parameter. |
|
If The default value for this parameter is
|
Example
BEGIN
DBMS_CLOUD_AI_AGENT.DROP_TOOL
(tool_name => 'SQL');
END;
/
Usage Notes
Use force
to drop a tool and ignore errors if the tool
does not exist.
CREATE_TEAM Procedure
Use the DBMS_CLOUD_AI_AGENT.CREATE_TEAM
procedure to define a team of
AI agents that work together to accomplish tasks. You specify agents and their associated
tasks, along with how the tasks should be processed.
Syntax
DBMS_CLOUD_AI_AGENT.CREATE_TEAM
(
team_name IN VARCHAR2,
attributes IN CLOB,
status IN VARCHAR2 DEFAULT NULL,
description IN CLOB DEFAULT NULL
);
Parameters
Parameter | Description |
---|---|
|
A unique name to identify the AI agent team. This is a mandatory parameter. |
|
JSON-formatted string defining team attributes such as agents and process. See CREATE_TEAM Attributes. This is a mandatory parameter. |
status |
Status of the team. The default value is |
|
User-defined description to identify the team's purpose. This value is stored in the database but not sent to the LLM. The default value is NULL. |
Example
The following example creates an agent team to process a customer's product return.
BEGIN
DBMS_CLOUD_AI_AGENT.CREATE_TEAM
(
team_name => 'ReturnAgency',
attributes => '{"agents": [{"name":"Customer_Return_Agent","task" : "Return_And_Price_Match"}],
"process": "sequential"}');
END;
/
CREATE_TEAM Attributes
team_name
and uses a set of
attributes to define its structure and execution strategy.
Attributes
Attribute Name | Default Value | Description |
---|---|---|
|
- |
Specifies JSON array listing agents and their corresponding tasks. An agent can be assigned to multiple tasks using the same name. This is a mandatory parameter. Example:
|
|
- |
Specifies how tasks are run. Use
|
SET_TEAM Function
Use DBMS_CLOUD_AI_AGENT.SET_TEAM
to specify the AI agent team for
the current session.
Once a team is set, only the select ai agent
action is
enabled, the system does not support other Select AI actions.
Syntax
DBMS_CLOUD_AI_AGENT.SET_TEAM
(
team_name IN VARCHAR2,
);
Parameters
Parameter | Description |
---|---|
|
Specifies the name of the AI Agent team to use in the current session. The team must already exist in the system. This parameter is mandatory. |
Example
The following example sets the user-specified AI agent team in the current session.
EXEC DBMS_CLOUD_AI_AGENT.SET_TEAM
('ReturnAgency');
GET_TEAM Function
Use DBMS_CLOUD_AI_AGENT.GET_TEAM
to return the AI agent team for
the current session.
Syntax
DBMS_CLOUD_AI_AGENT.GET_TEAM
RETURN VARCHAR2;
Example
The following example returns the AI agent team in the current session.
SELECT DBMS_CLOUD_AI_AGENT.GET_TEAM
from DUAL;
CLEAR_TEAM Function
Use DBMS_CLOUD_AI_AGENT.CLEAR_TEAM
to clear the AI agent team set
in the current session. This procedure does not drop the team.
Syntax
DBMS_CLOUD_AI_AGENT.CLEAR_TEAM
;
Example
The following example clears the AI agent team in the current session.
BEGIN
DBMS_CLOUD_AI_AGENT.CLEAR_TEAM
;
END;
/
RUN_TEAM Function
Use DBMS_CLOUD_AI_AGENT.RUN_TEAM
to start a new AI agent team or
resume a paused one that is waiting for human input. If you provide an existing process ID
and the associated team process is in the WAITING_FOR_HUMAN
state, the
function resumes the workflow using the input you provide as the human response.
Syntax
DBMS_CLOUD_AI_AGENT.RUN_TEAM
(
team_name IN VARCHAR2,
user_prompt IN CLOB DEFAULT NULL,
params IN CLOB DEFAULT NULL,
);
Parameters
Parameter | Description |
---|---|
|
Specifies the name of the AI Agent team to use in the current session. The team must already exist in the system. This parameter is mandatory. |
|
Specifies the user query or response provided to the task. If the task is in the If the task is in the
|
|
Specifies customized parameters used during AI agent
team process. Supported parameters include:
|
Example
The following example runs the user-specified AI agent team in the current session.
l_final_answer := DBMS_CLOUD_AI_AGENT.RUN_TEAM
(
team_name => 'ReturnAgency',
user_prompt => 'I want to return computer desk chair',
params => '{"conversation_id": "' ||l_conversation_id || '"}'
);
ENABLE_TEAM Procedure
Use the DBMS_CLOUD_AI_AGENT.ENABLE_TEAM
procedure to
enable a user-specified AI agent team. This changes the team's status to
ENABLED
.
Syntax
DBMS_CLOUD_AI_AGENT.ENABLE_TEAM
(
team_name IN VARCHAR2
);
Parameters
Parameter | Description |
---|---|
|
Name for the AI agent team to enable. This parameter is mandatory. |
Example
The following example enables a user-specified AI agent team.
BEGIN
DBMS_CLOUD_AI_AGENT.ENABLE_TEAM
(
team_name => 'ReturnAgency'
);
END;
/
DISABLE_TEAM Procedure
Use the DBMS_CLOUD_AI_AGENT.DISABLE_TEAM
procedure to disable an
existing AI agent team. This changes the team's status to
DISABLED
.
Syntax
DBMS_CLOUD_AI_AGENT.DISABLE_TEAM
(
team_name IN VARCHAR2
);
Parameters
Parameter | Description |
---|---|
|
Name of the AI agent team to disable. This parameter is mandatory. |
Example
The following example disables an existing AI agent team.
BEGIN
DBMS_CLOUD_AI_AGENT.DISABLE_TEAM
(
team_name => 'ReturnAgency'
);
END;
/
DROP_TEAM Procedure
Use the DBMS_CLOUD_AI_AGENT.DROP_TEAM
procedure to remove a
previously created AI agent team.
Syntax
DBMS_CLOUD_AI_AGENT.DROP_TEAM
(
team_name IN VARCHAR2,
force IN BOOLEAN DEFAULT FALSE
);
Parameters
Parameter | Description |
---|---|
|
Name of the team to drop. This is a mandatory parameter. |
|
If The default value for this parameter is
|
Example
BEGIN
DBMS_CLOUD_AI_AGENT.DROP_TEAM
(team_name => 'ReturnAgency');
END;
/
Usage Notes
Use force
to drop a team and ignore errors if the team
does not exist.