Interface Agent
A Select AI agent is a database-side resource managed by the
DBMS_CLOUD_AI_AGENT PL/SQL package. Agents can use a configured
Select AI profile and may participate in task, tool, and team orchestration.
An Agent instance can represent an existing database agent or be
configured for creation. The name-only SelectAIAgent.agent(String)
factory verifies that the agent exists and loads its metadata and attributes
before returning. SelectAIAgent.listAgents() also returns handles with
loaded metadata and attributes. A handle configured for creation is obtained with
SelectAIAgent.agent(String, AgentAttributes, String, AgentStatus).
A creation-configured handle retains its supplied attributes, description,
and status without querying the database. Only such a handle can call
create(); after creation succeeds, it becomes database-backed.
enable(), disable(), and drop(boolean) require an
existing agent and operate on the database-side resource.
Before creation, getStatus() and getAgentAttributes() return
the configured values. For a database-backed handle, each call to either
method queries the database. getStatus() does not change the
description returned by getDescription(). The description is
supplied or loaded when the handle is initialized; getDescription()
does not query the database.
Agent names and a non-null attributes object are checked locally. Required
values within AgentAttributes, including the profile name and role,
are validated by the database during create(). Loading metadata
and executing lifecycle operations require database access and privileges.
For a complete runnable example, see CreateAgentSample source.
- Since:
- 1.1.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbooleancreate()Creates this creation-configured agent in the database.booleandisable()Disables this database-backed agent.booleandrop(boolean force) Drops this database-backed agent.booleanenable()Enables this database-backed agent.Returns agent attributes for this handle.Returns the database-reported name for a loaded agent, or the configured name before creation.Returns the description supplied or loaded when this handle was initialized.Returns the configured status before creation or the current database status for an existing agent.booleansetAttribute(String attributeName, boolean attributeValue) Updates one boolean agent attribute in the database.booleansetAttribute(String attributeName, Float attributeValue) Updates one floating-point agent attribute in the database.booleansetAttribute(String attributeName, Integer attributeValue) Updates one integer agent attribute in the database.booleansetAttribute(String attributeName, String attributeValue) Updates one agent attribute in the database.booleansetAttributes(AgentAttributes agentAttributes) Updates multiple agent attributes in one database operation.
-
Method Details
-
create
Creates this creation-configured agent in the database. For a runnable example, see CreateAgentSample source.- Returns:
truewhen the database creates the agent- Throws:
IllegalStateException- when this handle was loaded from an existing agentSelectAIException- when the database rejects or cannot complete the operation
-
enable
Enables this database-backed agent. For a runnable example, see EnableAgentSample source.- Returns:
truewhen the database enables the agent- Throws:
IllegalStateException- when this agent has not been createdSelectAIException- when the database operation fails
-
disable
Disables this database-backed agent. For a runnable example, see DisableAgentSample source.- Returns:
truewhen the database disables the agent- Throws:
IllegalStateException- when this agent has not been createdSelectAIException- when the database operation fails
-
drop
Drops this database-backed agent. Whenforceistrue, the operation may be retried after the handle has already been dropped; the database force-drop semantics determine the result. For a runnable example, see DropAgentSample source.- Parameters:
force- database force-drop option- Returns:
truewhen the drop completes- Throws:
IllegalStateException- whenforceisfalseand this agent has not been createdSelectAIException- when the database operation fails
-
setAttribute
Updates one agent attribute in the database.The database validates the attribute name and value for the selected database release. A
nullstring value is passed to the database as SQLNULL; whether that clears an attribute is database-defined.- Parameters:
attributeName- database agent attribute nameattributeValue- string value, ornullwhere supported- Returns:
truewhen the update succeeds- Throws:
IllegalArgumentException- whenattributeNameis null or blankIllegalStateException- when this agent has not been createdSelectAIException- when the database update fails- See Also:
-
setAttribute
Updates one boolean agent attribute in the database. For a runnable example, see SetAgentAttributeSample source.- Parameters:
attributeName- database agent attribute nameattributeValue- boolean value- Returns:
truewhen the update succeeds- Throws:
IllegalArgumentException- whenattributeNameis null or blankIllegalStateException- when this agent has not been createdSelectAIException- when the database update fails
-
setAttribute
Updates one integer agent attribute in the database. For a runnable example, see SetAgentAttributeSample source.- Parameters:
attributeName- database agent attribute nameattributeValue- integer value- Returns:
truewhen the update succeeds- Throws:
IllegalArgumentException- whenattributeNameis null or blank, orattributeValueis nullIllegalStateException- when this agent has not been createdSelectAIException- when the database update fails
-
setAttribute
Updates one floating-point agent attribute in the database. For a runnable example, see SetAgentAttributeSample source.- Parameters:
attributeName- database agent attribute nameattributeValue- floating-point value- Returns:
truewhen the update succeeds- Throws:
IllegalArgumentException- whenattributeNameis null or blank, orattributeValueis nullIllegalStateException- when this agent has not been createdSelectAIException- when the database update fails
-
setAttributes
Updates multiple agent attributes in one database operation. For a runnable example, see SetAgentAttributesSample source.The payload is serialized as the JSON document accepted by
DBMS_CLOUD_AI_AGENT.SET_ATTRIBUTES. Values omitted from the payload are handled according to the database package semantics.- Parameters:
agentAttributes- agent attributes to update- Returns:
truewhen the update succeeds- Throws:
IllegalArgumentException- whenagentAttributesis nullIllegalStateException- when this agent has not been createdSelectAIException- when the database update fails
-
getAgentName
Returns the database-reported name for a loaded agent, or the configured name before creation. This method does not access the database. For a runnable example, see LoadAgentSample source.- Returns:
- configured or database-reported agent name
-
getDescription
Returns the description supplied or loaded when this handle was initialized. This method does not access the database and the value is not changed bygetStatus(). For a runnable example, see LoadAgentSample source.- Returns:
- supplied or loaded agent description, or
nullwhen absent
-
getStatus
Returns the configured status before creation or the current database status for an existing agent. A pending agent with no configured status returnsnull. This method does not change the description. For a runnable example, see LoadAgentSample source.- Returns:
- configured or current agent status
- Throws:
SelectAIException- when current agent metadata cannot be fetched
-
getAgentAttributes
Returns agent attributes for this handle.For a database-backed agent, this method reloads the attributes from the database on each call and therefore can fail if the resource was deleted. For a creation-configured agent, it returns the configured attributes without querying the database. For a runnable example, see LoadAgentSample source.
- Returns:
- current agent attributes for an existing agent, or configured attributes for an agent pending creation
- Throws:
SelectAIException- when the agent no longer exists or current attributes cannot be fetched
-