Oracle APEX AI: the AI Assistant & generative app building
Turn on APEX's built-in AI — APEX Assistant in the builder's code editors, Create App Using Generative AI, the Show AI Assistant dynamic action and the APEX_AI package — and wire it to a provider.
Since APEX 24.1, generative AI is built into the builder and into the apps you ship. This guide (checked against APEX 26.1 and 26.2) connects a provider and tours the places you'll use it: APEX Assistant in the code editors, Create App Using Generative AI, and AI inside your own apps via the Show AI Assistant dynamic action and the APEX_AI package.
Connect a Generative AI service
- Go to App Builder → Workspace Utilities → Generative AI and click Create. (Also reachable from an app's Shared Components → Generative AI → AI Services.)
- Pick the AI Provider: OCI Generative AI, OpenAI, Cohere, Google Gemini, Anthropic Claude, Mistral AI, Ollama, or a generic OpenAI-compatible endpoint (26.1 list).
- Give it a Name and a Static ID — the Static ID is what you pass to
APEX_AI. - Under Credentials, enter the provider's API Key (or select an existing Web Credential). Optionally set the AI Model (under Advanced in 26.1); if empty, the provider's default model is used.
- Switch on Used by App Builder if the builder's own AI features should use this service. Only one service per workspace can have it on.
- Click Test Connection (expect *Connection Succeeded!*), then Create.
ℹ Workspace service, per-app choice
💡 New in APEX 26.2
Use APEX Assistant in the code editors
APEX Assistant is a chat pane inside the builder's code editors (for example a region's SQL source in Page Designer). Click APEX Assistant on the editor's menu bar, accept the consent dialog the first time, and pick a mode:
- Query Builder — describe the data and get a query back: *"top 5 customers by revenue this year"*.
- General Assistance — select code and ask *"Explain this"* or *"Improve this code"*.
⚠ Review everything
Create an app from a prompt
Create App Using Generative AI builds pages on tables that already exist (or on a sample dataset). If you need new tables, generate them first with Create Data Model Using AI:
SQL Workshop → Utilities → Create Data Model Using AI
› Expense tracking: employees, expenses with receipt files,
approval status and approver, expense categories.
→ review the generated script → Run
App Builder → Create → Create App Using Generative AI
› Create an app on the EXPENSES tables with an interactive report,
a form, and a monthly dashboard by category.
→ review the summary → Create ApplicationAPEX Assistant summarises the pages it plans; you refine through chat, then finish in the normal Create Application wizard. Both options are hidden until a service has Used by App Builder on. Pair it with the vibe-coding guide for the file-based workflow.
Add an AI chat to your own app
- Set the app's service on Edit Application Definition → AI.
- Optionally create an AI Agent under Shared Components → Generative AI → AI Agents for the system prompt, welcome message and AI Tools (26.1 renamed *AI Configurations* to *AI Agents*).
- In Page Designer, add a button and a Click dynamic action whose true action is Show AI Assistant. Choose the Agent, and set Display As to Dialog or Inline.
From PL/SQL, APEX_AI.GENERATE returns a CLOB. Both calls below compile against APEX 26.1; they must run inside an APEX session (an app process, or after APEX_SESSION.CREATE_SESSION):
declare
l_answer clob;
begin
-- Using a Generative AI Service by its Static ID
l_answer := apex_ai.generate (
p_prompt => 'Summarize this ticket in two sentences: ' || :P10_TICKET_TEXT,
p_system_prompt => 'You are a concise support analyst.',
p_service_static_id => 'MY_AI_SERVICE',
p_temperature => 0.2 );
-- Or reuse an AI Agent (APEX 26.1+)
l_answer := apex_ai.generate (
p_agent_static_id => 'SUPPORT_AGENT',
p_prompt => :P10_QUESTION );
end;Check your understanding
Check your understanding
0% · 0/3Where is a Generative AI Service created?
Why is "Create App Using Generative AI" missing from the Create wizard?
What should you do with Assistant-generated SQL?
Need this delivered?
Request a quote