Thursday, November 19, 2026

Agentic Orchestration Is Just SOA with an LLM Control Plane—And That’s a Good Thing

Agentic Orchestration Is Just SOA with an LLM Control Plane—And That’s a Good Thing

If you have spent years building Service-Oriented Architectures (SOA), Enterprise Service Buses (ESBs), or microservice sagas, looking at modern "Agentic AI" diagrams can trigger a strong sense of déjà vu.

You have discrete services with strict schemas. You have a gateway governing routing, rate limits, and fallbacks. You have state persistence for long-running workflows, and telemetry tracking latency and failures.

Recently, I built a hands-on proof of concept to test where traditional SOA ends and true agentic orchestration begins. Using Java 21, Spring Boot, Spring AI (MCP), Bifrost, PostgreSQL, and local Ollama models (alongside Claude), I wanted to answer one question: What actually changes when you put an LLM in the driver's seat of a microservice mesh?

The short answer: The services don't change, the governance doesn't change, and state management doesn't change. What changes is who writes the glue code.


The Trap: Building a Pipeline and Calling It an "Agent"

When developers first experiment with tool-calling, they often build a fixed sequence like this:

  • LocationService(city) → returns County and State.
  • TimeZoneService(state) → returns the IANA Time Zone.
  • TimeService(zoneId) → returns the formatted local time.

If a user queries "Atlanta", the system executes Step 1 → Step 2 → Step 3 and outputs JSON.

As an architect, your immediate reaction should be: Why is there an LLM here? Every request follows the exact same compile-time path. A standard Spring Boot REST controller handles this 100x faster, cheaper, and with zero chance of hallucination.

To justify an LLM control plane, you have to introduce runtime ambiguity, split domain rules, and multi-turn state interruptions where hardcoded if/else trees become brittle.


The Architecture: Classic SOA Meets MCP

Instead of treating the LLM like magic, I structured the stack using classic SOA discipline, exposing Spring Boot services over the Model Context Protocol (MCP):

  • Service Layer (Spring Boot + Spring AI MCP): Exposes Java @Tool methods with strict Java record DTOs (LocationMatch, TimeZoneInfo, LocationTimeReport) backed by live geocoding APIs and local circuit-breaker fallbacks.
  • The ESB / AI Gateway (Bifrost): Sits in front of the MCP server and model providers—handling tool discovery, routing between local Ollama instances and Claude, rate limits, and fallback policies.
  • State & Telemetry Store (PostgreSQL): Persists workflow checkpoints for human-in-the-loop interruptions and records execution metrics.
  • The Control Plane (LLM Orchestrator): Reads the JSON contracts and dynamically decides which tools to call, when to fan out in parallel, when to self-correct, and when to pause.

Four Patterns That Prove Why the LLM Layer Matters

Once the plumbing was live, testing four specific scenarios revealed where an LLM control plane genuinely outperforms static orchestration:

1. Dynamic Supervisor-Worker Fan-Out ("Springfield")

When you query "Atlanta", the agent executes a linear 3-step chain. When you query "Springfield", LocationService returns four distinct U.S. states across three time zones (Illinois, Missouri, Massachusetts, and Oregon). Without writing a single loop in Java, the LLM acts as a Supervisor: it recognizes the ambiguity, emits parallel getTimeZone and getCurrentTime calls across all four states in a single turn (executed concurrently on Java 21 Virtual Threads), and aggregates the results into a unified JSON array.

2. Guardrail Circuit-Breakers ("Franklin")

What happens when a user queries "Franklin"—a city name that exists in over a dozen U.S. states? Without guardrails, an autonomous fan-out triggers dozens of downstream API calls and burns unnecessary tokens. By encoding a Circuit-Breaker policy (> 5 matches), the agent inspects the intermediate result count, halts the parallel fan-out immediately, and shifts strategy.

3. Stateful Human-in-the-Loop Checkpoints ("Franklin" → "Tennessee")

In traditional SOA, long-running workflows waiting on human approval use the Saga / Process Manager pattern to externalize state. I applied the exact same pattern to the agent:

  • Turn 1 (Pause): When "Franklin" hits the > 5 guardrail, the agent calls saveHitlCheckpoint(), saving the candidate list into a PostgreSQL agent_checkpoints table (status = PAUSED_FOR_HITL) and returning a checkpointId (chk-franklin-1360).
  • Turn 2 (Resume): When the user replies "Use Tennessee for checkpoint chk-franklin-1360", the agent calls resumeHitlCheckpoint(). It loads the saved candidate straight from Postgres—skipping external geocoding APIs completely—marks the row RESUMED, and finishes the calculation.

4. Evaluator-Optimizer Self-Reflection ("Gary, Indiana")

Smaller local models running on a workstation (like Gemma or Qwen via Ollama) are fast and private, but they occasionally make domain assumptions—such as assuming all of Indiana uses America/Indiana/Indianapolis, forgetting that Gary sits in Lake County (America/Chicago).

To fix this without escalating every request to a cloud model, I added a deterministic @Tool called validateTimeReport(draft). When I injected a faulty Eastern Time assumption for Gary, Indiana, the Java validator rejected it with a plain-English critique:

"Split-timezone rule violation: Lake County, Indiana must use 'America/Chicago'."

The local model read the error, autonomously queried the Central Time zone, re-validated until valid: true, and documented its own correction in the final JSON output.


How SOA Maps to Agentic Orchestration

If you are an enterprise developer transitioning into AI engineering, your SOA experience isn't obsolete—it is your biggest advantage:

Architectural Layer Traditional SOA / Microservices Agentic Orchestration
Service Contracts WSDL / OpenAPI / Protobuf MCP Tool Schemas & Java record DTOs
Gateway / ESB Kong / Apigee / MuleSoft AI Gateway (Bifrost) for routing & fallbacks
State Management Saga / BPMN Process State in DB Postgres HITL Checkpoints (PAUSED → RESUMED)
Control Flow Compile-time if/else trees Runtime LLM reasoning over tool outputs
Error Handling Static retries & Dead-Letter Queues Evaluator-Optimizer semantic self-correction

The Golden Rule

The biggest mistake engineering teams make today is replacing clean, deterministic microservice pipelines with probabilistic LLM loops.

Never use an agent where a standard REST pipeline will do. Keep your core services fast, strongly typed, and deterministic. Reserve the LLM control plane for the messy edges where rigid code breaks down: translating unstructured human intent, dynamically fanning out across ambiguous results, pausing for human clarification, and self-healing when domain rules fail.

When you treat an LLM not as a replacement for software architecture, but as a dynamic control plane sitting on top of solid SOA, you get the best of both worlds: the adaptability of AI and the reliability of enterprise engineering.

Monday, August 4, 2025

A2A SDK Function Call

Weather Tool with multiple arguments

Have started looking into google's A2A SDK.  While going through the getting started guide as provided by google, was stuck with function call, with a function having multiple arguments,  Function call example as provided by google was helpful, but it was not clear how to pass the multiple arguments while calling the tool.  Spent two days googling for the answer without luck.

Option 1 - Calling Weather Tool using a simple query 

First option that worked was just pass a single query as argument with the query containing parameters potentially matching to the function arguments.  The tool/function that was used for testing is:

# @title Define the get_weather Tool
def get_weather(city: str, country: str, unit: str) -> dict:
    """Retrieves the current weather report for a specified city.

    Args:
        city (str): The name of the city (e.g., "New York", "London", "Tokyo").
        country (str): The name of the county (e.g., "England", "Great Britan", "USA", "United States", "Japan"
        unit (str): The temperature unit, either 'Celsius' or 'Fahrenheit'.

    Returns:
        dict: A dictionary containing the weather information.
              Includes a 'status' key ('success' or 'error').
              If 'success', includes a 'report' key with weather details.
              If 'error', includes an 'error_message' key.
    """
    print(f"--- Tool: get_weather called for city: {city} ---") # Log tool execution
    print(f"country: {country}")
    print(f"unit: {unit}")
    city_normalized = city.lower().replace(" ", "") # Basic normalization

    # Mock weather data
    mock_weather_db = {
        "newyork": {"status": "success", "report": "The weather in New York is sunny with a temperature of 25°C."},
        "london": {"status": "success", "report": "It's cloudy in London with a temperature of 15°C."},
        "tokyo": {"status": "success", "report": "Tokyo is experiencing light rain and a temperature of 18°C."},
    }

    if city_normalized in mock_weather_db:
        return mock_weather_db[city_normalized]
    else:
        return {"status": "error", "error_message": f"Sorry, I don't have weather information for '{city}'."}

Code used while calling the agent is:

part = types.Part.from_text(text=query)
. . .
. . .
content = types.Content(role='user', parts=[part])

Query used

"What is the weather like in London Britan?  Temperature must be in Fahrenheit"

The output from the execution was:

>>> User Query: What is the weather like in London Britan?  Temperature must be in Fahrenheit
--- Tool: get_weather called for city: London ---
country: Great Britan
unit: Fahrenheit
<<< Agent Response: I am sorry. I cannot fulfill this request. The weather report I received is in Celsius, but you asked for Fahrenheit. I am unable to convert units.
 

Based on the results it is my understanding that the agent able extract required parameters to call the function from the query provided.  Since the implementation was independent of the unit, even though the parameter was not used anywhere in the function other than printing, it is not clear why the agent is looking for a temperature converter. 

Option 2 - Function Call

After stumbling across python api, specially

from google.genai import types

contents = types.Part.from_function_call(
name='get_weather_by_location',
args={'location': 'Boston'}
)

 I modified content generation using the following code:

 part = types.Part.from_function_call(
            name='get_weather',
            args={'city': 'London', 'unit': 'Fahrenheit'}
        )

Output from the code execution was:

>>> User Query: What is the weather like in London Britan?  Temperature must be in Fahrenheit
--- Tool: get_weather called for city: London ---
country: United Kingdom
unit: Fahrenheit
<<< Agent Response: OK. The weather in London, United Kingdom is cloudy with a temperature of 15°C.

which is inline with what was expected by the execution of a function.  No mention of temperature converter tool in the output.

Question 

It is not clear why the difference in the results is different in the two cases?

 

 

 

 

 

 

 

 

 

Saturday, December 19, 2020

Migration from GlassFish Application Server 3.1.2 to GlassFish Application Server 5.1 - EJB and Jersey Rest Services

GlassFish Application Server 3.1.2

Had used Enterprise Java Bean(EJB)s for developing Rest services using Jersey 1.x implementation and GlassFish Application Server 3.1.2.  Stateless EJBs were used using the annotations, and a sample EJB was declared as follows:

@Path("email/address")
@Local
@Stateless(name = "emailAddressProvider", mappedName = "ejb/emailAddressProvider")
public class EmailAddressProvider {

    . . .
    // REST methods
    . . .
}

This worked well without any issues, and was able to use call EJB services from other EJBs using the @EJB annotation.

GlassFish Application Server 5.1

GlassFish Applicaiton Server 5.1 supports Rest services implementation of Jersey 2.1.  While migrating the application from GlassFish Application Server 3.1.2 to 5.1, the code which worked well in GlassFish Application Server 3.1.2, failed to be deployed in GlassFish Applicaiton Server 5.1 with the message that the EJB EmailAddressProvider was not found while serving the Rest Services.  After a few trial and errors, and looking at the deployment of the application in the GlassFish Applicaiton Server it was observed that the EJB was named as EmailAddressProvider, and not emailAddressProvider.  Once the EJB name was changed to EmailAddressProvider,  the REST services were functional as expected.  The final sample code used for defining the REST services using EJBs was as follows:

@Path("email/address")
@Local
@Stateless(name = "EmailAddressProvider", mappedName = "ejb/emailAddressProvider")
public class EmailAddressProvider {

    . . .
    // REST methods
    . . .
}

 

Monday, January 21, 2019

Solr 7.6 - Solr Cloud installation

Solr 7.6 Getting Started

Solr documentation is huge.  In the time constrained age, of interest are the quick getting started.  As such the precise commands used to set up, and running SolrCloud7.6 with a three node external zookeeper ensemble is documented here.

Steps to create Solr Cloud:

  1. Install Zookeeper Ensemble
  2. Add a node
  3. Start Solr using the zookeeper configured in Step 1.
  4. Create ConfigSet
  5. Create Collection
  6. Access SolrCloud GUI

Install Zookeeper

Three node external zookeeper ensemble is used.  The three nodes used are:
  • wolf:2181
  • tiger:2181
  • lion:2181
The variable ZK_HOST would be wolf:2181,tiger2181,lion:2181

Add node

Adding a node to Solr Cloud provides detailed instructions to add a node to the cloud. 

Start Solr

The SolrCloud is also installed on the same nodes.

Start Solr using external zookeeper ensemble

<SOLR_HOME>/bin/solr start -c -z $ZK_HOST

Create ConfigSet

Without getting into detailed explanation of schema.xml, solrconfig.xml and other related configuration files, Sample Configuration files can be used to quickly get started.  Following script would generate a ConfigSet with the name tech, by uploading the configuration files stored in the configuration directory ~/solr/tech/.

#!/bin/sh

SOLR_HOME=~/solr-7.6.0
ZK_HOST=wolf:2181,tiger:2181,lion:2181
CONF_NAME=tech
CONF_DIR=~/solr/tech/

$SOLR_HOME/server/scripts/cloud-scripts/zkcli.sh -z $ZK_HOST -cmd upconfig -confname $CONF_NAME -confdir $CONF_DIR

Configure Zookeeper

Modify ZK_HOST in the file ~/SOLR_HOME/bin/solr.in.sh to read the ZK_HOST

ZK_HOST="wolf:2181,tiger:2181,lion:2181"

Create Collection

Following script can be used to create a new collection by the name mytech using the ConfigSet tech as created previsously with 3 shards per collection, and a replication factor of 2. 


#!/bin/sh



SOLR_HOME=~/solr-7.6.0
COLLECTION_NAME=mytech
CONFIG_NAME=tech
SHARD_COUNT=3
REPL_FACTOR=2
$SOLR_HOME/bin/solr create -c $COLLECTION_NAME -n $CONFIG_NAME -s $SHARD_COUNT -rf $REPL_FACTOR


Access SolrCloud GUI

The SolrCloud thus created can be accessed using the url http://wolf:8983/solr/.  The intutive user interface can be used to explore the various functionality provided by Solr.

Sample Data

Following sample data can be used to insert data from SolrCloud GUI:
id,cat,name,price,inStock,author,series_t,sequence_i,genre_s
0553573403,book,A Game of Thrones,7.99,true,George R.R. Martin,"A Song of Ice and Fire",1,fantasy
0553579908,book,A Clash of Kings,7.99,true,George R.R. Martin,"A Song of Ice and Fire",2,fantasy
055357342X,book,A Storm of Swords,7.99,true,George R.R. Martin,"A Song of Ice and Fire",3,fantasy
0553293354,book,Foundation,7.99,true,Isaac Asimov,Foundation Novels,1,scifi
0812521390,book,The Black Company,6.99,false,Glen Cook,The Chronicles of The Black Company,1,fantasy
0812550706,book,Ender's Game,6.99,true,Orson Scott Card,Ender,1,scifi
0441385532,book,Jhereg,7.95,false,Steven Brust,Vlad Taltos,1,fantasy
0380014300,book,Nine Princes In Amber,6.99,true,Roger Zelazny,the Chronicles of Amber,1,fantasy
0805080481,book,The Book of Three,5.99,true,Lloyd Alexander,The Chronicles of Prydain,1,fantasy

080508049X,book,The Black Cauldron,5.99,true,Lloyd Alexander,The Chronicles of Prydain,2,fantasy


Sample Query

Once the data has been added to the cloud, Solr search can be executed. Screenshot of Sample Query is shown below:


Solr 7.6 Creating Collection using ConfigSets, Errors


Solr7.6 Creating ConfigSet

Solr ConfigSets API provides rest end points for creating, listing, viewing, and deleting ConfigSets.  While trying to create a collection based on the ConfigSet created using the Rest Service as documented:
$ (cd solr/server/solr/configsets/sample_techproducts_configs/conf && zip -r - *) > myconfigset.zip

$ curl -X POST --header "Content-Type:application/octet-stream" --data-binary @myconfigset.zip "http://localhost:8983/solr/admin/configs?action=UPLOAD&name=myConfigSet"

results in the following error message:

ERROR: Failed to create collection 'tech' due to: {192.168.56.102:8983_solr=org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException:Error from server at http://192.168.56.102:8983/solr: Error CREATEing SolrCore 'tech_shard3_replica_n10': Unable to create core [tech_shard3_replica_n10] Caused by: The configset for this collection was uploaded without any authentication in place, and this operation is not available for collections with untrusted configsets. To use this component, re-upload the configset after enabling authentication and authorization., 192.168.56.104:8983_solr=org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException:Error from server at http://192.168.56.104:8983/solr: Error CREATEing SolrCore 'tech_shard1_replica_n2': Unable to create core [tech_shard1_replica_n2] Caused by: The configset for this collection was uploaded without any authentication in place, and this operation is not available for collections with untrusted configsets. To use this component, re-upload the configset after enabling authentication and authorization., 192.168.56.101:8983_solr=org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException:Error from server at http://192.168.56.101:8983/solr: Error CREATEing SolrCore 'tech_shard2_replica_n4': Unable to create core [tech_shard2_replica_n4] Caused by: The configset for this collection was uploaded without any authentication in place, and this operation is not available for collections with untrusted configsets. To use this component, re-upload the configset after enabling authentication and authorization.}

The documentation says that functionality of uploading a configset is enabled by default, but can be disabled via a runtime parameter -Dconfigset.upload.enabled=false. Disabling this feature is advisable if you want to expose Solr installation to untrusted users (even though you should never do that!).

Instead of using the REST service for creating the configset, used the Solr's zkcli.sh file found under <SOLR_HOME>/server/scripts/cloud-scripts/, as shown below:


#!/bin/sh


SOLR_HOME=~/solr-7.6.0
ZK_HOST=wolf:2181,tiger:2181,lion:2181
CONF_NAME=tech
CONF_DIR=~/solr/tech/
$SOLR_HOME/server/scripts/cloud-scripts/zkcli.sh -z $ZK_HOST -cmd upconfig -confname $CONF_NAME -confdir $CONF_DIR


After executing the above command a Solr collection by the name tech as defined in the above script was successfully created.

Sunday, January 13, 2019

Delete all documents from Solr

How can I delete all documents from my index? documented on wiki shows the following commands which can be executed in the browser:
http://localhost:8983/solr/update?stream.body=<delete><query>*:*</query></delete>
http://localhost:8983/solr/update?stream.body=<commit/>
While trying to execute the same in SolrCloud 7.6, you get the message that stream.body is disabled.
RequestDispatcher shows the command to configure remote streaming.  Following is the command:
curl -H 'Content-type:application/json' -d '{"set-property": {"requestDispatcher.requestParsers.enableRemoteStreaming": true}, "set-property":{"requestDispatcher.requestParsers.enableStreamBody": true}}' http://localhost:8983/api/collections/

Wednesday, December 12, 2018

JPA object is not a known entity type

I have been using EclipseLink JPA for the last 7 years successfully.  Recently, while refactoring some of code I encountered the dreaded exception message "object is not a known entity type".  In the absence of a solution for the problem I settled to use the direct approach of using connection from DataSource and executing a PreparedStatement to create a record in the database.  Not giving up on the issue stumbled across the page: https://java-error-messages.blogspot.com/2011/05/is-not-known-entity-type.html.  Based on the explanation I revisited my code, and realized my mistake, and was able to fix the error.

Base class:
@XmlRootElement
@IdClass(ExtTestCostPK.class)
@MappedSuperclass
public class ExtTestCost implements Serializable {
. . .
. . .
. . .
}

Derived Class
@XmlRootElement
@Entity
@Cacheable(false)
@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)
@Table(name="V_EXT_TEST_COSTS")
public class EstlTestCost extends ExtTestCost {
. . .
. . .
. . .
}

Since I was refactoring the code, I was using following code to persist:
ExtTestCost extTestCost = new ExtTestCost();
// set the class attributes

entityManager.persist(extTestCost);

This piece of code was throwing "object is not a known entity type".  Having spent one sleepless night thinking how to solve the problem, after reading the link mentioned above, realizing the mistake that ExtTestCost indeed is not an entity, modified the code to read:
@XmlRootElement
@IdClass(ExtTestCostPK.class)
@MappedSuperclass
public abstract class ExtTestCost implements Serializable {
. . .
. . .
. . .
}

ExtTestCost extTestCost = new EstlTestCost();
// set the class attributes

entityManager.persist(extTestCost);

so that ExtTestCost can not be instantiated, and ExtTestCost was instantiated as EstlTextCost which indeed is an Entity.  Eclipselink JPA created a record in the database, and the exception disappeared.  Lesson learned is declare the base class abstract so that the default no argument constructor provided by the Java compiler can not be used, and you are forced to use a derived class.