Cert EspressoLearn. Practise. Find your flow.

A LITTLE FOCUS.
A BIG NEXT STEP.

Your pace. Your space.
Oracle · Agentic AI Foundations

Select AI and Select AI Agent

Agentic AI Foundations · Lesson 18 of 20 · 2:17:44

YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗

Learning with these videos? Subscribe for new courses and exam-style questions.

In this lesson

Prepare for the Oracle Agentic AI Foundations Associate exam (1Z0-1157-26). In this lesson: Select AI in Autonomous AI Database, AI profiles, the showsql, runsql, narrate, chat, and explainsql actions, and Select AI Agent with its agents, tools, tasks, and teams. Includes three original practice questions, with Fairhaven Furniture, a fictional furniture seller, as the example.

Study notes

The text of this lesson, to read at your own pace. Information as of November 2026.

Questions in plain English

Fairhaven's sales analysts ask questions about orders every day, but few of them write SQL. The operations team also wants an agent that checks late deliveries and alerts the logistics staff. All of this data is in Autonomous AI Database, so both should run right there, inside the database.

Select AI

Select AI lets you interact with your data in natural language, through SQL. You add the keyword AI to a select statement, followed by your question, and Select AI generates the SQL, runs it, and returns the rows. It can also explain SQL, chat with the model, answer from your documents with retrieval-augmented generation, and generate synthetic data. And you can use it in SQL and PL/SQL, or from applications written in Python and Java.

AI profiles

Select AI needs an AI profile, which you create with the DBMS cloud AI package. The profile names the AI provider, like OCI Generative AI, and the credential that the database uses to call it. Its object list names the tables that questions may target. To write SQL, the model receives metadata about those objects: table names, column names, data types, and comments, so clear names and comments give better SQL. In a stateful session, you set the profile once, and a stateless application passes the profile name in each call to the generate function.

Select AI actions

An action, placed after the keyword AI, sets what Select AI does with your question. Run SQL is the default: it generates the SQL, runs it, and returns the rows. Show SQL only displays the generated statement, without running it. Explain SQL describes the generated statement in plain language. Narrate runs the statement, and answers in a sentence. And chat sends your prompt straight to the model, without generating any SQL.

Select AI Agent

Select AI Agent is the agent framework that runs inside the database, managed with the DBMS cloud AI agent package. It has four kinds of objects. An agent has a name, an AI profile for its model, and a role that guides its behavior. A tool is what the agent can do: a PL/SQL function of your own, or a built-in type, like SQL, RAG, web search, or notification. A task gives instructions and the tools for one piece of work, and a team pairs agents with their tasks.

Building a team

You build it in order: first any PL/SQL functions that your tools need, then the agent, the tools, the tasks, and the team. Each object is created by a procedure of the package, with its attributes in JSON. To run the team, set it for your session and use select AI agent, followed by the prompt, or call the run team function. Either way, the prompt goes to the team, and you get its reply.

Teams and history

A team runs its tasks in two ways. A sequential team runs them one after another, in order, and a supervised team has a supervisor agent that delegates subtasks to worker agents. An agent or a task can also ask the user questions, when the human tool is enabled. And after a run, the history views show each team run and task run, with the prompts, the responses, and the agent's thoughts.

Recap

Let's recap. Select AI turns natural language into SQL, with the keyword AI in a select statement. An AI profile sets the provider, the credential, and the objects, whose metadata helps the model write SQL. Run SQL is the default action, while show SQL, explain SQL, narrate, and chat change what you get back. And Select AI Agent builds agents, tools, tasks, and teams inside the database, with history views to review every run.

Quick checks for this lesson

The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.

  1. Fairhaven’s reporting web app uses stateless database connections from a pool, and each request runs on any connection. How should the app call Select AI?

    • Run SET_PROFILE once, when the app starts
    • Add every schema to one shared profile
    • Switch the profile to another AI provider
    • Call GENERATE with the profile in each call
    Show the answer

    Call GENERATE with the profile in each call

    A stateless application calls the generate function, with the profile name in each call. “Run SET_PROFILE once, when the app starts” works only for one stateful session, and a pooled request may land on another connection. “Add every schema to one shared profile” would let every user reach every table, without fixing the profile problem. And “Switch the profile to another AI provider” changes the provider, but each call still needs a profile.

  2. A Fairhaven manager asks how many sofas were delivered late last month, and wants the answer as a sentence, not as a table of rows. Which action fits?

    • runsql, the default action
    • showsql, to see the statement
    • narrate, for an answer in words
    • chat, straight to the model
    Show the answer

    narrate, for an answer in words

    Narrate runs the generated statement, and returns the result as a sentence. “runsql, the default action” returns rows, which the manager does not want. “showsql, to see the statement” only shows the statement, and never runs it. And “chat, straight to the model” would answer from the model alone, with no data from the orders.

  3. Yesterday, Fairhaven’s delivery agent team alerted the logistics staff about an order that was not late. The team wants to see what the agent was asked, what it answered, and how it reasoned. What should they do?

    • Ask the same question with showsql
    • Query the Select AI Agent history views
    • Turn the team into a supervised team
    • Run the team again with RUN_TEAM
    Show the answer

    Query the Select AI Agent history views

    The history views show each team run and task run, with the prompts, the responses, and the agent's thoughts. “Ask the same question with showsql” only displays SQL for a new question, not yesterday's run. “Turn the team into a supervised team” would change the team before anyone knows the cause. And “Run the team again with RUN_TEAM” would run the team again, without showing what happened yesterday.