A chat window showing a conversation with an AI assistant. It answers user questions and provides information.

UC AI Chat Plug-In Beta

Build APEX AI agents with UC AI thanks to the new chat plug-in

The UC AI Chat Plug-In

Until now UC AI was mostly a backend framework, allowing you to do everything from basic LLM text generation to fully-fledged AI agents from PL/SQL.

Today I am excited to announce the beta release of the UC AI Chat Plug-In, which allows you to expose these AI agents as chatbots with a simple interface to connect to your existing Oracle APEX applications.

Download and install the plug-in

Download the plug-in from the latest UC AI release on GitHub (scroll down to assets). The download includes scripts for a few tables and a PL/SQL package. Run the scripts in your database and then log in to your APEX workspace. Select an application, go to Shared Components, then plug-ins, and click Import. Select the file from the downloaded package and click the Import button. You should now see the “UC AI Chat” plug-in in your list of plug-ins.

How to use it

Go to a page in your application where you want to add the chatbot and create a new region. Change the type to UC AI Chat.

Agent definition

The chatbot requires information on the used provider, model, prompts, etc. In UC AI you can define these as prompt profiles.

Here is an example of an advanced prompt profile for a document assistant with reasoning and tool-use capabilities. Note how we use a question placeholder ({question}) in the user prompt template, which will be replaced by the user message when the agent is called.

declare
  l_profile_id number;
  l_model_config   json_object_t;
  l_tool_tags      json_array_t;
begin
  l_tool_tags := json_array_t();
  l_tool_tags.append('adm_ai_assistant');

  l_model_config := json_object_t();
  l_model_config.put('g_enable_tools', true);
  l_model_config.put('g_tool_tags', l_tool_tags);
  l_model_config.put('g_max_tool_calls', 8);
  l_model_config.put('g_enable_reasoning', true);
  l_model_config.put('g_reasoning_level', 'medium');
  l_model_config.put('g_apex_web_credential', 'OPENAI');

  l_profile_id := uc_ai_prompt_profiles_api.create_prompt_profile(
    p_code => 'ADM_DOC_ASSISTANT',
    p_description => 'Helps users to find and summarize documents',
    p_system_prompt_template => 'You are a retrieval assistant for the APEX Document Management (ADM) system...',
    p_user_prompt_template => '{question}',
    p_provider => uc_ai.c_provider_openai,
    p_model => uc_ai_openai.c_model_gpt_5_4,
    p_model_config_json      => l_model_config.to_clob(),
    p_status => uc_ai_prompt_profiles_api.c_status_active
  );

  commit;
end;
/

See the prompt profiles documentation for more information on how to create these.

Now we have to create an agent that uses this prompt profile. An agent is a wrapper around a prompt profile that adds logging, session management, and other features. You can create an agent with the following code:

declare
  l_agent_id number;
begin
  l_agent_id := uc_ai_agents_api.create_agent(
    p_code                  => 'adm_doc_assistant',
    p_description           => 'Profile agent wrapping ADM_DOC_ASSISTANT. Use uc_ai_agents_api.execute_agent with p_input_parameters => json_object(''question'' value ''...'') and a session id to support multi-turn follow-ups.',
    p_agent_type            => uc_ai_agents_api.c_type_profile,
    p_prompt_profile_code   => 'ADM_DOC_ASSISTANT',
    p_status                => uc_ai_agents_api.c_status_active
  );
  commit;
end;
/

Now we can reference this agent in the UC AI Chat plug-in region we created earlier. In the attributes section you can specify Agent Code and Agent Version.

In the Agent Input Mapping we can specify the values for the agent input parameters. For any placeholder in the prompt templates, we can specify a mapping here. For example, for the {question} placeholder in the user prompt template, we can specify the following mapping, which will replace it with the user message:

{ "question": "#USER_MESSAGE#" }

Chat interface

You can choose between either a normal chat region or a modal popup style. The popup one will only render an icon, and when the user clicks on it, the chat interface will open. This is useful if you want to create a global chat experience on page 0.

Depending on the Debug Config in the plug-in attributes, it will also show the tool calls and reasoning steps that the agent is doing. This is very useful for the developer to understand how the agent works.

Screenshot of the chat interface with a document assistant example. It called multiple tools to find and summarize relevant documents.

What’s next?

This is the first beta release of the UC AI Chat plug-in. There are lots of configuration options and user experience improvements that we want to add in the future.

One big step would be streaming support. I have an approach in mind, but it’s trickier than it looks.

If you have any feedback or suggestions for features, please let me know in the comments or on GitHub!

Download from the release page (assets).

Other Posts

Comments

Loading comments...
Homepage All Blogposts

AI disclaimer: I spend hours writing my blog posts by hand, adding my own thoughts and experiences to them. In my view, purely AI-generated content lacks that human depth and isn't worth publishing. I only use AI for research and editing assistance.