<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Enterprise Integration Hub]]></title><description><![CDATA[Enterprise Integration Hub]]></description><link>https://mkonar.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Thu, 24 Sep 2026 09:08:44 GMT</lastBuildDate><atom:link href="https://mkonar.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Building an OCI Generative AI Agent ]]></title><description><![CDATA[Introduction
Oracle Integration Cloud (OIC) support teams spend a significant amount of time digging through integration logs to answer a simple question: “why did this integration fail?” Error messag]]></description><link>https://mkonar.hashnode.dev/building-an-oci-generative-ai-agent</link><guid isPermaLink="true">https://mkonar.hashnode.dev/building-an-oci-generative-ai-agent</guid><dc:creator><![CDATA[Murthi Konar]]></dc:creator><pubDate>Thu, 17 Sep 2026 14:37:35 GMT</pubDate><content:encoded><![CDATA[<h3>Introduction</h3>
<p>Oracle Integration Cloud (OIC) support teams spend a significant amount of time digging through integration logs to answer a simple question: “why did this integration fail?” Error messages are often technical, scattered across multiple integrations, and hard to search using keywords alone.</p>
<p>This blog walks through a working example of an OIC Log Analysis Assistant, built entirely on Oracle Cloud Infrastructure (OCI) Generative AI Agents. The assistant lets a support engineer simply type a question in plain English – such as “List the errors occurred in Integrations” – and get back a structured, human-readable summary drawn from historical OIC error logs.</p>
<p>Beyond testing the agent in the OCI console, this update also shows how to retrieve the Agent Endpoint and call it programmatically from a Python application – the same pattern any chatbot, web app, or automation script would use to talk to the agent.</p>
<p>The end-to-end flow covered in this document is:</p>
<p><code>Store historical OIC error logs in an OCI Object Storage Bucket.</code></p>
<p><code>Create a Data Source that points the Generative AI service at that bucket.</code></p>
<p><code>Create a Knowledge Base that ingests and indexes the data source.</code></p>
<p><code>Create a Generative AI Agent that uses the Knowledge Base to answer questions.</code></p>
<p><code>Test the assistant using the built-in Console Chat interface.</code></p>
<p><code>Retrieve the Agent Endpoint OCID/URL from the Agent's Endpoints tab.</code></p>
<p><code>Call the agent from a simple Python client to simulate a real chat application.</code></p>
<h3>Architecture</h3>
<img src="https://cdn.hashnode.com/uploads/covers/6a9fb914dcbe9c21fccea3ea/ad86c8d5-0e89-4d90-b136-c975fb552544.png" alt="" style="display:block;margin:0 auto" />

<p>Every stage in this pipeline maps directly to a resource inside the Generative AI Agents section of the OCI console, under Analytics &amp; AI. The next sections walk through each of these resources in the order they need to be created, using the actual screens captured from the console, followed by a Python example that connects to the agent through its endpoint.</p>
<h3>Step 1: Create an OCI Object Storage Bucket and Upload the Logs</h3>
<p>The first step is to create a standard OCI Object Storage bucket that will hold the historical OIC diagnostic files. This bucket becomes the raw source of truth that the Generative AI service will later index.</p>
<p>In this example the bucket is named OICLogAIBucket, and it stores the following objects:</p>
<p>OIC Error JsonOIC AI Error Data.json – a structured JSON export of historical OIC integration errors.</p>
<p>using-integrations-oracle-integration-3.pdf – supporting Oracle Integration documentation.</p>
<p>A TEST/ folder used for staging additional files.</p>
<p>OCI Object Storage bucket objects Figure 1: OICLogAIBucket – Objects tab showing the uploaded OIC error log files.</p>
<p><img src="https://cdn.hashnode.com/uploads/covers/6a9fb914dcbe9c21fccea3ea/7fd60d1d-ef96-4e89-9aa0-5b765a91018f.png" alt="OCI Object Storage bucket objects
Figure 1: OICLogAIBucket – Objects tab showing the uploaded OIC error log files." style="display:block;margin:0 auto" /></p>
<p><em>Figure 1: OICLogAIBucket – Objects tab showing the uploaded OIC error log files.</em></p>
<p><strong>Sample Log Content</strong></p>
<p>The uploaded JSON file contains an array of historical error records, each capturing the batch id, integration name, and error message returned by OIC. A few representative entries are shown below.</p>
<p><img src="https://cdn.hashnode.com/uploads/covers/6a9fb914dcbe9c21fccea3ea/bbba8fc2-cc4a-4dca-ada4-a1035d147ea9.png" alt="Sample OIC error JSON content
Figure 2: Sample content of OIC Error JsonOIC AI Error Data.json opened in a text editor." style="display:block;margin:0 auto" /></p>
<p><em>Figure 2: Sample content of OIC Error JsonOIC AI Error Data.json opened in a text editor.</em></p>
<p>Key fields captured for every error record:</p>
<table style="min-width:50px"><colgroup><col style="min-width:25px"></col><col style="min-width:25px"></col></colgroup><tbody><tr><td><p><strong>Field</strong> </p></td><td><p><strong>Description</strong> </p></td></tr><tr><td><p>batch_id </p></td><td><p>Identifier of the OIC integration run/instance. </p></td></tr><tr><td><p>project_name </p></td><td><p>Optional business project associated with the run. </p></td></tr><tr><td><p>integration_name </p></td><td><p>Name of the OIC integration flow that raised the error. </p></td></tr><tr><td><p>error_message </p></td><td><p>The exact error text captured from the OIC diagnostic logs. </p></td></tr></tbody></table>

<p>Recommended file formats for the bucket include JSON, TXT, PDF, and CSV. The richer and more structured the uploaded content, the better the quality of the answers the agent will eventually produce.</p>
<h3>Step 2: Create a Generative AI Data Source</h3>
<p>With the bucket in place, the next step is to create a Data Source inside Generative AI Agents. The data source is the connector that tells the service where the raw content lives – in this case, the OICLogAIBucket created in Step 1.</p>
<p><img src="https://cdn.hashnode.com/uploads/covers/6a9fb914dcbe9c21fccea3ea/aaabbec8-e730-4fe0-a1c6-20e337112c0b.png" alt="Generative AI data source details
Figure 3: genaiagentdatasource – Data source details showing type OCI_OBJECT_STORAGE, the linked OICLogAIBucket, and the ingested object prefix." style="display:block;margin:0 auto" /></p>
<p><em>Figure 3: genaiagentdatasource – Data source details showing type OCI_OBJECT_STORAGE, the linked OICLogAIBucket, and the ingested object prefix.</em></p>
<p>Enabling multi-modal parsing allows the data source to also process embedded images or diagrams if they exist in the uploaded documents, which is useful when troubleshooting guides contain screenshots.</p>
<h3>Step 3: Create a Knowledge Base</h3>
<p>The Knowledge Base is the piece that turns raw files into something an AI agent can actually reason over. When a Knowledge Base is created and linked to a data source, the service automatically chunks the documents, generates embeddings, and builds a searchable index – enabling semantic, natural-language search instead of simple keyword matching.</p>
<p><img src="https://cdn.hashnode.com/uploads/covers/6a9fb914dcbe9c21fccea3ea/5a02f7f6-ec24-47ef-a0d0-05a834153e7e.png" alt="Knowledge bases list page
Figure 4: Generative AI Agents – Knowledge bases list showing OICLogAIKB in Active status." style="display:block;margin:0 auto" /></p>
<p><em>Figure 4: Generative AI Agents – Knowledge bases list showing OICLogAIKB in Active status.</em></p>
<p><strong>Knowledge Base Details</strong></p>
<p>Opening OICLogAIKB shows the general configuration of the knowledge base, including its type, size, and whether hybrid search is enabled. Hybrid search combines keyword and vector-based semantic search, which improves recall for error-message style queries that mix exact codes (like “401 Unauthorized”) with natural language.</p>
<p><img src="https://cdn.hashnode.com/uploads/covers/6a9fb914dcbe9c21fccea3ea/c776253e-ffbb-407f-91f9-a75ad3790afb.png" alt="Knowledge base details tab
Figure 5: OICLogAIKB – Details tab showing type Service managed, size 28.59 MB, 1 ingested file, and hybrid search enabled." style="display:block;margin:0 auto" /></p>
<p><em>Figure 5: OICLogAIKB – Details tab showing type Service managed, size 28.59 MB, 1 ingested file, and hybrid search enabled.</em></p>
<h3>Associating the Data Source</h3>
<p>On the Data sources tab of the knowledge base, the previously created genaiagentdatasource is attached. Once associated, the knowledge base automatically kicks off an ingestion job that reads the bucket contents through the data source and indexes them.</p>
<p><img src="https://cdn.hashnode.com/uploads/covers/6a9fb914dcbe9c21fccea3ea/98c42110-4c85-4d2f-b4ad-e20f40951f3f.png" alt="Knowledge base data sources tab
Figure 6: OICLogAIKB – Data sources tab showing genaiagentdatasource in Active status." style="display:block;margin:0 auto" /></p>
<h3>Step 4: Create the Generative AI Agent</h3>
<p>With an active Knowledge Base in place, the next step is to create the Generative AI Agent itself and point it at that knowledge base. The agent is the conversational layer: it receives the user's question, retrieves relevant chunks from the knowledge base (Retrieval Augmented Generation), and uses the underlying language model to compose a natural-language answer.</p>
<img src="https://cdn.hashnode.com/uploads/covers/6a9fb914dcbe9c21fccea3ea/a2b2ccd2-2873-4ace-8a8d-2d10ad2c4670.png" alt="" style="display:block;margin:0 auto" />

<p>Suggested Agent Instructions</p>
<p>A short system instruction helps the agent stay focused on OIC support scenarios and respond in a consistent, support-friendly format:</p>
<p><code>You are an Oracle Integration Cloud support assistant.</code></p>
<p><code>Answer questions using the knowledge base only.</code></p>
<p><code>When responding:</code></p>
<ul>
<li><p><code>Identify the integration involved.</code></p>
</li>
<li><p><code>Explain the error in plain language.</code></p>
</li>
<li><p><code>Suggest a likely root cause.</code></p>
</li>
<li><p><code>Reference matching historical incidents if available.</code></p>
</li>
</ul>
<p><code>If the information is not available in the knowledge base,</code></p>
<p><code>state that clearly instead of guessing.</code></p>
<h3>Step 5: Test the Agent Using the Console Chat</h3>
<p>Once the agent is active, it can be tested directly from the Chat page under Generative AI Agents. Selecting the OICLogAiAgent and its endpoint opens a conversational window where any support engineer can type a plain-language question about OIC integrations.</p>
<img src="https://cdn.hashnode.com/uploads/covers/6a9fb914dcbe9c21fccea3ea/9a7c5093-6705-4f63-a4ca-0160a9ece804.png" alt="" style="display:block;margin:0 auto" />

<p><img src="https://cdn.hashnode.com/uploads/covers/6a9fb914dcbe9c21fccea3ea/9f151b81-e04f-4715-ab7e-04d4218dcd5a.png" alt="Generative AI Agent chat test
Figure 7: Chat interface – the user asks “List the errors occurred in Integrations” and OICLogAiAgent returns a structured summary sourced from the Knowledge Base." style="display:block;margin:0 auto" /></p>
<p>Figure 7: Chat interface – the user asks “List the errors occurred in Integrations” and OICLogAiAgent returns a structured summary sourced from the Knowledge Base.</p>
<p><code>In this example, the question “List the errors occurred in Integrations” returns a numbered summary that includes the affected integration name and the underlying error for each entry, for example:</code></p>
<p><code>An invalid from-spec / XPath error in CMN_ERP_BULK_IMPORT_INTEGRATION.</code></p>
<p><code>A 401 Unauthorized error while processing authentication at Trigger in XX_AA_GL_JOURNALS_IMPORT_BULK.</code></p>
<p><code>Authentication failures at XXImportJournalsTrigger due to a 401 Unauthorized error.</code></p>
<p><code>An unknown endpoint operation error resulting in a failed status.</code></p>
<p><code>Because the agent is grounded in the Knowledge Base rather than general model knowledge, every answer is traceable back to an actual historical log entry, which makes the responses far more trustworthy for troubleshooting.</code></p>
<p><strong>More Example Questions to Try</strong></p>
<p><code>Why did authentication fail in the Journal Import integration?</code></p>
<p><code>Find integrations that failed due to unauthorized access.</code></p>
<p><code>What are the common causes of a failed status error?</code></p>
<p><code>List all errors for ERP bulk import integrations.</code></p>
<p><code>Explain the XPath validation error in CMN_ERP_BULK_IMPORT_INTEGRATION.</code></p>
<h3>Retrieve the Agent Endpoint for Programmatic Access</h3>
<p>The Console Chat page is great for quick validation, but a real chatbot application – whether it is a Python script, a web app, a Teams/Slack bot, or a mobile app – talks to the agent through its Agent Endpoint using the OCI SDK or REST API, not through the console UI.</p>
<p>Every Generative AI Agent exposes one or more endpoints under its Endpoints tab. This endpoint OCID is the value your application code will use to open a chat session and send messages to the agent.</p>
<p><img src="https://cdn.hashnode.com/uploads/covers/6a9fb914dcbe9c21fccea3ea/221adc76-e8fb-4cda-b031-7718485ad87c.png" alt="Generative AI Agent endpoints tab
Figure 8: OICLogAiAgent – Endpoints tab showing genaiagentendpoint in Active status. The endpoint OCID is used by client applications to connect to the agent." style="display:block;margin:0 auto" /></p>
<p><em>Figure 8: OICLogAiAgent – Endpoints tab showing genaiagentendpoint in Active status. The endpoint OCID is used by client applications to connect to the agent.</em></p>
<p>To retrieve the endpoint:</p>
<p>Open the agent (OICLogAiAgent) in the Generative AI Agents console.</p>
<p>Select the Endpoints tab.</p>
<p>Copy the endpoint name/OCID shown in the list (for example, genaiagentendpoint2025091...) – this is the AGENT_EP_ID your application will call.</p>
<p>Note the region-specific Generative AI Agent runtime service URL (for example, <a href="https://agent-runtime.generativeai.us-chicago-1.oci.oraclecloud.com">https://agent-runtime.generativeai.us-chicago-1.oci.oraclecloud.com</a>) – this is the SERVICE_EP your application will connect to.</p>
<p><mark class="bg-yellow-200 dark:bg-yellow-500/30">Key Point: Because authentication to the endpoint uses your standard OCI configuration/API signing key (the same config used by the OCI CLI and SDKs), any application that can present valid OCI credentials – Python, Java, Node.js, a REST client, or a low-code chatbot platform – can call this same endpoint. The agent itself is not tied to any single application or language.</mark></p>
<h3>Build a Simple Python Chat Application</h3>
<p>With the Agent Endpoint in hand, we can build a minimal Python console application that opens a session with the agent and lets a user ask questions in a loop – effectively a command-line chat application backed by the OICLogAiAgent.</p>
<p>The script uses the OCI Python SDK's generative_ai_agent_runtime module, which provides the client, session, and chat operations needed to talk to a Generative AI Agent endpoint.</p>
<p><strong>Prerequisites</strong></p>
<p>Python 3.8+ with the oci SDK installed (pip install oci).</p>
<p>A configured OCI CLI/SDK config file at ~/.oci/config with a valid profile (API signing key based authentication).</p>
<p>The Agent Endpoint OCID captured in Step 6.</p>
<p>The colorama package for colored console output (pip install colorama) – optional, used only for readability.</p>
<p>Sample Code: ChatwithGENAIAgent.py</p>
<blockquote>
<pre><code class="language-python">import oci
from oci import generative_ai_agent_runtime
import json
from colorama import Fore, Back, Style

CONFIG_PROFILE = "DEFAULT"
config = oci.config.from_file("~/.oci/config", CONFIG_PROFILE)

# AI Agent service endpoint
SERVICE_EP = "https://agent-runtime.generativeai.&lt;your-region&gt;.oci.oraclecloud.com"  # Update this with the appropriate endpoint for your region
AGENT_EP_ID = "ocid1.genaiagentendpoint.oc1.&lt;your-region&gt;.&lt;your-agent-endpoint-ocid&gt;"
welcome_msg = "Welcome to AI Agent - OICLog"

def gen_Agent_Client():
    # Initialize AI Agent runtime client
    genai_agent_runtime_client = generative_ai_agent_runtime.GenerativeAiAgentRuntimeClient(
        config,
        service_endpoint=SERVICE_EP,
        retry_strategy=oci.retry.DEFAULT_RETRY_STRATEGY
    )
    create_session_details = generative_ai_agent_runtime.models.CreateSessionDetails()
    create_session_details.display_name = "Welcome to AI Agent"
    create_session_details.idle_timeout_in_seconds = 30
    create_session_details.description = welcome_msg

    return create_session_details, genai_agent_runtime_client

def Quest_Answer(user_question, create_session_details, genai_agent_runtime_client):
    # Create a Chat Session for AI Agent
    try:
        create_session_response = genai_agent_runtime_client.create_session(
            create_session_details,
            AGENT_EP_ID
        )
    except:
        create_session_details, genai_client = gen_Agent_Client()
        create_session_response = genai_client.create_session(create_session_details, AGENT_EP_ID)

    # Define Chat details and input message/question
    session_details = generative_ai_agent_runtime.models.ChatDetails()
    session_details.session_id = create_session_response.data.id
    session_details.should_stream = False
    session_details.user_message = user_question

    # Get AI Agent Response
    session_response = genai_agent_runtime_client.chat(
        agent_endpoint_id=AGENT_EP_ID,
        chat_details=session_details
    )
    return session_response

print(Style.BRIGHT + Fore.RED + welcome_msg + Style.RESET_ALL)

ses_details, genai_client = gen_Agent_Client()

while True:
    question = input("Enter text (or Enter to quit): ")
    if not question:
        break

    print(Style.DIM + "************ Question for AIAgent ************")
    print(Style.BRIGHT + Fore.RED + question + Style.RESET_ALL)

    chat_response = Quest_Answer(question, ses_details, genai_client)

    print(Style.DIM + "************ Answer from AIAgent ************")
    print(Fore.MAGENTA + chat_response.data.message.content.text + Style.RESET_ALL)

print("*** The End  ***")
</code></pre>
</blockquote>
<p>What the Code Does</p>
<p>Loads OCI credentials from the local config file (config = oci.config.from_file(...)), the same profile used by the OCI CLI.</p>
<p>Creates a GenerativeAiAgentRuntimeClient pointed at the region's SERVICE_EP.</p>
<p>Opens a chat session against the AGENT_EP_ID (the endpoint copied in Step 6) using create_session().</p>
<p>Sends each user question to the agent via chat(), passing the session id and the question text.</p>
<p>Prints the agent's natural-language answer (chat_response.data.message.content.text) back to the console in a simple read-question, print-answer loop.</p>
<p>Running the Application</p>
<p>The script can be run from any Python-capable IDE or terminal. The screenshot below shows it running inside Visual Studio Code, where the file ChatwithGENAIAgent.py is executed and the user asks “List the Integrations that are in error” directly from the integrated terminal.</p>
<p><img src="https://cdn.hashnode.com/uploads/covers/6a9fb914dcbe9c21fccea3ea/784fc1af-d6b4-4fec-8c85-ff3ed87a82d1.png" alt="Python chat client running in VS Code
Figure 9: ChatwithGENAIAgent.py running in the VS Code terminal – the Python client sends the question to the OICLogAiAgent endpoint and prints the grounded answer back to the console." style="display:block;margin:0 auto" /></p>
<p><em>Figure 9: ChatwithGENAIAgent.py running in the VS Code terminal – the Python client sends the question to the OICLogAiAgent endpoint and prints the grounded answer back to the console.</em></p>
<p>The response returned in the terminal matches the same grounded, Knowledge-Base-sourced answers seen earlier in the Console Chat test, confirming that the Python client is talking to the same agent and endpoint.</p>
<p><mark class="bg-yellow-200 dark:bg-yellow-500/30">Important: This Python script is intentionally minimal and is provided only as a basic example to illustrate how to open a session and exchange messages with a Generative AI Agent endpoint. It does not include production concerns such as robust exception handling, retry/backoff logic, secure credential storage, session reuse across requests, streaming responses, or input validation. Treat it as a starting template rather than a production-ready chat client.</mark></p>
<p>Using the Agent in Any Chatbot Application</p>
<p>The Python example in Step 7 is just one possible client. Because the Generative AI Agent is exposed as a standard, authenticated OCI Agent Endpoint, the same integration pattern – create a session, then send chat messages against that session – can be reused from virtually any application stack, not just Python console scripts.</p>
<p><strong>The same OICLogAiAgent endpoint could equally be called from:</strong></p>
<p>A web application (Node.js, Java, .NET) using the corresponding OCI SDK or the REST API directly.</p>
<p>A Microsoft Teams or Slack bot that forwards user messages to the endpoint and posts the response back into the channel.</p>
<p>An Oracle APEX or OIC-based application, calling the agent through a REST connector as part of a larger business process.</p>
<p>A mobile application, where the endpoint call happens from a backend service layer that holds the OCI credentials.</p>
<p>Low-code/no-code chatbot platforms that support custom REST or SDK-based actions.</p>
<p>In every case, the two pieces of information required stay the same: the region's Agent Runtime service endpoint (SERVICE_EP) and the specific Agent Endpoint OCID (AGENT_EP_ID) retrieved in Step 6, combined with valid OCI authentication (API signing key, instance principal, or resource principal depending on where the client runs).</p>
<p><mark class="bg-yellow-200 dark:bg-yellow-500/30">Key Point: Because authentication and session handling are decoupled from any specific programming language, teams can prototype quickly in Python (as shown above) and later re-implement the same calls in whatever language or platform powers their production chatbot, without changing anything on the agent, knowledge base, or data source side.</mark></p>
<h3>Benefits of This Approach</h3>
<p>Faster troubleshooting – support engineers can locate similar historical incidents instantly instead of manually searching logs.</p>
<p>Self-service support – business users can ask questions in plain English without needing deep OIC expertise.</p>
<p>Knowledge retention – institutional troubleshooting knowledge stays available even as support personnel change.</p>
<p>Improved resolution time – common integration issues are identified and resolved much faster.</p>
<p>Scalable design – as new logs are uploaded to the bucket and re-ingested, the agent's knowledge continuously grows.</p>
<p>Channel-agnostic access – the same agent can be surfaced through the console, a Python script, or any production chatbot application via its endpoint.</p>
<h3>Best Practices</h3>
<p>Prefer Structured Logs</p>
<p>JSON or CSV formats retrieve more precisely than unstructured text, since fields like integration_name and error_message can be matched semantically.</p>
<p>Capture Resolution Details, Not Just Errors</p>
<p>Alongside the raw error message, include the root cause, resolution steps, and any workaround so the agent can answer “how do I fix this” questions, not just “what happened.”</p>
<p>Organize the Bucket</p>
<p>Use folders/prefixes to separate content by domain, for example:</p>
<img src="https://cdn.hashnode.com/uploads/covers/6a9fb914dcbe9c21fccea3ea/05e03c7d-332a-4332-a5e8-80664e912e04.png" alt="" style="display:block;margin:0 auto" />

<p><strong>Refresh the Knowledge Base Regularly</strong></p>
<p>Whenever new log files are added to the bucket, trigger a new ingestion job on the data source so the Knowledge Base stays current.</p>
<p>Keep the Agent Instructions Focused</p>
<p>A tight system prompt that tells the agent to answer only from the Knowledge Base reduces the chance of the model guessing or hallucinating an answer.</p>
<p>Harden the Client Before Production Use</p>
<p>Add proper exception handling, retries, timeouts, session lifecycle management, and secure credential storage (for example, OCI Vault or instance/resource principals) before turning the sample Python script into a production chatbot backend.</p>
<h3>Conclusion</h3>
<p>This example shows how a small, well-organized set of Oracle resources – an Object Storage bucket, a Data Source, a Knowledge Base, and a Generative AI Agent – can be combined to turn historical OIC error logs into a conversational troubleshooting assistant. With the Agent Endpoint retrieved and a simple Python client wired up, the same assistant can also be embedded into any chat application your organization already uses.</p>
<p>The whole pipeline is:</p>
<pre><code class="language-plaintext">Object Storage Bucket -&gt; Data Source -&gt; Knowledge Base -&gt; Generative AI Agent Agent Endpoint -&gt; Console Chat  |  Python Client  |  Any Chat App 
</code></pre>
<p>As more OIC logs, troubleshooting guides, and support playbooks are added to the bucket and re-ingested into the Knowledge Base, the assistant becomes progressively smarter – without any change to the underlying agent configuration or to the client applications calling it. This pattern is a strong starting point for any team looking to build enterprise AI assistants over Oracle Integration Cloud diagnostics, or over any other domain-specific operational data, and to expose that assistant through the chat channel of their choice.</p>
]]></content:encoded></item><item><title><![CDATA[Building an MCP Server in Oracle Integration Cloud (OIC)
and Consuming It as a Tool in Oracle AI Agent Studio]]></title><description><![CDATA[​
Overview & Architecture
This guide walks through the complete, end-to-end process of exposing Oracle Integration Cloud (OIC) integrations as a Model Context Protocol (MCP) server, and then consuming]]></description><link>https://mkonar.hashnode.dev/building-an-mcp-server-in-oracle-integration-cloud-oic-and-consuming-it-as-a-tool-in-oracle-ai-agent-studio</link><guid isPermaLink="true">https://mkonar.hashnode.dev/building-an-mcp-server-in-oracle-integration-cloud-oic-and-consuming-it-as-a-tool-in-oracle-ai-agent-studio</guid><dc:creator><![CDATA[Murthi Konar]]></dc:creator><pubDate>Wed, 16 Sep 2026 15:49:23 GMT</pubDate><content:encoded><![CDATA[<p>​</p>
<h3>Overview &amp; Architecture</h3>
<p>This guide walks through the complete, end-to-end process of exposing Oracle Integration Cloud (OIC) integrations as a Model Context Protocol (MCP) server, and then consuming that MCP server as a Tool inside Oracle AI Agent Studio to power a conversational agent. The reference use case built in this document is a Procurement &amp; AP Assistant that can look up Purchase Order (PO) and Accounts Payable (AP) Invoice details from Oracle Fusion ERP using a document number.</p>
<p>At a high level, the solution has four layers:</p>
<p>Oracle Fusion ERP — the system of record for Purchase Orders and AP Invoices, exposed via REST APIs.</p>
<p>OIC Integrations — REST-triggered integrations inside an OIC Integration Project that call Fusion ERP and shape the response.</p>
<p>OIC MCP Server — the same Integration Project, exposed as an MCP server so every active integration becomes a discoverable MCP tool.</p>
<p>Oracle AI Agent Studio — an MCP-type Tool that connects to the OIC MCP server, and an Agent that uses that tool to answer natural-language questions in chat.</p>
<p><strong>Conceptually, the request flow is:</strong></p>
<p>Fusion ERP &lt;--&gt; OIC Integration (REST trigger + Fusion invoke) | v OIC Integration Project --(MCP enabled)--&gt; OIC MCP Server | v AI Agent Studio MCP Tool --(Client Credentials / OAuth2)--&gt; OIC MCP Server | v AI Agent (system prompt + tool) --&gt; Chat / Agent Explorer --&gt; End User</p>
<p>Key Concept: Every OIC integration inside the project becomes an individually selectable MCP tool. The integration's name and description are what the LLM sees when deciding which tool to call, so clear, action-oriented descriptions are essential.</p>
<p><strong>Prerequisites</strong></p>
<p>Access to an OIC instance with the Integration Project and MCP Server feature enabled.</p>
<p>Connections already created for the backend systems you will call (for example ORACLE_FUSION, ERPREST, COMMONREST).</p>
<p>A confidential OAuth2 application (client id / client secret) with the appropriate scope, used for client-credentials authentication to the MCP server.</p>
<p>Access to Oracle Fusion → Tools → AI Agent Studio, with the correct AI Agent Studio admin and runtime duty roles assigned (see the Troubleshooting appendix at the end of this document for the exact roles).</p>
<p>Postman (or an equivalent REST client) to validate the MCP server independently before wiring it into AI Agent Studio.</p>
<h2>Part A — Create the OIC Integration Project and Integrations</h2>
<h3>Step 1: Create a New Integration Project</h3>
<p>In OIC, go to Design → Projects → Create.</p>
<p>Provide a Project Name and Identifier (for example, OracleProject).</p>
<p>Open the project. You will land on the Design tab, which lists Integrations and Connections scoped to this project.</p>
<h3>Step 2: Create the Required Connections</h3>
<p>Before building integrations, make sure the connections that they will invoke are available inside the project (or shared/visible to it). In the reference build, three connections are used:</p>
<p>ORACLE_FUSION — Trigger and invoke connection to Oracle Fusion Cloud REST APIs (used to call the PO and AP Invoice endpoints).</p>
<p>COMMONREST — A generic REST trigger connection used to expose common REST endpoints.</p>
<p>ERPREST — Trigger and invoke connection used for ERP-specific REST calls.</p>
<h3>Step 3: Build an Integration for Each Business Function</h3>
<p>Create one integration per business capability so each becomes its own clean, independently callable MCP tool. In the reference project, four integrations were built:</p>
<p>GETPO — retrieves Purchase Order details by PO number.</p>
<p>GETAPInvoice — retrieves AP Invoice details by invoice number.</p>
<p>InvoiceDocument — reads and extracts invoice data from a base64-encoded PDF file.</p>
<p>For each integration, follow this pattern:</p>
<p>Click the + next to Integrations → select an appropriate style (App Driven Orchestration is typical for a REST-in / REST-out flow).</p>
<p>Add a REST Adapter as the trigger. Define the HTTP method (typically GET), the resource path, and any path or query parameters (for example poNumber or invoiceNumber).</p>
<p>Add an invoke to the ORACLE_FUSION / ERPREST connection, calling the relevant Fusion REST resource (for example the Purchase Orders or Payables Invoices REST endpoint).</p>
<p>Map the trigger's input parameter to the invoke's request (for example poNumber into the query filter of the Fusion REST call).</p>
<p>Map the Fusion REST response back to the trigger's REST response, selecting only the fields you want the agent to see (status, supplier, amount, currency, dates, line details, and so on).</p>
<p>Give the integration a clear, business-friendly Description — this text is what becomes the MCP tool description later, so phrase it the way you would want an LLM to understand when to call it (for example: “Tool to get Purchase Order Details based on PO number”).</p>
<p>Save, then Activate the integration.</p>
<h3>Step 4: Verify All Integrations Are Active</h3>
<p>Once built, confirm every integration you want to expose is Active inside the project. Each Active integration is what becomes an available MCP tool once the project is MCP-enabled.</p>
<p><img src="https://cdn.hashnode.com/uploads/covers/6a9fb914dcbe9c21fccea3ea/ac2dbf87-35c2-4d66-b020-8c88b61e19ff.png" alt="Figure 1 — OIC Integration Project showing active integrations (GETPO_TEST, GETPO, GETAPInvoice, InvoiceDocument) and their connections.
Figure 1 — OIC Integration Project showing active integrations (GETPO_TEST, GETPO, GETAPInvoice, InvoiceDocument) and their connections." style="display:block;margin:0 auto" /></p>
<p><em>Figure 1 — OIC Integration Project showing active integrations (GETPO_TEST, GETPO, GETAPInvoice, InvoiceDocument) and their connections.</em></p>
<h2>Part B — Enable the Project as an MCP Server</h2>
<h3>Step 5: Open the Project's Edit Details Panel</h3>
<p>From the project Design page, open the project-level settings / Edit details panel (the pencil / edit icon in the project header).</p>
<p>Confirm the Name and Identifier of the project.</p>
<p>Optionally add a Description and Keywords — you can use Generate to have OIC suggest these based on the project's integrations.</p>
<h3>Step 6: Enable the MCP Server Checkbox</h3>
<p>In the same Edit details panel, locate the Enable MCP server checkbox.</p>
<p>Check the box. Once enabled, OIC generates and displays the MCP server URL that this project will be reachable at (in the form https:///ic/api/mcp-server/v1/projects/&lt;PROJECT_IDENTIFIER&gt;/mcp).</p>
<p>Copy this URL — you will need it both for Postman testing (Part C) and for the AI Agent Studio MCP Tool configuration (Part D).</p>
<p>Save the changes.</p>
<p><img src="https://cdn.hashnode.com/uploads/covers/6a9fb914dcbe9c21fccea3ea/7806562b-0024-4f54-978d-2b666a6e8bf9.png" alt="Figure 2 — Project Edit details panel with the “Enable MCP server” checkbox selected and the generated MCP server URL displayed.
Figure 2 — Project Edit details panel with the “Enable MCP server” checkbox selected and the generated MCP server URL displayed." style="display:block;margin:0 auto" /></p>
<p><em>Figure 2 — Project Edit details panel with the “Enable MCP server” checkbox selected and the generated MCP server URL displayed.</em></p>
<h3>Step 7: Confirm Integrations Appear as Tools</h3>
<p>Once MCP is enabled, switch to the project's AI Agents / Tools view. Every Active integration in the project is automatically listed here as a Tool, using the integration's own description as the tool description.</p>
<p><img src="https://cdn.hashnode.com/uploads/covers/6a9fb914dcbe9c21fccea3ea/cf597808-26ad-4b48-b1db-7d5717c9e2d2.png" alt="Figure 3 — Project Tools list automatically populated from active integrations: ExtractInvoiceData, GETAPInvoice, and GETPurchaseOrder.
Figure 3 — Project Tools list automatically populated from active integrations: ExtractInvoiceData, GETAPInvoice, and GETPurchaseOrder." style="display:block;margin:0 auto" /></p>
<p><em>Figure 3 — Project Tools list automatically populated from active integrations: ExtractInvoiceData, GETAPInvoice, and GETPurchaseOrder.</em></p>
<p><mark class="bg-yellow-200 dark:bg-yellow-500/30">Tip: If a tool's description looks unclear or too technical in this list, go back and edit the description on the underlying OIC integration — it flows through automatically to both the MCP tool list here and to AI Agent Studio.</mark></p>
<h2>Part C — Test the MCP Server Independently in Postman</h2>
<p>Before wiring the MCP server into AI Agent Studio, validate it directly. This isolates whether any later issue is with OIC/MCP itself or with the AI Agent Studio configuration.</p>
<h3>Step 8: Set Up the Request</h3>
<p>Create a new HTTP request in Postman and set the method to POST.</p>
<p>Set the URL to the MCP server URL captured in Step 6, ending in /mcp (for example <a href="https://-ia.integration.us-ashburn-1.ocp.oraclecloud.com/mcp-server/v1/projects//mcp">https://-ia.integration.us-ashburn-1.ocp.oraclecloud.com/mcp-server/v1/projects//mcp</a>).</p>
<p>On the Authorization tab, configure OAuth 2.0 with Client Credentials: provide the Token URL, Client ID, Client Secret, and Scope for your confidential application, and fetch a new access token.</p>
<h3>Step 9: List Available Tools</h3>
<p>Send an MCP tools/list request (or open the Tools panel in the Postman MCP request view) to confirm the server responds and lists every exposed integration as a tool, for example:</p>
<p>EXTRACTINVOICEDATA — Tool to read the Invoice data from base64 data from invoice pdf file.</p>
<p>GETAPINVOICE — Tool to fetch the AP Invoice details from Oracle using Invoice Number.</p>
<p>GETPURCHASEORDER — Tool to get Purchase Order Details based on PO number.</p>
<h3>Step 10: Call a Specific Tool</h3>
<p>Send a tools/call request with a JSON body specifying the method and the target tool name, for example:</p>
<p>{ "method": "tools/call", "params": { "name": "EXTRACTINVOICEDATA", "arguments": {} } }</p>
<p>Click Run / Send. A green Connected status and a successful response confirm the MCP server is reachable, authenticated, and correctly routing to the underlying OIC integration.</p>
<p><img src="https://cdn.hashnode.com/uploads/covers/6a9fb914dcbe9c21fccea3ea/06b4cbd8-27a2-4784-98f3-e7a07e9966be.png" alt="Figure 4 — Postman request to the OIC MCP server showing the discovered tools (left), the tools/call request body (right), and a Connected response status.
Figure 4 — Postman request to the OIC MCP server showing the discovered tools (left), the tools/call request body (right), and a Connected response status." style="display:block;margin:0 auto" /></p>
<p><em>Figure 4 — Postman request to the OIC MCP server showing the discovered tools (left), the tools/call request body (right), and a Connected response status.</em></p>
<p><mark class="bg-yellow-200 dark:bg-yellow-500/30">Troubleshooting: If this step fails, check the token request first (invalid_client, 401, or 404 usually point to a wrong Token URL, expired secret, or using the MCP path instead of the auth path). Only proceed to AI Agent Studio once this Postman test succeeds.</mark></p>
<h2>Part D — Create an MCP Tool in Oracle AI Agent Studio</h2>
<h3>Step 11: Add a New Tool</h3>
<p>In Oracle Fusion, go to Navigator → Tools → AI Agent Studio.</p>
<p>Select the Resources tab → Tools subtab → Add.</p>
<p>Set Tool Type to MCP.</p>
<h3>Step 12: Configure Authorization and Connection</h3>
<p>Before AI Agent Studio can list the remote tools, it needs to authenticate against the OIC MCP server using the same credentials validated in Postman.</p>
<p>MCP Instance URL: paste the base MCP server URL from Step 6 (up to and including /projects//).</p>
<p>Credential Type: select Client Credentials.</p>
<p>Transport Type: select Streamable HTTP.</p>
<p>Token URL: paste the OAuth2 token endpoint used in Postman (for example https:///oauth2/v1/token).</p>
<p>Client Credentials Connection Configuration: paste a single JSON object containing grant_type, client_id, client_secret, and scope — using the exact same values that worked in Postman, for example:</p>
<p><code>{ "grant_type": "client_credentials", "client_id": "&lt;client_id&gt;", "client_secret": "&lt;client_secret&gt;", "scope": "&lt;resource_scope&gt;urn:opc:resource:consumer::all" }</code></p>
<p>Click Generate (or Update) to authenticate and pull the list of remote tools from the MCP server.</p>
<p><img src="https://cdn.hashnode.com/uploads/covers/6a9fb914dcbe9c21fccea3ea/a066c2b8-f21b-4012-85d8-87db00f17d04.png" alt="Figure 5 — MCP Authorization and connection panel in AI Agent Studio: Instance URL, Credential Type, Transport Type, Token URL, and the Client Credentials JSON block.
Figure 5 — MCP Authorization and connection panel in AI Agent Studio: Instance URL, Credential Type, Transport Type, Token URL, and the Client Credentials JSON block." style="display:block;margin:0 auto" /></p>
<p><em>Figure 5 — MCP Authorization and connection panel in AI Agent Studio: Instance URL, Credential Type, Transport Type, Token URL, and the Client Credentials JSON block.</em></p>
<p><mark class="bg-yellow-200 dark:bg-yellow-500/30">Important: This exact JSON structure is required by AI Agent Studio's MCP tool type. Entering the same client id / secret as separate fields (as some REST clients allow) will not work here — it must be one JSON object in this field.</mark></p>
<h3>Step 13: Complete the Tool Details</h3>
<p>Tool Name: give it a clear name, for example MCPTool (or something more specific such as ERP_Procure_Pay_MCP).</p>
<p>Tool Code: auto-populates from the name (for example MCPTOOL); adjust if needed — alphanumeric only.</p>
<p>Family / Product: select the appropriate classification (for example FIN / Financial Common).</p>
<p>Require Human Approval: leave Off for a read-only lookup tool like this one; turn On only if the tool can take transactional actions.</p>
<p>Description: write a clear, action-oriented description that tells the LLM exactly what the tool does and when to call it, for example: “Retrieves Purchase Order (PO) and Accounts Payable (AP) invoice details from Oracle Fusion using a document number. Accepts either a Purchase Order number or an AP Invoice number as input and returns the matching record's key attributes — including status, supplier, amount, currency, dates, and line-level details. Use this tool whenever a user asks to look up, check, or view a PO or AP invoice by its number.”</p>
<p><img src="https://cdn.hashnode.com/uploads/covers/6a9fb914dcbe9c21fccea3ea/1d9d0e0f-4d59-4489-b3fb-75251221e95a.png" alt="Figure 6 — Edit Tool screen for the MCP tool, showing Tool Type, Name, Code, Family, Product, Description, and the Authorization and connection section underneath.
Figure 6 — Edit Tool screen for the MCP tool, showing Tool Type, Name, Code, Family, Product, Description, and the Authorization and connection section underneath." style="display:block;margin:0 auto" /></p>
<p><em>Figure 6 — Edit Tool screen for the MCP tool, showing Tool Type, Name, Code, Family, Product, Description, and the Authorization and connection section underneath.</em></p>
<h3>Step 14: Select Which Remote Tools to Expose</h3>
<p>After a successful connection, AI Agent Studio displays every remote tool discovered on the MCP server. Preview each one and check the tools you want this Tool object to expose to your agent.</p>
<p>EXTRACTINVOICEDATA — Tool to read the Invoice data from base64 data from invoice pdf file.</p>
<p>GETAPINVOICE — Tool to fetch the AP Invoice details from Oracle using Invoice Number.</p>
<p>GETPURCHASEORDER — Tool to get Purchase Order Details based on PO number.</p>
<p><img src="https://cdn.hashnode.com/uploads/covers/6a9fb914dcbe9c21fccea3ea/e4f35b09-6aca-4cfd-bba1-672dad0ff2be.png" alt="Figure 7 — Available MCP Tools list with checkboxes to select which remote tools this AI Agent Studio Tool should expose.
Figure 7 — Available MCP Tools list with checkboxes to select which remote tools this AI Agent Studio Tool should expose." style="display:block;margin:0 auto" /></p>
<p><em>Figure 7 — Available MCP Tools list with checkboxes to select which remote tools this AI Agent Studio Tool should expose.</em></p>
<p>Select the tools relevant to this agent (for this use case: GETAPINVOICE and GETPURCHASEORDER, and optionally EXTRACTINVOICEDATA).</p>
<p>Click Save / Update to persist the Tool.</p>
<p>Troubleshooting: If Save returns a 403 (“Failed to save MCP credentials”) even though Postman worked, this is almost always a Fusion security/privilege gap rather than an MCP problem — see the Troubleshooting appendix for the exact roles and privileges to check.</p>
<h2>Part E — Build the Agent</h2>
<h3>Step 15: Create a New Agent</h3>
<p>Go to AI Agent Studio → Agents (or the Agent Team you are building) → Add.</p>
<p>Name the agent, for example Procurement &amp; AP Assistant.</p>
<p>Provide a short Agent Description, for example: “An assistant agent that retrieves Purchase Order and AP invoice details from Oracle Fusion based on a document number.”</p>
<h3>Step 16: Attach the MCP Tool</h3>
<p>In the agent's Tools section, add the MCP Tool created in Part D (for example MCPTool / ERP_Procure_Pay_MCP).</p>
<p>Confirm both exposed functions (GETPURCHASEORDER and GETAPINVOICE) are available to the agent.</p>
<h3>Step 17: Write the System Prompt</h3>
<p>The system prompt tells the agent when to call which underlying MCP function and how to present the result. A representative prompt:</p>
<p>You are the Procurement &amp; AP Assistant, an AI agent that helps users retrieve Purchase Order and AP Invoice information from Oracle Fusion.</p>
<ul>
<li><p>If the user references a PO number, call getPurchaseOrder(poNumber).</p>
</li>
<li><p>If the user references an AP invoice number, call getAPInvoice(invoiceNumber).</p>
</li>
<li><p>If the request is ambiguous, ask the user to clarify PO vs. invoice.</p>
</li>
<li><p>Present status, supplier, amount, currency, dates, and line details clearly.</p>
</li>
<li><p>Only report data returned by the tools; never fabricate values.</p>
</li>
</ul>
<p>Save the agent.</p>
<h2>Part F — Test the Agent in Chat</h2>
<h3>Step 18: Open the Chat / Agent Explorer</h3>
<p>Open the agent's Chat Debugger (design-time testing) or the published Agent Explorer chat window. Confirm the header shows the agent connected to the correct MCP tool (for example “MCP: erp-procure-pay”) and to Fusion ERP.</p>
<h3>Step 19: Ask a Purchase Order Question</h3>
<p>Example query: “Get details of PO PO-123.” The agent should call the underlying getPurchaseOrder function with the extracted PO number and return a formatted card with status, supplier, buyer, dates, business unit, currency, and line items.</p>
<p><img src="https://cdn.hashnode.com/uploads/covers/6a9fb914dcbe9c21fccea3ea/bef39e8d-b08e-457c-b4ac-b567a04ab175.png" alt="Figure 8 — Chat showing the agent calling getPurchaseOrder(poNumber=&quot;PO-123&quot;) via the MCP tool and returning the formatted PO card.
Figure 8 — Chat showing the agent calling getPurchaseOrder(poNumber=&quot;PO-123&quot;) via the MCP tool and returning the formatted PO card." style="display:block;margin:0 auto" /></p>
<p><em>Figure 8 — Chat showing the agent calling getPurchaseOrder(poNumber="PO-123") via the MCP tool and returning the formatted PO card.</em></p>
<h3>Step 20: Ask a Follow-Up AP Invoice Question</h3>
<p>Example follow-up: “Also get details of AP Invoice INV-11.” The agent should call getAPInvoice with the extracted invoice number, correctly relate it back to the earlier PO, and surface useful next-step suggestions.</p>
<p><img src="https://cdn.hashnode.com/uploads/covers/6a9fb914dcbe9c21fccea3ea/2b9fc271-c15c-49a6-923f-cad3b7a3118a.png" alt="Figure 9 — Chat showing the agent calling getAPInvoice(invoiceNumber=&quot;INV-11&quot;) and returning the AP Invoice card, matched to PO-123, with suggested follow-up actions.
Figure 9 — Chat showing the agent calling getAPInvoice(invoiceNumber=&quot;INV-11&quot;) and returning the AP Invoice card, matched to PO-123, with suggested follow-up actions." style="display:block;margin:0 auto" /></p>
<p><em>Figure 9 — Chat showing the agent calling getAPInvoice(invoiceNumber="INV-11") and returning the AP Invoice card, matched to PO-123, with suggested follow-up actions.</em></p>
<h3>Step 21: Validate and Iterate</h3>
<p>Confirm the correct tool was called for each question (check the “Called (...) via ” trace line above each answer).</p>
<p>Test edge cases: an ambiguous bare number, a non-existent PO/invoice number, and a mixed request referencing both a PO and an invoice.</p>
<p>Refine the Tool description, Sample Queries, and System Prompt if the agent selects the wrong function or misformats the response.</p>
<p>Once validated, publish the agent so it is available in the Agent Explorer / flow of work.</p>
]]></content:encoded></item></channel></rss>