In a recent interview, Microsoft CEO Satya Nadella predicted that:
The Biz App System of the Future is a thin UI over a "bunch of biz logic" for a database, and
That "bunch of biz logic" will be captured and enforced by one or more Business Logic Agents
Nadella’s prediction is important because it acknowledges the major drawbacks of conventional development approaches. Whether for SaaS or internal apps, they are time consuming, expensive, error-prone and needlessly complex. As Nadella states, business logic is the largest part of these systems.
In the ideal scenario, Business Logic Agents:
Can be created from Natural Language using GenAI
Are declarative, enabling users to operate at a very high level of abstraction ("what, not how")
Leverage existing tools and infrastructure
Provide adequate governance (the comments following the interview raised serious concerns here)
This reference implementation will investigate:
How a Business Logic Agent can capture and enforce business logic
How to address governance concerns when entrusting the integrity of valuable data to probabilistic AI agents
Business Logic
The iceberg under the API
We believe that a useful Business Logic Agent must provide:
Integration logic for participating in a larger enterprise-level interaction with other systems (this was an example provided by Nadella in his interview)
Domain logic for multi-table derivations and constraints
Accessibility, by APIs and messages
We propose that the business logic be:
Provided in Natural Language
Expressed as Rules (intents) of how data is to be derived and validated
Declarative, ensuring:
Automatic Reuse: the rules are automatically applied to relevant transactions (inserts, updates, deletes)
Automatic Ordering: rules can be stated (or later added) in any order
Automatic Data Access: the Business Logic Agent automates and optimizes data access
Spreadsheets also provide declarative logic. The sum formula watches and reacts to inserts, updates and deletes in the AmountTotal column. A Business Logic Agent can provide the same level of abstraction for transaction processing.
The process involves several familiar aspects of AI technology:
GenAI Creation – Users provide a natural language prompt in a browser. This generates an executable Business Logic Agent prototype project - a database, APIs, an admin app, and logic. Users can iterate, and request logic suggestions from GenAI.
AI Governance – Human-in-the-loop validation is essential. Developers review and extend logic using standard Python libraries and IDEs, and then deploy standard containers.
Agentic Operation – The Business Logic Agent processes API calls and messages, applying domain logic to maintain data integrity and integration logic to interoperate with systems and services.
To help illustrate the process, let's use a customer credit check and order/entry system as an example.
Submit the prompt below to GenAI (click here). It creates and runs the system shown at right. When the app starts, click the blue Backend Admin button. Use this to verify operation (next section).
Create a system with customers, orders, items and products. Include a notes field for orders.
Domain Logic: Use case: Check Credit
1. The Customer's balance is less than the credit limit
2. The Customer's balance is the sum of the Order amount_total where date_shipped is null
3. The Order's amount_total is the sum of the Item amount
4. The Item amount is the quantity * unit_price
Integration Logic
5. The Item unit_price is copied from the Product unit_price
You can then iterate ("add customer addresses"), and ask the system to suggest logic.
The prompt at left creates this system:
- Admin App (use for testing)
- Business Logic Agent
- API - with logic
- Test Database
The key value of the logic is to address all of the Use Cases from simple rules defining the end state. Use the Admin App to make changes, and verify the computations and validations:
Select an unshipped order and increase the quantity of an item significantly.
The balance should reflect the change, causing the credit check to fail.
The transaction should be rolled back with a constraint message.
Delete an item from an unshipped order – observe the balance change.
Add an item to an unshipped order – verify the updated balance.
Select a different product for an item – confirm the updated balance.
And so forth
Running in Docker or an IDE allows you to observe the rule execution for each row, ensuring expected results. This provides valuable insight to ensure you are getting the intended results.
The screen above reflects one of the realities of GenAI: it's probabilistic - you don't get the same results each time.
In the screen above, the ProductName is missing, so we only see the Id. This is easy to fix using a GenAI iteration.
It's also a good example of why we need the human in the loop, with the ability to use familiar tools (an IDE, a database tool) as required.
Recall the integration logic:
1. Send the Order to Kafka topic 'order_shipping' if the date_shipped is not None.
In this alternative, we won't have a real Kafka running, instead we'll use a stub version. See Alternative 2 (below) to run the full integration.
To test,
Use the Admin App to update an unshipped Order, and set it's Shipped Date.
Use the Project page to view the run.log.
Observe that the order is sent to the order_shipping Kafka topic (stubbed in this example).
See the 2 screens at right.
The Governance issue was behind the considerable push-back to the Business Logic Agent concept. We saw an example of this in the Verify Domain Logic section, above.
Directly deploying Agent software into production is dangerous. This is a reality of GenAI technology that a Business Logic Agent must address. There must be a "human in the loop".
One approach is to provide options for users to review the logic and approve or correct it. That much seems mandatory,
A more comprehensive approach is to create well-formed projects. Developers can open these in their IDE, to review and extend the created logic. Extending GenAI-created projects relieves the pressure on the Business Logic Agent to automate everything.
This reference implementation, for example, creates Python projects that can be downloaded for review and extension, and traditional testing cycles. See the diagram at right, illustrating the project running under GitHub Codespaces (directions coming soon).
Standard projects/IDEs enables the use of complementary AI coding tools such as CoPilot, ChatGPT, Gemini, etc.
Business logic could be enforced with code generation. However, we don't really want to debug the assembler output of a compiler.
By introducing a rule engine, we can use GenAI to translate natural language into rules. As shown in the diagram, it's a direct translation. It is not a code generation of hundreds of lines that are difficult to understand or alter. (These 5 rules would translate to over 200 lines of code).
This not only means the logic is concise, but maintains the declarative abstraction level defined above:
The logic is automatically re-used (applied to) all relevant transactions (inserts, updates and deletes)
The Business Logic Agent is responsible for details such as ordering, and optimized data access
This reference implementation has shown that:
Nadella's prediction can be implemented
Using declarative, natural language for GenAI creation
Creating complete systems
Including domain and integration logic
With Governance and Extensibility, using standard languages and tools
Preserving declarative re-use and ordering, using a rules engine instead of code generation