Multi-Agent Systems
Coordinate specialized agents with a workflow, an orchestrator, a handoff, or a conversation. UC AI manages the data flow and the termination logic.
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.
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.
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
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.
Multi-Agent Systems
Coordinate specialized agents with a workflow, an orchestrator, a handoff, or a conversation. UC AI manages the data flow and the termination logic.
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.
Guardrails
Put a token budget and a rate limit on an agent before it reaches production.
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:
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;/DECLARE l_result JSON_OBJECT_T; l_session_id VARCHAR2(100);BEGIN -- One session groups every agent, tool call, and token count of the run l_session_id := uc_ai_agents_api.generate_session_id;
-- The orchestrator decides which specialist agents to call l_result := uc_ai_agents_api.execute_agent( p_agent_code => 'support_orchestrator', p_input_parameters => JSON_OBJECT_T( '{"prompt": "Customer 4711 says invoice INV-1003 was charged twice."}' ), p_session_id => l_session_id );
DBMS_OUTPUT.PUT_LINE(l_result.get_clob('final_message'));END;/See the multi-agent systems guide for the agents behind this call.
| Feature | OpenAI GPT | Anthropic Claude | Google Gemini | Ollama | OCI | xAI | Mistral | OpenRouter |
|---|---|---|---|---|---|---|---|---|
| Text generation | Yes (i) | Yes (i) | Yes (i) | Yes (i) | Yes (i) | Yes (i) | Yes (i) | Yes (i) |
| ⢠Tools/Function calling | Yes (i) | Yes (i) | Yes (i) | Yes (i) | Yes | Yes (i) | Yes (i) | Yes (i) |
| ⢠PDF analysis | Yes (i) | Yes (i) | Yes (i) | Not supported | No | No | No | Yes (i) |
| ⢠Image analysis/Vision | Yes (i) | Yes (i) | Yes (i) | Yes (i) | No | Yes (i) | Yes (i) | Yes (i) |
| ⢠Reasoning/Thinking | Yes (i) | Yes (i) | Yes (i) | Yes (i) | No | Yes (i) | Yes** (i) | Yes (i) |
| ⢠Structured Output | Yes (i) | Yes(i) | Yes (i) | Yes (i) | No | Yes (i) | Yes (i) | Yes (i) |
| Embedding generation | Yes (i) | Not supported(i) | Yes (i) | Yes (i) | Yes (i) | No | Yes (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.