AI-Powered Decision Automation in Code Effects
Version 6 introduces a fundamentally new approach to AI integration in business rules engines.
Unlike traditional “AI-enabled” platforms that lock customers into vendor-specific models, APIs, or hosted services, Code Effects introduces a true BYOAI (Bring Your Own AI) architecture for deterministic decision automation.
AI support in Code Effects is built around two core features introduced in version 6:
- Adaptive Source
- Prompt-enabled Rule Elements
Together, these features allow organizations to combine deterministic business rules with probabilistic AI-driven evaluation while maintaining full control over models, prompts, infrastructure, security, and execution flow.
Adaptive Source
Context-Aware Rule Authoring
Historically, Code Effects supported several source models for rule authoring and evaluation:
- Reflection (plain .NET classes)
- Source XML
- FlexSource
These models remain fully supported in version 6. However, they all share one characteristic: the editor receives a predefined static data surface.
Adaptive Source introduces a completely different approach.
Instead of exposing a fixed set of fields, methods, and actions to the rule editor, Adaptive Source allows the available rule elements to be generated dynamically and contextually during rule authoring. The editor requests menu items on demand as the user builds or updates a rule. Your application decides what should appear next.
Dynamic Menu Generation
At every stage of rule creation, the editor sends the current rule context to your code. Your implementation can then dynamically determine:
- Which fields should be available
- Which operators should be displayed
- Which methods are contextually relevant
- Which actions can be executed
- Which UI paths should be hidden entirely
This logic can be driven by:
- AI models
- Internal business logic
- Metadata systems
- Configuration files
- External services
- Any combination of the above
The editor itself remains completely agnostic to the decision mechanism. Code Effects does not require or enforce any specific AI provider, prompt structure, inference engine, or orchestration layer.
Example: Contextual Product Rules
Imagine an e-commerce platform that sells both TVs and shoes.
A rule author begins building a rule:
If Product Type is TV and ...
At this point, the next menu should display only TV-related fields:
- Screen Size
- Voltage
- Display Technology
- Wall Mount Type
Fields related to shoes are no longer contextually relevant. When the editor requests the next menu, your application receives the current rule context:
- Field:
ProductType
- Operator:
=
- Value:
TV
Your logic can then dynamically generate the next valid rule surface. The editor provides the complete current rule context, not just the most recently added condition.
If the user later changes the product type from TV to Shoes, the entire downstream rule context may become invalid. Adaptive Source addresses this using Context Resetters.
// Example of JSON definition
{
"Value": "Inventory.Type",
"DisplayName": "Product Type",
"Description": "Test description",
"DataType": 6, // Enum
"ResetsContext": true,
"Settings":
{
"EnumName": "ProductType",
"TypeName": "TestProject.Rules.ProductType"
}
}
When a context-resetting condition changes, the editor automatically removes all dependent rule elements that no longer make semantic sense. The user can either continue editing or restore the previous state using Undo.
AI Without Vendor Lock-In
Adaptive Source defines Code Effects’ approach to AI-assisted rule authoring. Instead of embedding AI directly into the engine itself, Code Effects exposes the rule-authoring pipeline in a way that allows organizations to integrate:
- OpenAI
- Anthropic
- Gemini
- Azure AI
- Local LLMs
- On-prem inference servers
- Proprietary internal models
or no AI at all.
The platform provides the orchestration layer. You control the intelligence layer.
Prompt-Enabled Rule Elements
Integrating AI Into Rule Evaluation
The second major AI feature introduced in version 6 is the Prompt flag. The Prompt flag can be applied to any string field, method parameter, or method return value:
// Reflection source example
// In-rule method with prompted string parameter
[Method(DisplayName = "Get AI Probability Score")]
public decimal GetScore (
[Parameter(Prompt = true)] string prompt)
{
// You AI implementation
return GetTheScore(prompt);
}
// In-rule method with prompted return
[Method(DisplayName = "Load Definition")]
[return: Return(Prompt = true)]
public string GetDefinition ( )
{
return GetYourDefinition();
}
// Prompted field
[Field(Prompt = true)]
public string Prompt { get; set; }
When enabled, the editor displays a dedicated Prompt dialog for long-form structured input whenever the user interacts with a prompted field, return value, or method parameter. Although this feature can be used for any extended text input, its primary purpose is AI-driven rule evaluation.
AI as Part of Deterministic Rules
Consider the following in-rule method:
[Method(DisplayName = "Ask AI")]
public bool AskAI(
[Parameter(Prompt = true)] string prompt)
{
return GetYourAiResult();
}
A rule author can then create logic such as:
If Ask AI ( "Determine whether this claim appears fraudulent" )
is True
then Escalate Claim
else Auto Approve
where EscalateClaim() and AutoApprove() are examples of C# public methods used here as rule actions. The rule itself remains deterministic. The AI-powered evaluation becomes just another executable condition inside the decision flow.
This architecture allows organizations to combine:
- deterministic business logic
- AI inference
- compliance constraints
- explainability
- workflow automation
inside a single executable decision system.
True BYOAI Decision Automation
Code Effects version 6 does not attempt to become an AI platform. Instead, it provides the infrastructure necessary to integrate any AI model into enterprise decision automation while preserving:
- full model independence
- infrastructure ownership
- prompt ownership
- security boundaries
- deployment flexibility
- deterministic execution control
This allows organizations to evolve their AI strategy independently of the business rules engine itself. As models, providers, and deployment requirements change, the decision infrastructure remains the same.