Introduction:
Every business runs on documents that trigger critical processes and decisions. Yet finding the right information often means hours of manual review. Now multiply that across thousands of documents.
Oracle Integration (OIC) Workflow AI Agents, powered by Retrieval-Augmented Generation (RAG), transform this challenge by understanding business documents, extracting key insights, and orchestrating governed workflows that deliver faster, more accurate, and auditable outcomes.
Business Scenario:
Organizations often manage large volumes of partner and customer contracts that directly impact pricing, incentives, payouts, or revenue-sharing processes. Manually reviewing these agreements is time-consuming, error-prone, and difficult to scale.
An AI-driven contract processing solution automates the intake, interpretation, and processing of contract documents. It converts complex agreements into structured, actionable data that downstream teams and systems can use.
• Faster and more accurate payout processing
• Reduced manual review effort and operational errors
• Improved auditability, compliance, and dispute resolution
• A centralized source of truth for Finance, Sales Operations, and partner management teams
Business Challenges:
Traditional automation works well when inputs are predictable. Contracts, however, are usually unstructured and vary by customer, partner, region, and negotiated terms. This creates multiple challenges:
• Key clauses may appear in different sections or formats across contracts.
• Business rules may require contextual interpretation.
• Manual validation slows down onboarding and downstream processing.
• Hardcoded workflows are difficult to maintain when business rules change.
• Lack of traceability can create audit and compliance risks.
Why Agentic AI ?
Agentic AI is useful here because the solution needs more than simple text extraction. The agent must understand contract context, retrieve relevant evidence, apply approved business logic, and invoke enterprise services in the right sequence.
In this implementation, the AI Agent acts as a controlled workflow step rather than an independent black box. It uses enterprise-approved tools to retrieve contract context, generate structured output, persist results, and handle exception scenarios.
How it helps:
• Understands business context instead of relying only on keyword extraction.
• Uses retrieved contract chunks as evidence, reducing hallucination risk.
• Invokes only configured tools and integrations, improving governance.
• Supports exception handling through business rules and human review when needed.
• Keeps the overall process scalable, traceable, and easier to maintain.
Solution Overview
In this blog, we demonstrate how contract processing is implemented using Oracle Integration (OIC), Oracle APEX, Object Storage, Oracle Database 26ai, and a workflow-driven AI Agent.
At a high level, the solution follows this flow:
1. Users upload contract documents through the APEX UI.
2. Documents are stored in Object Storage and OIC is triggered asynchronously.
3. OIC orchestrates status updates, ORDS calls, and database procedures.
4. Oracle Database 26ai performs document chunking, embedding generation, and vector search.
5. The AI Agent retrieves relevant contract chunks and extracts structured data.
6. The final output and processing status are persisted back to the database and shown in APEX.
Architecture at a Glance
The architecture keeps orchestration, AI processing, storage, and monitoring loosely coupled while allowing the workflow to remain centrally governed by OIC.
APEX UI -> Object Storage -> OIC Orchestration -> Oracle Database 26ai RAG Pipeline -> AI Agent Tool Execution -> Database Persistence -> APEX Monitoring

In this blog, we demonstrate how contract processing is implemented using Oracle Integration (OIC), APEX, Oracle Database 26ai, and a workflow-driven AI Agent by combining deterministic orchestration with controlled intelligent processing.
The solution follows the below workflow sequence to orchestrate document ingestion, AI extraction, and database persistence.
1. Document Upload & Workflow Orchestration
- Users upload contract documents through the APEX UI, where files are stored in Object Storage and OIC is triggered using a fire-and-forget integration pattern.
- OIC acts as the central workflow orchestrator, managing status updates, invoking ORDS services, and coordinating Oracle Database 26ai processing procedures.
2. In-Database AI Processing & Data Extraction
- The Contract Doc Extract Flow performs in-database chunking, embedding generation, and vector processing using Oracle 26ai Database to power the RAG pipeline.
- The AI Agent operates as a controlled workflow step, retrieving relevant document chunks and performing structured data extraction, and persisting results into database through tools.
- If additional business-specific data is identified, the workflow automatically processes and stores the associated tier-based details.
3. Monitoring, Governance & Enterprise Architecture
- Status updates are continuously written back to the database, enabling the APEX UI to provide real-time tracking and monitoring.
- The solution follows a workflow-centric and loosely coupled OCI architecture where Oracle Integration (OIC) governs execution flow and the AI Agent functions as a controlled processing component.
- The overall implementation delivers scalable, traceable, and enterprise-ready automation with strong reliability and predictable execution behavior.
Technical Approach
Oracle Integration provides the automation layer that converts AI Agent intent into enterprise actions. The solution is composed of reusable tools, database procedures, decision logic, and workflow controls.
Oracle Integration AI Agents
Oracle Integration enables agentic AI capabilities by exposing enterprise APIs, integrations, and data services as reusable tools. Instead of following a rigid one-size-fits-all pipeline, the agent can invoke approved tools based on the contract context and workflow state.
In this use case, the agent participates in the contract processing lifecycle across semantic retrieval, extraction, validation, persistence, and exception handling. This turns traditional integrations into intelligent, adaptive, and governed workflows.
Knowledge Base and RAG Framework
Oracle Database 26ai provides the foundation for the Retrieval-Augmented Generation (RAG) framework. Contract documents stored in Object Storage are processed through database procedures that parse the document, split it into chunks, generate vector embeddings, and support semantic search.
During extraction, the agent retrieves only the most relevant chunks using vector similarity search. This keeps the generated response grounded in enterprise contract data.
This enables the agent to:
• Extract contract clauses contextually
• Validate business information against retrieved evidence
• Generate structured outputs and summaries
• Reduce hallucination by relying on retrieved enterprise data
Human-in-the-Loop Governance
Human validation remains important when the agent encounters ambiguous content, low-confidence extraction, or policy exceptions. In those scenarios, the workflow can route the output to a user for review and correction through APEX or workflow approvals.
This creates a balanced model where AI accelerates processing, while humans remain involved for oversight, governance, and exception handling.
Modular Integration Architecture
The solution uses modular utility integrations in OIC. Each integration performs a specific reusable function, which keeps the architecture composable and easier to maintain.
• Contract Doc Extract Flow: Handles document upload coordination, stores contracts in Object Storage, invokes vectorization procedures, and coordinates downstream AI-agent processing.
• DOC_CHUNK_RETRIEVER_NEW: Retrieves relevant document chunks from Oracle Database 26ai using semantic search.
• FINAL_OUTPUT_INSERTER: Persists structured AI-generated output into the database.
• insert_override_growth_db: Stores tier-based payout, override, or exception details when identified.
This modular design allows the AI Agent to orchestrate reusable enterprise capabilities without tightly coupling business logic to a single monolithic workflow.

Create Tools
Tools are externally callable capabilities that an agent can invoke to perform an action or retrieve information. In OIC, an integration can be exposed as a tool and associated with the AI Agent.
For this use case, multiple integrations are exposed as tools so the agent can retrieve document chunks, persist final output, and store override details when needed.
Good tool design should include:
• Clear tool descriptions so the agent understands when to use the tool.
• Well-defined input and output parameters.
• Usage guidelines that explain formatting rules, required identifiers, and execution constraints.
• Strict boundaries so the agent invokes only approved enterprise actions.


Agent Patterns
Agent Patterns provide a reusable way to define an agent’s reasoning and execution behavior. In this implementation, the ReAct pattern (26.7) is used as the agent pattern.
The ReAct pattern, short for Reasoning and Acting, enables an agent to reason through a task, determine the next best action, execute that action, observe the result, and continue the cycle until the required outcome is achieved. This makes it suitable for use cases where the agent needs to interpret user intent, invoke tools or integrations, retrieve information, evaluate intermediate responses, and take guided actions.
ReAct is available in two modes:
ReAct for OCI GenAI
This mode uses the ReAct reasoning-and-action model with OCI Generative AI LLMs. It is suitable when the agent should use OCI-native GenAI capabilities for natural language understanding, contextual reasoning, response generation, and enterprise workflow execution.
Refer Add the ReAct for OCI GenAI Agentic AI Pattern for more details.
ReAct
This mode uses the standard ReAct reasoning-and-action model with the flexibility to connect to an external LLM(i.e. Creating OpenAI LLM connection with API key). It is suitable when the agent needs structured reasoning, tool invocation, and workflow orchestration while using an externally configured language model.
Refer Add the ReAct Agentic AI Pattern for more details.
Although other agent patterns such as Plan (Add the Plan Agentic AI Pattern/Add the Plan for OCI GenAI Agentic AI Pattern) is available, it is not used in this implementation. The current solution is based only on the ReAct pattern, which provides a governed and extensible foundation for consistency, security, compliance, and scalability across agent-based use cases.


After the pattern is saved, Oracle Integration creates the underlying orchestration components required to govern the agent’s behavior. These components help ensure that execution remains predictable and aligned with the configured guidelines.

Create AI Agents
The AI Agent is created using the selected Agent Pattern and then associated with the required tools, such as DOC_CHUNK_RETRIEVER_NEW, FINAL_OUTPUT_INSERTER, and insert_override_growth_db.
For this contract-processing use case, the agent is configured with a strict tool-first execution policy:
• Start by invoking DOC_CHUNK_RETRIEVER_NEW using the provided doc_extract_id.
• Extract data only from the retrieved chunks; do not infer missing values.
• Generate output strictly in the expected JSON schema.
• Invoke FINAL_OUTPUT_INSERTER to persist the extracted data.
• Invoke insert_override_growth_db only when override or tier-based payout details are present.
• Update status appropriately if any insertion or processing error occurs. These guidelines enforce no hallucination, no schema deviation, and no free-text responses, making the agent suitable for controlled enterprise automation.

Execution Flow

Step 1: Upload in APEX
The process starts in the APEX-based Contract Commission AI Agent UI. Users upload the contract document and provide required metadata such as account name, category, and contact details. Once submitted, the file is stored in Object Storage and unique identifiers such as doc_extract_id and ContractId are generated.
Step 2: OIC Orchestration with Oracle Database 26ai
OIC initiates the Contract Doc Extract Flow, updates the processing status, and invokes the embedding procedure in Oracle Database 26ai by passing the Object Storage document location. The database converts the document to text, splits it into chunks, and generates vector embeddings for semantic search.

Step 3: Workflow Agent for Extraction
After the document is indexed, the workflow invokes the AI Agent. The agent first calls DOC_CHUNK_RETRIEVER_NEW to retrieve relevant document chunks. It then extracts structured contract data from those chunks, generates JSON output, and persists the result using FINAL_OUTPUT_INSERTER. If override payout data exists, it invokes insert_override_growth_db to store the tier-based details.

Step 4: Output and Status Tracking
After processing is complete, extracted data and status updates are stored in the database. The APEX UI reflects statuses such as Document Uploaded, Extraction In Progress, and Extraction Completed. Users can review the extracted details, download results, and validate outputs. OIC monitoring and database queries support troubleshooting and audit checks.

Monitoring and Troubleshooting
Oracle Integration provides centralized observability for integrations, AI Agents, and workflow tasks. Teams can trace execution flows, identify failures, inspect dependencies, and troubleshoot issues from a unified monitoring experience.
This improves operational visibility and reduces the time required to diagnose problems across document ingestion, vector processing, agent execution, and database persistence.

Business Outcomes
• Reduced manual contract review effort
• Faster contract-to-payout processing
• Improved extraction consistency and governance
• Better traceability for audit and compliance
• Scalable architecture for future document-processing use cases
• Reusable integration tools that can be orchestrated by AI Agents
Conclusion and Key Takeaways
• Workflow-driven AI Agents combine deterministic orchestration with intelligent document understanding.
• OIC governs the end-to-end execution flow while the AI Agent operates as a controlled processing step.
• Oracle Database 26ai provides in-database chunking, embeddings, and semantic retrieval for grounded extraction.
• Strict tool-governed execution reduces hallucination and keeps processing aligned with enterprise rules.
• Modular integrations improve reuse, maintainability, and extensibility.
• Centralized monitoring across OIC, database status, and APEX improves troubleshooting and lifecycle management.


