name: oracle-fusion-ai
description: Oracle Fusion Cloud AI and OCI Generative AI integration patterns. Use when connecting AI agents to Oracle ERP, HCM, SCM via REST APIs, or using Oracle's 50+ pre-built AI agents for finance, HR, and supply chain.
tags: [oracle, erp, fusion, oci]
Oracle Fusion Cloud AI Integration
Connect AI agents to Oracle Fusion Cloud applications (ERP, HCM, SCM) using REST APIs, and leverage Oracle's 50+ pre-built AI agents for enterprise workflows.
When to Use
- Querying or updating Oracle Fusion Cloud data (finance, HR, supply chain) from AI agents
- Understanding Oracle's 50+ pre-built AI agents for ERP, HCM, SCM
- Integrating external LLMs (Claude, GPT, Gemini) with Oracle data via REST APIs
- Using OCI Generative AI Service with Cohere or Llama models
Oracle's Pre-Built AI Agents (50+)
| Domain |
Agents |
| Finance/ERP |
Invoice processing, cash forecasting, journal anomaly detection, expense audit, financial close |
| HCM |
Recruiting, learning recommendations, workforce planning, benefits advisor, performance review |
| SCM |
Demand forecasting, supply chain risk, order management, inventory optimization |
| CX |
Service agent, sales assistant |
OCI Generative AI -- Supported Models
| Provider |
Models |
| Cohere |
Command R, Command R+ (Oracle's primary LLM partner) |
| Meta |
Llama 3, Llama 3.1 (70B, 8B) |
| Note |
No native Claude, GPT-4, or Gemini. Use API Gateway for external LLMs |
Patterns
1. Oracle Fusion Cloud REST API
import requests
class OracleFusionClient:
def __init__(self, base_url: str, username: str, password: str):
self.base_url = base_url.rstrip("/")
self.auth = (username, password)
self.headers = {"Content-Type": "application/json", "REST-Framework-Version": "4"}
def _get(self, path: str, params: dict = None) -> dict:
response = requests.get(
f"{self.base_url}{path}",
auth=self.auth, headers=self.headers, params=params,
)
response.raise_for_status()
return response.json()
# --- Financials ---
def get_gl_balances(self, ledger_id: str, period: str) -> list[dict]:
return self._get(
"/fscmRestApi/resources/11.13.18.05/ledgerBalances",
params={"q": f"LedgerId={ledger_id};AccountingPeriod={period}", "limit": 100},
).get("items", [])
def get_invoices(self, supplier: str = "", limit: int = 25) -> list[dict]:
params = {"limit": limit}
if supplier:
params["q"] = f"VendorName LIKE '{supplier}%'"
return self._get("/fscmRestApi/resources/11.13.18.05/invoices", params).get("items", [])
# --- HCM ---
def search_employees(self, name: str) -> list[dict]:
return self._get(
"/hcmRestApi/resources/11.13.18.05/emps",
params={"q": f"DisplayName LIKE '{name}%'", "limit": 20},
).get("items", [])
def get_employee(self, person_id: str) -> dict:
return self._get(f"/hcmRestApi/resources/11.13.18.05/emps/{person_id}")
# --- Supply Chain ---
def get_purchase_orders(self, status: str = "OPEN", limit: int = 25) -> list[dict]:
return self._get(
"/fscmRestApi/resources/11.13.18.05/purchaseOrders",
params={"q": f"Status='{status}'", "limit": limit},
).get("items", [])
def get_inventory(self, item: str, org_id: str) -> list[dict]:
return self._get(
"/fscmRestApi/resources/11.13.18.05/inventoryOnhand",
params={"q": f"ItemNumber='{item}';OrganizationId={org_id}"},
).get("items", [])
2. OCI Generative AI Service
import oci
config = oci.config.from_file()
generative_ai = oci.generative_ai_inference.GenerativeAiInferenceClient(config)
def generate_with_cohere(prompt: str) -> str:
"""Generate text using OCI Generative AI (Cohere Command R+)."""
response = generative_ai.chat(
oci.generative_ai_inference.models.ChatDetails(
compartment_id="ocid1.compartment.oc1...",
serving_mode=oci.generative_ai_inference.models.OnDemandServingMode(
model_id="cohere.command-r-plus",
),
chat_request=oci.generative_ai_inference.models.CohereChatRequest(
message=prompt,
max_tokens=1024,
temperature=0.1,
),
)
)
return response.data.chat_response.text
3. External LLM Integration via OCI API Gateway
# For using Claude, GPT-4, or Gemini with Oracle data,
# route through OCI API Gateway or Oracle Integration Cloud (OIC)
import requests
def query_oracle_with_claude(question: str, oracle_data: dict) -> str:
"""Use Claude (via Bedrock or direct) to analyze Oracle data."""
import anthropic
client = anthropic.Anthropic()
response = client.messages.create(
model="claude-sonnet-4-5-20250929",
max_tokens=1024,
messages=[{
"role": "user",
"content": f"""Analyze this Oracle ERP data and answer the question.
Data: {oracle_data}
Question: {question}"""
}],
)
return response.content[0].text
4. Oracle APEX AI Integration
-- Oracle APEX AI Assistant: generate SQL from natural language
-- Available in APEX 24.1+
DECLARE
l_response CLOB;
BEGIN
l_response := APEX_AI.GENERATE(
p_prompt => 'List all overdue invoices over $10,000',
p_model => 'OCI_GENAI_COHERE',
p_system_prompt => 'Generate Oracle SQL for the AP schema. Tables: AP_INVOICES_ALL, AP_INVOICE_LINES_ALL.'
);
DBMS_OUTPUT.PUT_LINE(l_response);
END;
Anti-Patterns
- Using OCI GenAI exclusively when Claude/GPT are needed -- Oracle's model selection is limited
- Direct database queries bypassing Fusion REST APIs -- always use REST APIs for application data
- Hardcoding Oracle credentials -- use OCI Vault or Oracle Credential Store
- Ignoring Oracle's data security policies -- Fusion enforces row-level security via business units
- Skipping pagination -- Oracle REST APIs use offset/limit; always handle multi-page results
References
1---2name: oracle-fusion-ai3description: <!-- AUTO-GENERATED by export-skills.py — DO NOT EDIT -->4---5<!-- AUTO-GENERATED by export-skills.py — DO NOT EDIT -->6---7name: oracle-fusion-ai8description: Oracle Fusion Cloud AI and OCI Generative AI integration patterns. Use when connecting AI agents to Oracle ERP, HCM, SCM via REST APIs, or using Oracle's 50+ pre-built AI agents for finance, HR, and supply chain.9tags: [oracle, erp, fusion, oci]10---1112# Oracle Fusion Cloud AI Integration1314Connect AI agents to Oracle Fusion Cloud applications (ERP, HCM, SCM) using REST APIs, and leverage Oracle's 50+ pre-built AI agents for enterprise workflows.1516## When to Use1718- Querying or updating Oracle Fusion Cloud data (finance, HR, supply chain) from AI agents19- Understanding Oracle's 50+ pre-built AI agents for ERP, HCM, SCM20- Integrating external LLMs (Claude, GPT, Gemini) with Oracle data via REST APIs21- Using OCI Generative AI Service with Cohere or Llama models2223## Oracle's Pre-Built AI Agents (50+)2425| Domain | Agents |26|---|---|27| **Finance/ERP** | Invoice processing, cash forecasting, journal anomaly detection, expense audit, financial close |28| **HCM** | Recruiting, learning recommendations, workforce planning, benefits advisor, performance review |29| **SCM** | Demand forecasting, supply chain risk, order management, inventory optimization |30| **CX** | Service agent, sales assistant |3132## OCI Generative AI -- Supported Models3334| Provider | Models |35|---|---|36| **Cohere** | Command R, Command R+ (Oracle's primary LLM partner) |37| **Meta** | Llama 3, Llama 3.1 (70B, 8B) |38| **Note** | No native Claude, GPT-4, or Gemini. Use API Gateway for external LLMs |3940## Patterns4142### 1. Oracle Fusion Cloud REST API4344```python45import requests4647class OracleFusionClient:48 def __init__(self, base_url: str, username: str, password: str):49 self.base_url = base_url.rstrip("/")50 self.auth = (username, password)51 self.headers = {"Content-Type": "application/json", "REST-Framework-Version": "4"}5253 def _get(self, path: str, params: dict = None) -> dict:54 response = requests.get(55 f"{self.base_url}{path}",56 auth=self.auth, headers=self.headers, params=params,57 )58 response.raise_for_status()59 return response.json()6061 # --- Financials ---62 def get_gl_balances(self, ledger_id: str, period: str) -> list[dict]:63 return self._get(64 "/fscmRestApi/resources/11.13.18.05/ledgerBalances",65 params={"q": f"LedgerId={ledger_id};AccountingPeriod={period}", "limit": 100},66 ).get("items", [])6768 def get_invoices(self, supplier: str = "", limit: int = 25) -> list[dict]:69 params = {"limit": limit}70 if supplier:71 params["q"] = f"VendorName LIKE '{supplier}%'"72 return self._get("/fscmRestApi/resources/11.13.18.05/invoices", params).get("items", [])7374 # --- HCM ---75 def search_employees(self, name: str) -> list[dict]:76 return self._get(77 "/hcmRestApi/resources/11.13.18.05/emps",78 params={"q": f"DisplayName LIKE '{name}%'", "limit": 20},79 ).get("items", [])8081 def get_employee(self, person_id: str) -> dict:82 return self._get(f"/hcmRestApi/resources/11.13.18.05/emps/{person_id}")8384 # --- Supply Chain ---85 def get_purchase_orders(self, status: str = "OPEN", limit: int = 25) -> list[dict]:86 return self._get(87 "/fscmRestApi/resources/11.13.18.05/purchaseOrders",88 params={"q": f"Status='{status}'", "limit": limit},89 ).get("items", [])9091 def get_inventory(self, item: str, org_id: str) -> list[dict]:92 return self._get(93 "/fscmRestApi/resources/11.13.18.05/inventoryOnhand",94 params={"q": f"ItemNumber='{item}';OrganizationId={org_id}"},95 ).get("items", [])96```9798### 2. OCI Generative AI Service99100```python101import oci102103config = oci.config.from_file()104generative_ai = oci.generative_ai_inference.GenerativeAiInferenceClient(config)105106def generate_with_cohere(prompt: str) -> str:107 """Generate text using OCI Generative AI (Cohere Command R+)."""108 response = generative_ai.chat(109 oci.generative_ai_inference.models.ChatDetails(110 compartment_id="ocid1.compartment.oc1...",111 serving_mode=oci.generative_ai_inference.models.OnDemandServingMode(112 model_id="cohere.command-r-plus",113 ),114 chat_request=oci.generative_ai_inference.models.CohereChatRequest(115 message=prompt,116 max_tokens=1024,117 temperature=0.1,118 ),119 )120 )121 return response.data.chat_response.text122```123124### 3. External LLM Integration via OCI API Gateway125126```python127# For using Claude, GPT-4, or Gemini with Oracle data,128# route through OCI API Gateway or Oracle Integration Cloud (OIC)129130import requests131132def query_oracle_with_claude(question: str, oracle_data: dict) -> str:133 """Use Claude (via Bedrock or direct) to analyze Oracle data."""134 import anthropic135136 client = anthropic.Anthropic()137 response = client.messages.create(138 model="claude-sonnet-4-5-20250929",139 max_tokens=1024,140 messages=[{141 "role": "user",142 "content": f"""Analyze this Oracle ERP data and answer the question.143144Data: {oracle_data}145146Question: {question}"""147 }],148 )149 return response.content[0].text150```151152### 4. Oracle APEX AI Integration153154```sql155-- Oracle APEX AI Assistant: generate SQL from natural language156-- Available in APEX 24.1+157DECLARE158 l_response CLOB;159BEGIN160 l_response := APEX_AI.GENERATE(161 p_prompt => 'List all overdue invoices over $10,000',162 p_model => 'OCI_GENAI_COHERE',163 p_system_prompt => 'Generate Oracle SQL for the AP schema. Tables: AP_INVOICES_ALL, AP_INVOICE_LINES_ALL.'164 );165 DBMS_OUTPUT.PUT_LINE(l_response);166END;167```168169## Anti-Patterns170171- Using OCI GenAI exclusively when Claude/GPT are needed -- Oracle's model selection is limited172- Direct database queries bypassing Fusion REST APIs -- always use REST APIs for application data173- Hardcoding Oracle credentials -- use OCI Vault or Oracle Credential Store174- Ignoring Oracle's data security policies -- Fusion enforces row-level security via business units175- Skipping pagination -- Oracle REST APIs use offset/limit; always handle multi-page results176177## References178179- [Oracle Fusion Cloud REST API](https://docs.oracle.com/en/cloud/saas/applications-common/24d/farca/)180- [Oracle AI Agents](https://www.oracle.com/artificial-intelligence/ai-agents/)181- [OCI Generative AI Service](https://www.oracle.com/artificial-intelligence/generative-ai/large-language-models/)182- [Oracle APEX AI](https://apex.oracle.com/en/platform/features/ai/)183184<!-- Source: .faos/custom/skills/integrations/oracle-fusion-ai/SKILL.md -->