Agentic AI
AI Agents with UC AI
Section titled “AI Agents with UC AI”Agentic AI has many definitions. In essence, you give an LLM more capabilities, and the model decides itself when it uses them. The LLM does not run these capabilities itself. You tell the LLM that it can do X, and the LLM then requests X from outside. The core logic of the agent therefore lives in the calling mechanism, and not in the LLM. That mechanism is your PL/SQL code with UC AI.
You can build an agent in UC AI with these techniques:
- Prompt engineering: give the correct instructions in the system prompt and the context
- Prompt profiles: manage reusable prompt templates with parameter substitution, model configuration, and version control. You can then change a prompt without a code change.
- Tools: let the LLM request a PL/SQL function call. The agent then gets more context, for example from a RAG search, or it changes data.
- Reasoning: let the LLM think before it acts. Use a reasoning model and configure the reasoning level.
- Multi-agent systems: do not give one large task to one LLM. Break the task into steps, and give each step to a specialized agent. UC AI has patterns for a sequential workflow, a loop, orchestrator delegation, and a multi-agent conversation.
From manual calls to managed agents
Section titled “From manual calls to managed agents”Start with a direct uc_ai.generate_text call and the global variables. When your agents grow, UC AI gives you higher-level structures. They need less code and add structure:
| Approach | Best for |
|---|---|
Direct generate_text calls | A simple, single AI call with full control |
| Prompt profiles | Reusable prompt templates with versions and one central configuration |
| Multi-agent systems | Coordination of several specialized agents with a workflow, an orchestrator, or a conversation |
You can mix these approaches. For example, define each agent with a prompt profile, and coordinate the agents with the multi-agent system.
Example: direct approach
Section titled “Example: direct approach”This example is a Customer Insights Agent. It analyzes a support ticket itself, and recommends an action.
Ticket → LLM Reasoning → Tool Requests → PL/SQL Execution → Synthesis → ResponseThe agent starts with reasoning. The LLM analyzes the new ticket and decides which context it needs. From this thought, it requests a tool call itself. UC AI handles each request: it calls your PL/SQL function, reads the result, and returns the result to the agent.
Tools that the agent can request:
- RAG search tool (retrieve similar past tickets)
- Customer account query tool (transaction history, account status)
- Escalation trigger tool (route to specialist)
- Task creation tool (schedule follow-up)
- Recommendation engine tool (personalized suggestions)
This agent needs three steps:
- Write the PL/SQL function of each tool
- Register the tools with UC AI
- Write a procedure that a new ticket starts. This procedure calls UC AI with the correct parameters:
declare l_result json_object_t;begin -- allow model to reason uc_ai.g_enable_reasoning := true; uc_ai_openai.g_reasoning_effort := 'medium';
-- allow model to use tools uc_ai.g_enable_tools := true; -- only pass tools created for this task uc_ai.g_tool_tags := apex_t_varchar2('customer_insight_agent');
l_result := uc_ai.generate_text( p_system_prompt => 'You are an... First analyze the ticket and think of actions that make sense from the given tools...', p_user_prompt => 'Ticket #1243: ...', p_provider => uc_ai.c_provider_openai, p_model => uc_ai_openai.c_model_gpt_5_6_terra );
dbms_output.put_line('AI Response: ' || l_result.get_string('final_message'));end;/Example: prompt profile approach
Section titled “Example: prompt profile approach”A prompt profile builds the same agent. It moves the configuration out of your PL/SQL code, into a reusable template with versions:
-- Create the profile onceDECLARE l_profile_id NUMBER; l_config CLOB := '{ "g_enable_reasoning": true, "g_enable_tools": true, "g_tool_tags": ["customer_insight_agent"], "openai": { "g_reasoning_effort": "medium" } }';BEGIN l_profile_id := uc_ai_prompt_profiles_api.create_prompt_profile( p_code => 'CUSTOMER_INSIGHTS', p_description => 'Analyzes support tickets and recommends actions', p_system_prompt_template => 'You are an... First analyze the ticket and think of actions that make sense from the given tools...', p_user_prompt_template => '{ticket_text}', p_provider => uc_ai.c_provider_openai, p_model => uc_ai_openai.c_model_gpt_5_6_terra, p_model_config_json => l_config, p_status => uc_ai_prompt_profiles_api.c_status_active );
COMMIT;END;/Then run it with one call:
DECLARE l_result json_object_t; l_params json_object_t := json_object_t();BEGIN l_params.put('ticket_text', 'Ticket #1243: ...');
l_result := uc_ai_prompt_profiles_api.execute_profile( p_code => 'CUSTOMER_INSIGHTS', p_parameters => l_params );
DBMS_OUTPUT.PUT_LINE('AI Response: ' || l_result.get_clob('final_message'));END;/You can then change a prompt, a model, or a reasoning setting without a change to your application code.
Scaling up: multi-agent systems
Section titled “Scaling up: multi-agent systems”When one agent is not enough, compose several agents into a coordinated system. Each agent wraps a prompt profile, and it can have its own model, tools, and instructions.
For example, a multi-agent workflow can hold the Customer Insights Agent in three parts. A classifier categorizes the ticket. A researcher reads the relevant context. A responder writes the final recommendation. Each part is a separate agent, with its own model and prompt.