Skip to content

UC AI - Agentic AI for Oracle

Build AI agents in PL/SQL. Next to your data, inside your database.

UC AI is a PL/SQL framework that turns your Oracle database into the runtime for AI agents. An agent reasons about a task, calls your own PL/SQL functions to read and change data, remembers what it learned, and hands work to other agents. You need no Python, no middle tier, and no external orchestrator.

A customer says they were charged twice. One question goes in, and a coordinator hands it to the specialists who can answer it.

Everything here runs in your Oracle database. Except the model.

1 / 8 ¡ The system

Read the story

A customer asks: “I was charged twice for invoice INV-1003. Can I get a refund?” Everything below runs inside an Oracle database, except the AI model, which the database calls over HTTPS. This run uses Anthropic · claude-opus-5. UC AI takes any of Anthropic, OpenAI, Google, xAI, Mistral, Ollama, OCI, OpenRouter.

  1. The system. Everything here runs in your Oracle database. Except the model.
  2. The request. “I was charged twice for invoice INV-1003. Can I get a refund?” (task: Refund request · INV-1003)
  3. The orchestrator thinks. The orchestrator asks the model what to do first. (model call: orch sends the question, and gets back “Ask Billing first”; task: Check payments · INV-1003)
  4. Choose a tool. The model does not run code. It picks one of your functions. (model call: billing sends the task)
  5. Your function runs. UC AI runs get_payments. Your SQL, your table, your rows. (model call: billing sends the rows, and gets back “2 × €49 · a duplicate”; task: invoice_id = 'INV-1003'; result: 2 rows; result: 2 payments · €49)
  6. The orchestrator thinks again. The orchestrator asks the model what is next. (model call: orch sends Billing's answer, and gets back “Ask Policy next”; task: Find refund rule)
  7. The second specialist. The Policy agent does the same with find_policy. (model call: policy sends the task; model call: policy sends the row, and gets back “Refund the extra payment”; task: duplicate_payment; result: 1 row; result: Refund extra payment)
  8. The answer. “You paid €49 twice for INV-1003. The extra €49 qualifies for a refund.” (model call: orch sends both answers, and gets back “Answer ready”; result: Answer ready)

The run makes 7 model calls in all. Every agent is its own loop: it asks the model what to do, runs what the model picked, and asks again with the result.

The orchestrator's plan: Check the payments, then Check the refund rule.

The Billing agent has three of your functions: get_payments, get_invoice and issue_refund. The model chose get_payments. The other two stayed unused.

get_payments runs: select amount from payments where invoice_id = 'INV-1003'. The PAYMENTS rows it reads: INV-0977, €120; INV-1003, €49 (selected); INV-1003, €49 (selected).

The Policy agent has find_policy and get_customer_tier. The model chose find_policy, which runs: select rule_text from refund_policies where reason_code = 'duplicate_payment'. The REFUND_POLICIES rows it reads: duplicate_payment, Refund extra (selected); service_downgrade, Pro-rate. The rule that applies: Duplicate payment: refund the extra payment to the original payment method.

Answer: You paid €49 twice for INV-1003. The extra €49 qualifies for a refund.

The run in total: 3 agents, 7 model calls, 2 function calls, 1 session. Your agents work together. UC AI connects them to your PL/SQL tools and business data.

This is a multi-agent system: specialist agents work together on one request. With UC AI, you build these agents in PL/SQL.

Build your first agent

How UC AI runs this

You define each agent and the tools it may use. The orchestrator asks an AI model which specialist to call. UC AI runs that specialist and returns its result.

A specialist asks the model which of its tools to call, and UC AI runs that tool as your PL/SQL function. The function runs SQL against your own tables, so reading your data never leaves the database. The agent then asks the model again with the rows it received. Each agent is its own loop, so one request makes several model calls. An agent can hold more tools than one run needs, and the model chooses between them.

One session groups the whole run, so you can see every agent, every tool call, and every token it used. Each agent can use its own model.

Model requests can include prompts and tool results. Your model configuration determines where those requests go.

Tools / Function Calling

Agents call your PL/SQL functions with type-safe parameters and JSON schema validation. Your business logic stays in the database.

Agent Memory

Give an agent a virtual filesystem it writes to itself, so it keeps context between runs.

Prompt Profiles

Store prompts as versioned templates with parameters and model configuration. Change a prompt with no code change.

Multi-Provider Support

One API for OpenAI, Anthropic, Google, xAI, Mistral, Ollama, OCI, and OpenRouter. Give each agent the model that fits its job.

Runs on older DBs

You need no 26ai. This is just PL/SQL. Oracle Database 12.2 and later are supported.

Local LLMs

Run offline models like GPT-OSS or Qwen through Ollama, so model requests stay on your own network.

This framework is specifically designed for Oracle Database developers who want to:

  • Build agents in PL/SQL: Write the agent, its tools, and its prompts as database objects
  • Automate Tasks: Let AI models call your functions from a natural language prompt
  • Keep data in place: Tools read your own tables, with no copy to a middle tier
  • Extend Functionality: Give AI models access to custom business logic and database operations
  • Maintain Control: Keep AI interactions secure with validated parameters, budgets, and controlled execution
DECLARE
l_result JSON_OBJECT_T;
BEGIN
-- Let AI answer a question using a custom tool
l_result := uc_ai.generate_text(
p_user_prompt => 'How many open tickets do I have?',
p_system_prompt => 'You are a helpful assistant to an ticketing system.
Use the provided tools to access the database.
You are currently talking to the user "John Doe"',
p_provider => uc_ai.c_provider_openai,
p_model => uc_ai_openai.c_model_gpt_5_6_luna
);
-- Get the AI's response
DBMS_OUTPUT.PUT_LINE('AI Response: ' || l_result.get_string('final_message'));
-- You have 5 open tickets.
END;
/
  • OpenAI: GPT-6 Astra / Sol / Luna, GPT-5.6 Sol / Terra / Luna, GPT-5.5, the GPT-5.4 family, and text-embedding-3…
  • Anthropic: Claude Fable 5, Claude Opus 5.5, Claude Sonnet 5.5, Claude Haiku 4.5, and the Claude 4.x family…
  • Google: Gemini 3.7 Flash, Gemini 3.1 Pro, Gemini 3.5 Flash / Flash-Lite, plus Gemini embeddings…
  • xAI: Grok 4.7, Grok 4.6, Grok 4.5, Grok 4.3, Grok 4.20, Grok Build…
  • Mistral: Mistral Large / Medium / Small, Ministral, Codestral…
  • Ollama: Local LLMs like Llama, Qwen, Gemma, GPT-OSS, and more
  • OCI: Oracle Cloud Infrastructure Generative AI — Llama 4, Cohere Command A, Gemini 2.5, Grok 4.7, GPT-OSS…
  • OpenRouter: Unified API for 300+ models from OpenAI, Anthropic, Google, Meta, Mistral, and more
FeatureOpenAI GPTAnthropic ClaudeGoogle GeminiOllamaOCIxAIMistralOpenRouter
Text generationYes (i)Yes (i)Yes (i)Yes (i)Yes (i)Yes (i)Yes (i)Yes (i)
• Tools/Function callingYes (i)Yes (i)Yes (i)Yes (i)YesYes (i)Yes (i)Yes (i)
• PDF analysisYes (i)Yes (i)Yes (i)Not supportedNoNoNoYes (i)
• Image analysis/VisionYes (i)Yes (i)Yes (i)Yes (i)NoYes (i)Yes (i)Yes (i)
• Reasoning/ThinkingYes (i)Yes (i)Yes (i)Yes (i)NoYes (i)Yes** (i)Yes (i)
• Structured OutputYes (i)Yes(i)Yes (i)Yes (i)NoYes (i)Yes (i)Yes (i)
Embedding generationYes (i)Not supported(i)Yes (i)Yes (i)Yes (i)NoYes (i)Yes (i)
Feature Matrix
FeatureOpenAI GPTAnthropic ClaudeGoogle GeminiOllamaOCIxAIMistralOpenRouter
Text generationYes (i)Yes (i)Yes (i)Yes (i)Yes (i)Yes (i)Yes (i)Yes (i)
• Tools/Function callingYes (i)Yes (i)Yes (i)Yes (i)YesYes (i)Yes (i)Yes (i)
• PDF analysisYes (i)Yes (i)Yes (i)Not supportedNoNoNoYes (i)
• Image analysis/VisionYes (i)Yes (i)Yes (i)Yes (i)NoYes (i)Yes (i)Yes (i)
• Reasoning/ThinkingYes (i)Yes (i)Yes (i)Yes (i)NoYes (i)Yes** (i)Yes (i)
• Structured OutputYes (i)Yes(i)Yes (i)Yes (i)NoYes (i)Yes (i)Yes (i)
Embedding generationYes (i)Not supported(i)Yes (i)Yes (i)Yes (i)NoYes (i)Yes (i)

* The (i) links to the provider documentation for the feature.

** Some features only work with specific models. Research the documentation of the provider about this.