DB@AWS · SELECT AI · AMAZON BEDROCK
Building a Supervisor Led AR and AP Review on Oracle Database@AWS with Select AI Agent Framework
Share on LinkedIn ↗Before you begin: Connect Oracle Select AI to Amazon Bedrock
You’ve provisioned your database on Oracle Database@AWS and connected Oracle Select AI to Amazon Bedrock. What’s next? Give a finance assistant a broader goal: bring together customer receivables and supplier payables, check the figures, and prepare a review brief.
A Finance Supervisor Agent coordinates two specialist AI agents for accounts receivable and accounts payable. This walkthrough shows how to build the team and produce a combined review brief. A person reviews the findings and verifies the figures with SQL.
From a question to a goal
Before a finance review, you need one answer: “What is overdue to collect from customers and pay to suppliers?”
Using Oracle’s Select AI Agent Framework, a supervisor asks the AR and AP agents to retrieve their figures and combines the findings into one brief for your review.

Let’s build this team, ask the question, and check the results with SQL.
Note: We use Amazon Nova Pro through Amazon Bedrock for the supervisor, AR, and AP agents.
What is the Select AI Agent Framework
Oracle’s Select AI Agent Framework lets you build AI workflows inside Autonomous Database. Agents use a language model to interpret a request and call tools to complete their assigned work.
Four components make up this workflow:
| Component | Purpose | Capabilities | Example in this walkthrough |
|---|---|---|---|
| Agent | Performs a defined role | Interpret requests, choose tools, and prepare findings | AR Agent reviews customer receivables |
| Tool | Gives an agent a capability | Query data with SQL, retrieve knowledge with RAG, search the web, send notifications, or call custom PL/SQL functions | SQL tool retrieves invoice figures |
| Task | Defines the assignment | Specify instructions, available tools, and the required result | Return overdue totals and top five customers |
| Team | Connects agents and tasks | Coordinate workers through a supervisor and manage sequential delegation | Finance Supervisor coordinates AR and AP |
Note: For this blog, we use SQL tools to retrieve AR and AP invoice figures.
The supervisor turns one finance question into separate AR and AP assignments. Each worker uses its SQL tool and returns findings; the supervisor combines them into a brief for human review. Let’s create these components step by step.
1. Prepare the database and invoice data
Use your existing SQL Developer connection to Autonomous Database on Oracle Database@AWS. Run PL/SQL blocks as scripts with F5. This walkthrough starts after the private Bedrock connection, the AWS_BEDROCK_CRED credential, and permission to invoke Amazon Nova Pro are configured. The preceding Select AI article covers that connection setup.
| Prerequisite | Used for |
|---|---|
| Access to DBMS_CLOUD_AI and DBMS_CLOUD_AI_AGENT | Create the AI profile, tools, agents, tasks, and team |
| Working AWS_BEDROCK_CRED and database-to-Bedrock HTTPS path | Let the database invoke the model |
| Amazon Nova Pro invocation permissions | Use amazon.nova-pro-v1:0 |
| ADMIN.AR_INVOICES_DEMO | Customer receivables |
| ADMIN.AP_INVOICES_AGENT_DEMO | Synthetic supplier payables |
| Existing business comments on invoice tables and columns | Give Select AI context for SQL generation |
The examples use the ADMIN schema. Use a dedicated execution schema with appropriate package and data privileges for an application. An AI profile’s object list provides model context; database privileges enforce access.
Confirm the framework is available and inspect the invoice columns:
SELECT owner, object_name, status
FROM all_objects
WHERE object_name = 'DBMS_CLOUD_AI_AGENT'
AND object_type = 'PACKAGE';
SELECT table_name, column_name, data_type
FROM all_tab_columns
WHERE owner = 'ADMIN'
AND table_name IN ('AR_INVOICES_DEMO', 'AP_INVOICES_AGENT_DEMO')
ORDER BY table_name, column_id;

Checkpoint: the package is VALID, and the tables expose the amount, due date, currency, customer or supplier identifiers, and names used below. The supplier table is synthetic demo data. Keep existing table and column comments; the profile will include them.
2. Create and test the Nova Pro AI profile
An AI profile tells Oracle which provider, credential, model, and database objects to use. The agents use this profile to interpret assignments; the SQL tools use it to generate queries against the invoice tables.
Create the profile once. If you already have BEDROCK_NOVA_PRO_DEMO, inspect its saved attributes instead of creating it again. The same rule applies to the tools, agents, tasks, and team in later steps.
BEGIN
DBMS_CLOUD_AI.CREATE_PROFILE(
profile_name => 'BEDROCK_NOVA_PRO_DEMO',
attributes => '{
"provider": "aws",
"credential_name": "AWS_BEDROCK_CRED",
"model": "amazon.nova-pro-v1:0",
"comments": true,
"conversation": true,
"object_list": [
{"owner":"ADMIN","name":"AR_INVOICES_DEMO"},
{"owner":"ADMIN","name":"AP_INVOICES_AGENT_DEMO"}
]
}'
);
END;
/
SELECT attribute_name, attribute_value
FROM user_cloud_ai_profile_attributes
WHERE profile_name = 'BEDROCK_NOVA_PRO_DEMO'
ORDER BY attribute_name;
SELECT DBMS_CLOUD_AI.GENERATE(
prompt => 'Reply with exactly: Nova Pro database connection successful.',
profile_name => 'BEDROCK_NOVA_PRO_DEMO',
action => 'chat'
) AS response
FROM dual;

3. Give AR and AP the same business rules
Both workers must interpret “overdue” consistently. For this example, use USD invoices with a due date strictly before November 16, 2026 and an outstanding amount greater than zero. Partially paid invoices qualify when a positive balance remains.
Establish independent reference totals before asking the agents:
SELECT 'AR' AS source, COUNT(*) AS invoice_count,
SUM(outstanding_amount) AS outstanding_total
FROM admin.ar_invoices_demo
WHERE due_date < DATE '2026-11-16'
AND outstanding_amount > 0
AND currency_code = 'USD'
UNION ALL
SELECT 'AP', COUNT(*), SUM(outstanding_amount)
FROM admin.ap_invoices_agent_demo
WHERE due_date < DATE '2026-11-16'
AND outstanding_amount > 0
AND currency_code = 'USD';

These totals use current outstanding balances for invoices due before the cutoff date.
4. Create the SQL tools the workers will call
An agent does not obtain invoice figures simply by having a role. Its task needs a callable tool. Register one SQL tool for AR and another for AP so the history clearly identifies each worker’s calls.
BEGIN
DBMS_CLOUD_AI_AGENT.CREATE_TOOL(
tool_name => 'AR_NOVA_PRO_SQL',
attributes => '{
"tool_type":"SQL",
"tool_params":{"profile_name":"BEDROCK_NOVA_PRO_DEMO"}
}'
);
DBMS_CLOUD_AI_AGENT.CREATE_TOOL(
tool_name => 'AP_NOVA_PRO_SQL',
attributes => '{
"tool_type":"SQL",
"tool_params":{"profile_name":"BEDROCK_NOVA_PRO_DEMO"}
}'
);
END;
/
Check that both tools are enabled:
SELECT tool_name, status
FROM user_ai_agent_tools
WHERE tool_name IN ('AR_NOVA_PRO_SQL', 'AP_NOVA_PRO_SQL')
ORDER BY tool_name;

The worker passes a natural-language question to its SQL tool with ACTION = RUNSQL. The tool generates and executes SQL and returns the resulting figures. Both tools use the same two-table profile; the separate names and task instructions organize their responsibilities, rather than creating separate database permission boundaries.
Checkpoint: both tools are registered. Their actual calls and returned values will appear in the successful execution’s tool history.
5. Create the AR and AP worker agents
The AR Agent answers questions about money customers owe. The AP Agent answers questions about balances owed to suppliers. Their roles tell the model which table and tool to use; the next step supplies each worker’s detailed assignment.
BEGIN
DBMS_CLOUD_AI_AGENT.CREATE_AGENT(
agent_name => 'AR_NOVA_PRO_AGENT',
attributes => '{
"profile_name":"BEDROCK_NOVA_PRO_DEMO",
"role":"You are an accounts receivable analyst. Use AR_NOVA_PRO_SQL with natural-language questions about ADMIN.AR_INVOICES_DEMO. Use only tool-returned financial figures. Include positive balances from partial payments. Report the cutoff date and currency. Prepare findings for human review. Do not change records or send messages."
}'
);
DBMS_CLOUD_AI_AGENT.CREATE_AGENT(
agent_name => 'AP_NOVA_PRO_AGENT',
attributes => '{
"profile_name":"BEDROCK_NOVA_PRO_DEMO",
"role":"You are an accounts payable analyst. Use AP_NOVA_PRO_SQL with natural-language questions about ADMIN.AP_INVOICES_AGENT_DEMO. Use only tool-returned financial figures. Include positive balances from partial payments. Report the cutoff date and currency. Prepare findings for human review. Do not change records or execute payments."
}'
);
END;
/
Verify the saved agent roles and profile:
SELECT agent_name, attribute_name, attribute_value
FROM user_ai_agent_attributes
WHERE agent_name IN ('AR_NOVA_PRO_AGENT', 'AP_NOVA_PRO_AGENT')
ORDER BY agent_name, attribute_name;

What AR gives the supervisor: the customer invoice count, outstanding receivables total, and five customers with the largest overdue balances. What AP gives the supervisor: the supplier invoice count, outstanding payables total, and five suppliers with the largest overdue balances. Both reports retain the cutoff date and currency.
6. Create a task for each worker
The agent is the role; the task is the assignment and its available tools. Each task below requests two separate SQL calls: one for overall counts and balances, and one for the top-five ranking. The {query} placeholder receives the request delegated by the supervisor.
BEGIN
DBMS_CLOUD_AI_AGENT.CREATE_TASK(
task_name => 'AR_NOVA_PRO_TASK',
attributes => '{
"instruction":"Process this request: {query}. Require a cutoff date and currency. Use AR_NOVA_PRO_SQL with ACTION RUNSQL. Pass natural-language questions in QUERY, never raw SQL. Name ADMIN.AR_INVOICES_DEMO in each question. Retrieve totals and top five customers in separate calls. Group customers by CUSTOMER_ID and CUSTOMER_NAME. Overdue means DUE_DATE strictly before the cutoff and OUTSTANDING_AMOUNT greater than zero. Include partial payments; filter the requested currency. Report only tool-returned figures and current stored balances. Do not change records or send messages.",
"tools":["AR_NOVA_PRO_SQL"]
}'
);
DBMS_CLOUD_AI_AGENT.CREATE_TASK(
task_name => 'AP_NOVA_PRO_TASK',
attributes => '{
"instruction":"Process this request: {query}. Require a cutoff date and currency. Use AP_NOVA_PRO_SQL with ACTION RUNSQL. Pass natural-language questions in QUERY, never raw SQL. Name ADMIN.AP_INVOICES_AGENT_DEMO in each question. Retrieve totals and top five suppliers in separate calls. Group suppliers by SUPPLIER_ID and SUPPLIER_NAME. Overdue means DUE_DATE strictly before the cutoff and OUTSTANDING_AMOUNT greater than zero. Include partial payments; filter the requested currency. Report only tool-returned figures and current stored balances. Do not change records or execute payments.",
"tools":["AP_NOVA_PRO_SQL"]
}'
);
END;
/
Verify each task’s instructions and assigned tool:
SELECT task_name, attribute_name, attribute_value
FROM user_ai_agent_task_attributes
WHERE task_name IN ('AR_NOVA_PRO_TASK', 'AP_NOVA_PRO_TASK')
ORDER BY task_name, attribute_name;

Checkpoint: Confirm that the AR task uses AR_NOVA_PRO_SQL and the AP task uses AP_NOVA_PRO_SQL. Next, add each agent and its task to the supervisor’s team.
How the agents work together: The supervisor asks AR for customer figures, then AP for supplier figures. Each agent returns its SQL results to the supervisor, which combines them into one brief for your review.
7. Create the supervisor and connect the team
The supervisor interprets the combined business request, delegates to AR and AP, and uses their returned reports to prepare the brief. The person reviewing the answer performs the independent SQL checks.
First create FIN_SUP_NOVA_V2 with supervisor = true. Then create FINANCE_NOVA_PRO_TEAM_V2 and list the two worker agent-task pairs. Set supervisor_agent to the supervisor’s name and keep the supervisor outside the worker array.
BEGIN
DBMS_CLOUD_AI_AGENT.CREATE_AGENT(
agent_name => 'FIN_SUP_NOVA_V2',
attributes => '{
"profile_name": "BEDROCK_NOVA_PRO_DEMO",
"supervisor": true,
"enable_human_tool": false,
"short_term_memory_length": 30,
"tools": [],
"role": "Coordinate a finance review. Delegate AR analysis to AR_NOVA_PRO_AGENT and AP analysis to AP_NOVA_PRO_AGENT sequentially. Wait for both worker results, then combine counts, balances and rankings and calculate AR minus AP. Follow framework output format. Use only worker-returned figures."
}'
);
DBMS_CLOUD_AI_AGENT.CREATE_TEAM(
team_name => 'FINANCE_NOVA_PRO_TEAM_V2',
attributes => '{
"supervisor_agent": "FIN_SUP_NOVA_V2",
"agents": [
{"name":"AR_NOVA_PRO_AGENT","task":"AR_NOVA_PRO_TASK"},
{"name":"AP_NOVA_PRO_AGENT","task":"AP_NOVA_PRO_TASK"}
],
"process": "sequential",
"long_term_memory_length": 30
}'
);
END;
/
Verify the supervisor settings and saved team definition:
SELECT attribute_name, attribute_value
FROM user_ai_agent_attributes
WHERE agent_name = 'FIN_SUP_NOVA_V2'
AND attribute_name IN ('profile_name','supervisor','enable_human_tool')
ORDER BY attribute_name;
SELECT DBMS_CLOUD_AI_AGENT.GET_DEFINITION(
object_type => 'team',
object_name => 'FINANCE_NOVA_PRO_TEAM_V2'
) AS definition
FROM dual;

supervisor: true designates the coordinating agent. process: sequential makes worker delegation sequential. The memory settings retain up to 30 recent conversation turns on the agent and 30 prior task summaries on the team. enable_human_tool: false disables the supervisor’s optional human-question tool. The supervisor has no direct business tools in its empty tools array; each worker task has its own SQL tool. Supervisor teams
8. Run the combined finance review
Run the following block with F5. It creates a fresh conversation and prints the execution ID returned by the run. Preserve that execution ID for the history queries; it is distinct from the conversation ID.
SET SERVEROUTPUT ON SIZE UNLIMITED
DECLARE
l_response CLOB;
l_conversation_id VARCHAR2(128);
l_team_exec_id VARCHAR2(128);
BEGIN
l_conversation_id := DBMS_CLOUD_AI.CREATE_CONVERSATION();
l_response := DBMS_CLOUD_AI_AGENT.RUN_TEAM(
team_name => 'FINANCE_NOVA_PRO_TEAM_V2',
user_prompt =>
'For USD invoices due strictly before November 16 2026 '
|| 'with positive outstanding amounts, get AR counts, totals '
|| 'and top five customers and AP counts, totals and top five '
|| 'suppliers. Return both and calculate AR minus AP. '
|| 'Current stored balances only.',
params => '{"conversation_id":"' || l_conversation_id || '"}',
team_exec_id => l_team_exec_id
);
DBMS_OUTPUT.PUT_LINE('Execution: ' || l_team_exec_id);
DBMS_OUTPUT.PUT_LINE(DBMS_LOB.SUBSTR(l_response, 20000, 1));
END;
/

AR and AP summary
The cutoff was November 16, 2026, using DUE_DATE strictly before that date, a positive OUTSTANDING_AMOUNT, and currency USD.
| Measure | AR customer receivables | AP supplier payables |
|---|---|---|
| Overdue invoice count | 72,240 | 385 |
| Outstanding USD | 1,512,705,087.97 | 1,602,366.10 |
AR minus AP = USD 1,511,102,721.87. This is a comparison of current stored overdue balances, including remaining balances on partially paid invoices. It is not available cash, a historical balance reconstruction, or a cash-flow forecast.
Use the reference SQL in step 3 and the ranking queries in step 10 to verify these figures with the same filters.
Top five customers
| Rank | Customer | Outstanding USD |
|---|---|---|
| 1 | Demo Customer 0342 | 3,796,670.65 |
| 2 | Demo Customer 0168 | 3,726,957.19 |
| 3 | Demo Customer 0069 | 3,669,682.88 |
| 4 | Demo Customer 0297 | 3,650,652.58 |
| 5 | Demo Customer 0091 | 3,608,252.49 |
Top five suppliers
| Rank | Supplier | Outstanding USD |
|---|---|---|
| 1 | Demo Supplier 039 | 50,956.08 |
| 2 | Demo Supplier 023 | 44,001.36 |
| 3 | Demo Supplier 038 | 43,287.32 |
| 4 | Demo Supplier 026 | 42,720.32 |
| 5 | Demo Supplier 075 | 41,982.75 |
The two demo datasets differ greatly in size and are not calibrated to represent one actual business. Their balance difference illustrates the workflow rather than a business liquidity assessment.
9. Verify the supervisor and worker history
Use the TEAM_EXEC_ID printed by your run to retrieve its task and tool history. Replace the example ID below with your own. Check each worker’s state, returned report, tool inputs, and tool outputs. History view reference
SET LINESIZE 160
SET PAGESIZE 100
SET LONG 30000
SET LONGCHUNKSIZE 30000
SET VERIFY OFF
COLUMN agent_name FORMAT A30
COLUMN state FORMAT A12
COLUMN tool_name FORMAT A25
COLUMN result FORMAT A100 WORD_WRAPPED
COLUMN input FORMAT A100 WORD_WRAPPED
COLUMN output FORMAT A100 WORD_WRAPPED
-- Use the execution ID printed by RUN_TEAM.
DEFINE review_exec_id = '607BB6AA-2EFD-49FD-E063-BDD3000AC933'
SELECT task_order, agent_name, task_name, state
FROM user_ai_agent_task_history
WHERE team_exec_id = '&review_exec_id'
ORDER BY task_order, start_date;
SELECT task_order, agent_name, result
FROM user_ai_agent_task_history
WHERE team_exec_id = '&review_exec_id'
ORDER BY task_order, start_date;
SELECT agent_name, tool_name, COUNT(*) AS calls
FROM user_ai_agent_tool_history
WHERE team_exec_id = '&review_exec_id'
GROUP BY agent_name, tool_name
ORDER BY agent_name;
SELECT task_order, agent_name, tool_name, input, output
FROM user_ai_agent_tool_history
WHERE team_exec_id = '&review_exec_id'
ORDER BY start_date;

The successful execution recorded:
| Task order | Agent | State |
|---|---|---|
| 0 | FIN_SUP_NOVA_V2 | SUCCEEDED |
| 1 | AR_NOVA_PRO_AGENT | SUCCEEDED |
| 2 | AP_NOVA_PRO_AGENT | SUCCEEDED |
| Worker | SQL tool | Recorded calls |
|---|---|---|
| AR_NOVA_PRO_AGENT | AR_NOVA_PRO_SQL | 2 |
| AP_NOVA_PRO_AGENT | AP_NOVA_PRO_SQL | 2 |
Each worker retrieved its overall count and balance, then its top-five ranking. The supervisor combined both reports into the final brief. These four recorded SQL tool calls are not a count of all model requests and do not establish a dollar cost.
Check that the supervisor and both worker tasks are SUCCEEDED. Then inspect the recorded SQL tool calls and compare the returned figures with independent SQL.
10. Check the returned figures with independent SQL
The history confirms that the workers executed. Independent SQL checks whether their financial figures are correct. Compare the counts and totals with the reference query in step 3, then check both rankings with the same date, currency, and positive-balance filters.
SELECT customer_id, customer_name,
SUM(outstanding_amount) AS overdue_balance
FROM admin.ar_invoices_demo
WHERE due_date < DATE '2026-11-16'
AND outstanding_amount > 0
AND currency_code = 'USD'
GROUP BY customer_id, customer_name
ORDER BY overdue_balance DESC, customer_id
FETCH FIRST 5 ROWS ONLY;
SELECT supplier_id, supplier_name,
SUM(outstanding_amount) AS overdue_balance
FROM admin.ap_invoices_agent_demo
WHERE due_date < DATE '2026-11-16'
AND outstanding_amount > 0
AND currency_code = 'USD'
GROUP BY supplier_id, supplier_name
ORDER BY overdue_balance DESC, supplier_id
FETCH FIRST 5 ROWS ONLY;
WITH balances AS (
SELECT 'AR' AS source, SUM(outstanding_amount) AS total
FROM admin.ar_invoices_demo
WHERE due_date < DATE '2026-11-16'
AND outstanding_amount > 0 AND currency_code = 'USD'
UNION ALL
SELECT 'AP', SUM(outstanding_amount)
FROM admin.ap_invoices_agent_demo
WHERE due_date < DATE '2026-11-16'
AND outstanding_amount > 0 AND currency_code = 'USD'
)
SELECT SUM(CASE WHEN source = 'AR' THEN total ELSE -total END)
AS ar_minus_ap
FROM balances;

Checkpoint: confirm that counts, totals, rankings, cutoff, and currency agree with the returned brief. For the sample data shown, AR minus AP is USD 1,511,102,721.87. Your results will depend on the invoice data in your database.
What each stage contributed
| Stage | Information received | Information returned |
|---|---|---|
| Human request | Business question | Due-date cutoff, USD currency, required totals and rankings |
| Supervisor to AR | Receivables assignment with cutoff and currency | AR worker starts its task |
| AR to supervisor | Results from two AR SQL calls | 72,240 invoices, USD 1,512,705,087.97, and the five customer priorities |
| Supervisor to AP | Payables assignment using the same filters | AP worker starts after AR returns |
| AP to supervisor | Results from two AP SQL calls | 385 invoices, USD 1,602,366.10, and the five supplier priorities |
| Supervisor to human | Both completed worker reports | Combined brief and AR-minus-AP difference |
| Human review | Brief, worker history, and independent SQL | Decision on appropriate next steps |
Conclusion
One finance question now produces a combined AR and AP review brief. The AR Agent retrieves customer receivables, the AP Agent retrieves supplier payables, and the Finance Supervisor brings their findings together.
For this demo, the team returned 72,240 overdue AR invoices totaling USD 1,512,705,087.97 and 385 overdue AP invoices totaling USD 1,602,366.10. Worker history confirmed successful execution, and independent SQL verified the rankings and the USD 1,511,102,721.87 difference.
The result is a brief you can review before deciding the next business action. Use the same approach with your own invoice data: define consistent rules, give each agent a clear task, and verify the returned figures.
Share on LinkedIn ↗Keep your Oracle notebook growing
Get new Oracle walkthroughs in your inbox, or follow the blog in your favorite RSS reader.
Free email delivery through Blogtrottr. Enter and confirm your email on their site; unsubscribe from any email. The free service may include ads. Your email address is not collected by this blog.
Join the discussion
Ask a question, share a result, or add a useful tip.
Leave a comment
Your name and comment will be public. Keep passwords, email addresses, IP addresses, and other private details out of your comment. Cloudflare Turnstile checks submissions to help prevent spam.