Security
Control access to data that the A2A agents use by applying security policies and auditing mechanisms.
VPD Policy
Use Virtual Private Database (VPD) policies to enforce fine-grained access control based on agent context. The VPD policies enable you to control row access to database objects that A2A agents use. While processing an authenticated A2A request, Select AI sets values in the A2A_AGENT_ACCESS_CONTEXT$ application context. The USER_IDENTITY attribute identifies the database user associated with the request. The TEAM_NAME attribute identifies the Select AI agent team handling the request. A VPD policy can use these values to control which rows an agent can access. For more information, see Using Oracle Virtual Private Database to Control Data Access.
For example, the policy in the example adds a team-name condition to queries on HR.EMPLOYEES. It returns rows only when the request uses the REPORT_SUMMARY_AGENT_TEAM team. This condition restricts access by team name, not by login user. To restrict access by database user, define a policy predicate that checks USER_IDENTITY. Replace the team name and table details with values for your environment.
Available context values:
SYS_CONTEXT('A2A_AGENT_ACCESS_CONTEXT$', 'USER_IDENTITY')
SYS_CONTEXT('A2A_AGENT_ACCESS_CONTEXT$', 'TEAM_NAME')Example: Define and Apply a VPD Policy
-- Define VPD policy
CREATE OR REPLACE FUNCTION limit_access (v_schema IN VARCHAR2, v_objname IN VARCHAR2)
RETURN VARCHAR2 authid current_user AS
BEGIN
RETURN 'SYS_CONTEXT(''A2A_AGENT_ACCESS_CONTEXT$'', ''TEAM_NAME'') = ''REPORT_SUMMARY_AGENT_TEAM''';
END;
-- Apply policy on table
BEGIN
DBMS_RLS.ADD_POLICY(
object_schema => 'HR',
object_name => 'EMPLOYEES',
policy_name => 'POL',
policy_function => 'LIMIT_ACCESS');
END;
/For more information, see DBMS_RLS and SYS_CONTEXT.
Audit Trail
Select AI records A2A agent access in the unified audit trail through an Oracle-managed audit policy. This default auditing does not require you to create a custom audit policy for each team. A custom policy adds auditing for selected database actions, such as SELECT actions on a table, when its conditions match the A2A request context. The audit trail for Autonomous AI Database is available through UNIFIED_AUDIT_TRAIL view, which you can query to review audited activity.
You can define custom audit policies that use the A2A_AGENT_ACCESS_CONTEXT$ application context to audit access for a specific Select AI agent team. In the expression SYS_CONTEXT('A2A_AGENT_ACCESS_CONTEXT$', 'TEAM_NAME'), TEAM_NAME is the context attribute name. Do not replace TEAM_NAME. Replace only the compared value, such as 'REPORT_SUMMARY_AGENT_TEAM', with your agent team name. Your policy compares that context value to your actual agent team name, for example:
SYS_CONTEXT('A2A_AGENT_ACCESS_CONTEXT$', 'TEAM_NAME') =
'REPORT_SUMMARY_AGENT_TEAM'SYS_CONTEXT returns the value of the named attribute from the application context, and Oracle application context is commonly used with security and policy enforcement features such as VPD and unified auditing.
The following example creates a policy for SELECT actions on HR.EMPLOYEES whenever an A2A request supplies a team name. Because the condition checks only that TEAM_NAME is not null, it can match requests from any team. To audit one specific team, compare TEAM_NAME with that team’s name, as shown above.
Example: Create an Audit Policy
create audit policy MY_A2A_AGENT_ACCESS_AUDIT_POLICY
actions SELECT on HR.EMPLOYEES
when sys_context('A2A_AGENT_ACCESS_CONTEXT$', 'TEAM_NAME') is not null;After you create the custom audit policy, enable it with the AUDIT POLICY statement:
AUDIT POLICY MY_A2A_AGENT_ACCESS_AUDIT_POLICY;Oracle evaluates the policy for matching operations and writes unified audit records for the activity that satisfies the policy conditions. Those records then appear in UNIFIED_AUDIT_TRAIL. A unified audit policy takes effect in the next user session for the users being audited. Access to the audit logs depends on database privileges and security configuration. For more information, see CREATE AUDIT POLICY (Unified Auditing) and AUDIT (Unified Auditing).
The policy condition filters actions by team, but it does not add the context values to the audit record. To include USER_IDENTITY and TEAM_NAME in audit records, configure application-context auditing:
AUDIT CONTEXT NAMESPACE A2A_AGENT_ACCESS_CONTEXT$
ATTRIBUTES USER_IDENTITY, TEAM_NAME;Then query UNIFIED_AUDIT_TRAIL to review matching records and their captured context values:
SELECT event_timestamp,
dbusername,
action_name,
object_schema,
object_name,
unified_audit_policies,
application_contexts
FROM unified_audit_trail
WHERE INSTR(unified_audit_policies,
'MY_A2A_AGENT_ACCESS_AUDIT_POLICY') > 0
ORDER BY event_timestamp DESC;Network Configuration for Private Endpoint
If the database uses a Private Endpoint, the A2A server endpoint is accessible only from the configured Virtual Cloud Network (VCN). External clients outside the VCN cannot connect.
Endpoint format:
https://{hostname_prefix}.adb.{region-identifier}.oraclecloudapps.com/adb/a2a/v1/{database-ocid}- Note
-
hostname_prefix: Value defined or generated during private endpoint setup. -
region-identifier: Oracle Cloud region. -
database-ocid: OCID of the Autonomous AI Database. Note: Ensure that the client accessing the A2A server is deployed within the same VCN or has network connectivity, for example, VPN.
Retrieve the hostname_prefix from the database details page in the OCI Console.
See Private Endpoint Access for more details.
You can use the A2A Agent with a private endpoint-enabled Autonomous AI Database only when the A2A client agent runs in the same private VCN or has network connectivity to the database. If the A2A client agent runs in another cloud or an external environment, configure the network according to the connectivity guidelines for that platform to enable communication with Autonomous AI Database.
For example, when you configure a Google Gemini Enterprise application, follow Google’s private networking guidance. See Multi-agent private networking patterns in Google Cloud for details.
Note
Note: Enabling the Autonomous AI Database MCP Server or Agent2Agent (A2A) Server does not provision additional compute resources such as separate VMs. These capabilities are included as part of Autonomous AI Database, using your current compute allocation. Resource consumption is determined by the running of tools (for MCP) or agent operations (for A2A) within the existing database environment.
Recommendations
-
Define
object_listin the Select AI profile with required database objects only. See Profile Attributes and Example: Create a Movie Analysis Agent with Built-In Tools for more details. -
Two-schema approach: This approach is primarily for organizing and securing Select AI Agent development, not for A2A-specific configuration.
-
Use one schema, for example
A2A_USER, for Select AI agent objects such as agents, agent teams, tasks, and tools. -
Use a separate schema, for example
SALES_USER, for PL/SQL functions and other application objects that support those agents.
-