Security for A2A Server
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 row access based on A2A request context. For authenticated A2A requests, the A2A_AGENT_ACCESS_CONTEXT$ application context provides:
SYS_CONTEXT('A2A_AGENT_ACCESS_CONTEXT$', 'USER_IDENTITY')
SYS_CONTEXT('A2A_AGENT_ACCESS_CONTEXT$', 'TEAM_NAME')
USER_IDENTITY identifies the database user associated with the request. TEAM_NAME identifies the Select AI agent team handling it. A VPD policy can use either value to filter rows when SQL accesses a protected object.
A team-only predicate applies to every caller using that team; it does not distinguish callers within the team. To enforce per-user row access, include USER_IDENTITY in the predicate and compare it with the appropriate user or ownership mapping in your data.
A2A uses OAuth for server authentication and database credentials for user identity. See A2A Concepts.
The following example restricts HR.EMPLOYEES queries to one agent team:
-- Define the VPD policy function
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 the policy to SELECT statements on the table
BEGIN
DBMS_RLS.ADD_POLICY(
object_schema => 'HR',
object_name => 'EMPLOYEES',
policy_name => 'POL',
policy_function => 'LIMIT_ACCESS',
statement_types => 'SELECT'
);
END;
/
This example applies the policy to SELECT statements only. If the policy must also cover writes, specify the required statement types and configure update_check => TRUE when inserts or updates must be checked. For more information, see DBMS_RLS.ADD_POLICY and SYS_CONTEXT.
Audit Trail
A2A agent activity is recorded in the unified audit trail through an Oracle-managed audit policy. Custom unified audit policies can capture selected database actions, such as SELECT on a table, when their conditions match the A2A request context.
The unified audit trail records audited database activity; do not treat it as a complete transcript of every A2A prompt and response. Review which events and fields your policies capture.
Example: Create an Audit Policy
The following example creates and enables a custom audit policy for SELECT actions on HR.EMPLOYEES for the REPORT_SUMMARY_AGENT_TEAM agent team. In the condition, TEAM_NAME is the context attribute; replace only the compared team value with your team’s name. EVALUATE PER STATEMENT evaluates the condition for each auditable statement.
CREATE AUDIT POLICY MY_A2A_AGENT_ACCESS_AUDIT_POLICY
ACTIONS SELECT ON HR.EMPLOYEES
WHEN 'SYS_CONTEXT(''A2A_AGENT_ACCESS_CONTEXT$'', ''TEAM_NAME'') = ''REPORT_SUMMARY_AGENT_TEAM'''
EVALUATE PER STATEMENT;
AUDIT POLICY MY_A2A_AGENT_ACCESS_AUDIT_POLICY;
CREATE AUDIT POLICY defines the policy; AUDIT POLICY enables it. When you run AUDIT POLICY MY_A2A_AGENT_ACCESS_AUDIT_POLICY, the policy becomes active immediately in the current session and other active sessions. Users do not need to reconnect. Subsequent audited operations that match the policy generate audit records. See About Enabling Unified Audit Policies.
The condition SYS_CONTEXT('A2A_AGENT_ACCESS_CONTEXT$', 'TEAM_NAME') IS NOT NULL would match requests from any team. Use it only when that broader scope is intended. For more information, see CREATE AUDIT POLICY (Unified Auditing) and AUDIT (Unified Auditing).
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;
AUDIT CONTEXT configures which application-context attributes are captured in audit records. These settings are loaded when a database session starts. Changes apply to subsequent database sessions and do not update the settings already loaded in an active session. See About Auditing Application Context Values.
For A2A, the service establishes a new database session for each request. Therefore, changes made with AUDIT CONTEXT apply starting with the next A2A request. This timing concerns the capture of context values; it does not delay audit-policy enablement.
Query the trail to review records for the custom policy:
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;
APPLICATION_CONTEXTS shows configured and captured application-context values. Autonomous AI Database retains audit information for up to 14 days before automatic purging. For longer retention, use an appropriate retention or archival solution such as Oracle Data Safe. See Auditing Overview on Autonomous AI Database.
Network Configuration for Private Endpoint
When using the private endpoint hostname, the A2A endpoint is reachable through the VCN configured for the private endpoint or through private network connectivity to that VCN. A client in another cloud or external environment needs an appropriate private network path, such as VPN connectivity.
The private endpoint URL format is:
https://{hostname_prefix}.adb.{region-identifier}.oraclecloudapps.com/adb/a2a/v1/{database-ocid}
hostname_prefix: Value defined or generated during private endpoint setup.region-identifier: Oracle Cloud region.database-ocid: OCID of the Autonomous AI Database.
Retrieve the hostname_prefix from the database details page in the OCI Console. See Private Endpoint Access for more details.
For Google Gemini Enterprise or another external client, follow that platform’s private networking guidance. See Multi-agent private networking patterns in Google Cloud for a Google Cloud example.
If public access is separately enabled, use the corresponding public access URL and its network access controls; this does not make the private hostname publicly reachable. See Manage Autonomous AI Database Built-in Tools.
Recommendations
-
Define
object_listwith only the database objects required by the agent. Setenforce_object_listtotruewhen you want Select AI to restrict SQL generation to the listed objects. This profile setting complements database privileges and VPD; it does not replace them or constrain other tools that have broader database privileges. See Restrict Table Access in an AI Profile. -
A two-schema approach can separate agent development from supporting application code. For example, use
A2A_USERfor agent objects andSALES_USERfor PL/SQL functions and application objects. The separation alone does not enforce isolation: grant only the required object and execution privileges between schemas.
Service Scope Note
Enabling the Autonomous AI Database MCP Server or A2A Server does not provision separate VMs. These capabilities use the database’s existing compute allocation. Resource consumption depends on tool execution for MCP or agent operations for A2A.