Monday, March 9, 2026

#1125 - OIC Agent for diffing between 2 integration flows


Introduction 

I have a very simple use case here - my first integration, TESTER, invokes 3 apps -

  • Netsuite
  • QuickBooks
  • SAP
My second integration, TESTER2, is simply a new version of TESTER. It invokes the 3 apps mentioned above, however, there may be some payload changes, new fields added etc.

I need to know the mapping deltas between these 2. e.g. the map for the Netsuite invoke in TESTER has 4 fields -

  • orderNr
  • customer
  • product
  • price
While the same invoke in TESTER2 expects the extra field, country.

Net, net, I need to do a diff of the maps between both flows.

Leveraging the OIC Factory API

The factory api helps us here, let's say my steps are as follows - 

  • Run TESTER
  • Run TESTER2
  • Get the instanceId of the TESTER flow
  • Use that instanceId to retrieve the activity stream for that instance
  • Retrieve the output of the MAP action for the 3 invokes
  • Get the instanceId of the TESTER2 flow
  • Use that instanceId to retrieve the activity stream for that instance
  • Retrieve the output of the MAP action for the 3 invokes
  • Compare and contrast. Output the deltas.

I use the following factory apis -

I will need to get the latest instance of the integration, based on creationId. Then retrieve the relevant instanceId e.g.

I then use the instanceId to retrieve the activity stream.




Each flow has milestones and I'm only interested in the following mapping milestones - 

"m1Post,m2Post,m3Post"

 Let's check out one of the entries for such a milestone -

The payload field contains the result of the map in xml format. This is what I need to compare and contrast between both flows.


OIC Agent Tools

 
 I'll need to give the agent some tools to work with. I begin with the 2 factory api calls.

I also add a wait tool, to ensure the logs have been updated, before I retrieve them.


The 2 integrations I need to validate are in a separate project, they are called TESTER and TESTER2.

Each invokes the 3 ERP create integrations, but different versions - 

TESTER invokes version 1.0 of each, while TESTER2 invokes version 2.0

I need to see if there are any mapping deltas between the 2 flows.

Now back to my tools, I include another one, which will start the test, invoking TESTER and TESTER2 -


I also include a "Notify" tool to email results to interested parties.

Naturally, all of these tools are integrations, which can be exposed as agent tools with one mouse click.

The final tool I create is - Set Trace to Debug. This is a preparatory step to ensure the 2 integrations, TESTER and TESTER2, are running in Debug mode. This is required to ensure the map results are written to the activity stream.


OIC Agent

I use he ReAct pattern and configure my agent as follows - 

Role is set to - 

you are a tester that runs a test and compares outputs of map actions in OIC flows.


Guidelines set as follows - 

----------

The prompt you receive will contain the input you require to run the test.


#### 1. Run Regression Test

The tool you will use requires the following inputs - interationId1 + version nr - integrationId2 + version nr - resource and order details. Output all these details and then run  **Run Regression Tests**. Then output the response from the tool.


#### 2. Wait for the logs to be updated

Run the **wait** tool, set the waitInSecs parameter to 30.

Output the response.


#### 2. Get the instance id for the first test

Get the instance id of the integration with the id integrationId1, passed in the prompt. Use the **Get OIC Instances** tool for this. Set the timewindow parameter to 1h.

 Parse the response as follows -

2.1. check for the entry for the integrationId1 passed in the prompt. This should match the value of the integrationId field. The instanceId is 3 fields before the integrationId entry. e.g. 

{

            "creationDate": "2026-03-06T18:22:58.448+0000",

            "date": "2026-03-06T18:22:58.848+0000",

       ...

            "instanceId": "gKMQcBmJEfGsAQHrZc0f7Q",

            "instanceReportingLevel": "Debug",

            "integration": "TESTER|01.00.0000|AA_MAERSK_AGENT_REGRES_TESTS",

            "integrationId": "TESTER",


Always take the instanceId with the correct integrationId and the most recent creationDate value, because there may be more entries for the same integrationId.


Output the instanceId you find as "*** First Test Instance Id is ***" + instanceId +  " executed at " + creationDate.


Then take the instanceId field value for the first test and use it to invoke the **Get Instance Activity Stream** tool.


2.2. Parse the result, looking for the field "m1Post", then take the value of the the following payload field and format it as proper XML. Output the result as value of integrationId1 + "  Output of Map1  " + the proper XML, e.g. TESTER Output of Map1 <xml>.


2.3. Parse the result, looking for the field "m2Post", then take the value of the the following payload field and format it as proper XML. Output the result as value of integrationId1 + "  Output of Map2  " + the proper XML, e.g. TESTER Output of Map2 <xml>.

2.4. Parse the result, looking for the field "m3Post", then take the value of the the following payload field and format it as proper XML. Output the result as value of integrationId1 + "  Output of Map3  " + the proper XML, e.g. TESTER Output of Map3 <xml>.


--

#### 3. Get the instance id for the second test

Get the instance id of the integration with the id integrationId2, passed in the prompt. Use the **Get OIC Instances** tool for this. Set the timewindow parameter to 1h.

 Parse the response as follows -

1.1. check for the entry for the integrationId2 passed in the prompt. This should match the value of the integrationId field. The instanceId is 3 fields before the integrationId entry. e.g. 

{

            "creationDate": "2026-03-06T18:22:58.448+0000",

            "date": "2026-03-06T18:22:58.848+0000",

       ...

            "instanceId": "gKMQcBmJEfGsAQHrZc0f7Q",

            "instanceReportingLevel": "Debug",

            "integration": "TESTER2|01.00.0000|AA_MAERSK_AGENT_REGRES_TESTS",

            "integrationId": "TESTER2",


Always select the instanceId with the correct integrationId and the most recent creationDate value, because there may be more entries for the same integrationId.


Output the instanceId you find as "*** Second Test Instance Id is ***" + instanceId +  " executed at " + creationDate.


Then take the instanceId field value for the second test and use it to invoke the **Get Instance Activity Stream** tool.


1.2. Parse the result, looking for the field "m1Post", then take the value of the the following payload field and format it as proper XML.  Output the result as value of integrationId2 + "  Output of Map1  " + the proper XML, e.g. TESTER2 Output of Map1 <xml>.


1.3. Parse the result, looking for the field "m2Post", then take the value of the the following payload field and format it as proper XML.Output the result as value of integrationId2 + "  Output of Map2  " + the proper XML, e.g. TESTER2 Output of Map2 <xml>.


1.4. Parse the result, looking for the field "m3Post", then take the value of the the following payload field and format it as proper XML. Output the result as value of integrationId2 + "  Output of Map3  " + the proper XML, e.g. TESTER2 Output of Map3 <xml>.

--


Compare the structure of the xml payloads from integrationId1 and integrationId2 and output the deltas. I am looking for fields that are added or missing.

Finally send the comparison results as an email using the **Notify** tool. Set the email parameter to niall.commiskey@oracle.com. Set the subject to "Diffing result for " + integrationId1 + " and " + integrationId2.

Set the body to the result of the comparison you just performed.  

--------

Run the Agent

Just up front, the deltas are as follows -

TESTER

  • payload for Netsuite invoke includes orderNr, customer, product, price
  • payload for QuickBooks invoke includes orderNr, customer, product, price
  • payload for SAP invoke includes orderNr, customer, product, price

TESTER2

  • payload for Netsuite invoke includes orderNr, customer, product, price, country
  • payload for QuickBooks invoke includes orderNr, customer, product, price
  • payload for SAP invoke includes orderNr, customer, product, price, status

Let's see if the agent can work this out.

It found the structure delta in the Netsuite map.

It also highlighted TESTER returns the orderNr with the prefix, Netsuite-, excellent.


Map2 - no structural change.

Map3 - TESTER2 has the extra field, status, for the SAP invoke.

I check my email - 

Summa Summarum

Granted, I did this in a hurry. I need to optimise the guidelines, but I hope I have demonstrated the power available to you here. Net, net, the world is your oyster!















 

No comments: