Thursday, December 18, 2025

#1111 - OIC Agentic AI Basics - Human in the Loop (HITL)

 

Introduction

Agentic AI human-in-the-loop (HITL) allows one to intentionally add human intervention to the agent's decision making process.

This could be for compliance purposes, or just an integral part of the business use case.

Back to my order processing example from the previous post, Irish orders are posted to Netsuite, while German orders end up in SAP. But what about orders from other countries? Here I want to inject HITL into the mix. A sales manager needs to decide where the order should go, i.e. Netsuite or SAP.

HITL in OIC

There are 2 parts to HITL -

  1. the workflow definition
  2. the UI

The UI

The form builder is essentially the one we already know from OIC Process.

This is a simple form, where I surface the order details and allow the sales manager to choose the target ERP.

The Workflow Definition

The Start event is defined as follows -

The End event is defined as follows - 


We will do the Data Association later.

Now to the Human Task configuration - 
Now to the Data Association - 

Simple stuff!

I activate both artifacts - 

This HITL workflow will be invoked via an integration - 

This is, by nature of the HITL invoke, an async integration. The trigger is defined as follows -

Request Payload - 

Note the custom header, x-agentic-callback-url. This needs to be defined to enable the callback to our "orchestrator" integration.

That's it!

Now let's amend the Agent Guideline as follows - 

You are an order processing agent responsible for validating incoming orders.

### Order Processing Steps

#### 1. Validate Order
Use the **Validate Order** tool to check if an order passes our validation rules. If the order is invalid, then use the **Notify Customer** tool to inform the customer. Also include the "message" returned by Validate Order. If an order is invalid, processing stops immediately; in such cases, detail exactly why this order failed validation.

#### 2. Check Inventory
Use the **Check Inventory** tool to check if the product is in stock. If the product is out of stock, use the **Notify Customer** tool to inform the customer. Ensure the "message" passed to the Notify Customer tool is relevant and friendly. Remember, we are razor focused on customer satisfaction. If an order's product is no longer in stock,  processing stops immediately; in such cases, detail exactly why this order's processing has been terminated.

#### 3. Create Order in one of our ERP systems
Use the **Create Order SAP** tool to create orders for German customers.
Use the **Create Order Netsuite** tool to create orders for Irish customers.

#### 4. Use HITL to assign orders from other countries to one of our ERP systems 
For orders from other countries, use the  ** HITL For ERP Assignment** tool to enable our sales manager to assign the order to one of our ERP systems. Depending on the output from the ** HITL For ERP Assignment** tool, use either the Create Order SAP or Create Order Netsuite tool to create the order.  


#### 4. Send a confirmation email to the customer
Use the**Notify Customer** tool for this and ensure the email is very friendly.

Run the Agent

I see that the HITL tool has been invoked for the Austrian order -

I check out Project Observability - 

I click the link - Open in workspace -

I click the Assign button, thus completing the human workflow.

I now open the integration observability - 

note the callback to the "orchestrator" integration - ReAct Pattern Intg.

Also note the the Create Order in SAP tool has been invoked. The Notify Customer tool has also been invoked, to send the confirmation email to the customer.

Summa Summarum

This is a very compelling addition to our Agentic AI toolkit. Googling "What is Agentic AI HITL" gives us many buzzwords; phrases such as HITL for nuanced judgement or  HITL enabling ethical considerations. In my case, it was used because my agent alone couldn't reach the confidence level required to route the order to an ERP system.

Net, net, though - you decide when to use leverage this, based on your business requirements.   



















 







No comments: