External AI Embedding with @AISERVICE

Oracle GoldenGate provides the @AISERVICE function to invoke external AI services directly within the replication pipeline. This enables real-time enrichment—such as embedding generation, classification, or summarization—without requiring custom middleware. By calling managed AI endpoints during Replicat processing, organizations can integrate cloud-based or custom AI services seamlessly into data movement workflows.

@AISERVICE allows Replicat to call an external AI endpoint (for example, REST-based embedding service) and use the response to populate target columns. Unlike @DBFUNCTION, which executes logic inside the database, @AISERVICE offloads computation to external services, making it ideal for GPU-backed models or centralized AI platforms.

The following example demonstrates generating embeddings using an external AI service during replication:

MAP cust_addresses, TARGET cust_addresses_vector,
COLMAP (
  USEDEFAULTS,
  address_vector = @AISERVICE(
    SERVICE 'embedding_service_alias',
    PARAMS (
      'street' = @AFTER.street,
      'city'   = @AFTER.city,
      'zip'    = @AFTER.zip
    ),
    RETURN 'vector'
  )
);

In this configuration:

@AISERVICE Best Practices

To effectively leverage @AISERVICE within Oracle GoldenGate, organizations should follow a set of best practices to ensure performance, reliability, and scalability of real-time AI pipelines. Because @AISERVICE introduces an external dependency into the replication path, careful design is required to avoid bottlenecks and ensure consistent data processing.

Use @AISERVICE for compute-intensive models to avoid overloading database resources.

@AISERVICE should be used for compute-intensive AI workloads—such as large language model inference or high-dimensional embedding generation—where offloading to GPU-backed or managed AI services provides better scalability than in-database execution. This helps preserve database resources for core transactional and query workloads.

Ensure low-latency, highly available AI endpoints to prevent replication lag

The external AI service must be highly available and low latency. Since Replicat processing depends on the response from the service, slow or unreliable endpoints can introduce replication lag or backpressure. Deploying AI services in close network proximity (for example, same region or VCN) and using load balancing can significantly improve performance.

Implement timeout and retry policies for service calls

Robust error handling and retry mechanisms should be implemented. Transient failures—such as network timeouts or service throttling—should not disrupt replication. Configurations should include timeouts, retry policies, and fallback handling (for example, routing failed records to a dead-letter queue for later processing).

Cache or deduplicate requests when possible, to reduce external calls

Organizations should minimize unnecessary external calls by implementing de-duplication or caching strategies where applicable. For example, identical input text can reuse previously generated embeddings, reducing cost and latency.

Monitor service latency and error rates alongside GoldenGate metrics to ensure SLAs are met

Comprehensive monitoring is essential. Teams should track AI service latency, error rates, and throughput alongside GoldenGate replication metrics such as lag and apply rate. Correlating these metrics enables faster troubleshooting and ensures that the integration between GoldenGate and external AI services remains performant and reliable.