Devizur
All insightsAI & Automation

Practical AI for Existing Business Systems: RAG, Tools and Controlled Automation

How to add AI to existing commerce, POS, admin and operational software without handing probabilistic models control of money, permissions or business truth.

Soud Al Raihan18 June 20263 min read
Existing SystemAI CapabilitySearchToolsApproved Data

History and context

Rule systems
Traditional software automated processes through deterministic rules and structured data.
Machine learning
Statistical models expanded automation into classification, prediction and recommendation.
Generative AI
Language models made unstructured documents, natural-language interfaces and tool orchestration practical for more business applications.
Current production focus
Useful enterprise AI increasingly emphasises grounding, evaluation, tool boundaries, permissions and observability rather than unconstrained chat.

Keep deterministic logic deterministic

AI is useful where language interpretation and uncertainty are part of the problem. It is a weak replacement for rules that can be expressed exactly.

Keep deterministic

Tax, price calculation, payment state, inventory reservation, permissions, contractual state.

Good AI candidates

Search, summarisation, document extraction, support drafts, content assistance, explanation and discovery.

RAG grounds answers in company knowledge

User QuestionASP.NET CoreSearch / RetrievalApproved KnowledgeModel Response
Retrieval-augmented generation adds current, approved context before the model answers.

A bounded .NET orchestration pattern

C#
public async Task<AssistantAnswer> AskAsync(
    string question,
    CancellationToken cancellationToken)
{
    var sources = await search.SearchAsync(
        question,
        top: 5,
        cancellationToken);

    var context = string.Join(
        "\n\n",
        sources.Select(x => x.Content));

    var answer = await model.GenerateAsync(
        BuildPrompt(question, context),
        cancellationToken);

    return new AssistantAnswer(answer, sources);
}

Use approved tools, not arbitrary production access

Do not connect a model directly to unrestricted SQL. Expose bounded functions whose validation and authorisation are implemented in normal application code.

C#
public interface IOrderTool
{
    Task<OrderSummary> GetOrderAsync(
        long orderId,
        CancellationToken cancellationToken);
}
AI OrchestratorApproved ToolBusiness APIPostgreSQL
Tool-based architecture preserves application-level rules around AI actions.

Support copilot example

A support assistant can combine order data, customer history and policy search, then draft a response. The model does not invent the order state; it receives it from the authoritative API.

Permissions and prompt injection

AI retrieval must inherit tenant, role and document-access boundaries. Retrieved content should also be treated as untrusted input because documents and external text can contain instructions that attempt to manipulate the model.

Security boundary
The model should never be the final authorisation boundary. Sensitive actions should be validated by ordinary backend code and, where appropriate, require human approval.

Evaluation before production

A production AI feature needs a realistic evaluation set covering grounding, source relevance, refusal when evidence is insufficient, permission enforcement, latency and cost. A good demo is not a production test.

Evaluation case
Question:
Can a customer return an opened item after 45 days?

Expected evidence:
Returns Policy, section 4.2

Expected behaviour:
Do not claim the return is allowed
if the approved policy limits returns to 30 days.

A current Azure-oriented RAG shape

Microsoft's current Foundry guidance describes RAG patterns that use enterprise knowledge retrieval and can use Azure AI Search or Foundry knowledge capabilities to ground model responses. The specific service choice should follow the workload and governance requirements.

React / Next.jsASP.NET CoreFoundry / ModelAzure AI SearchApproved KnowledgeBusiness APIs
AI capabilities sit beside the existing business platform, not in place of it.

Business value and practical considerations

Pros

  • Natural-language access to knowledge
  • Faster support workflows
  • Document automation
  • Incremental adoption
  • Human-in-the-loop patterns

Considerations

  • Probabilistic outputs
  • Evaluation burden
  • Variable cost
  • Privacy and access complexity
  • Prompt-injection risk
SA
Soud Al RaihanApplied AI and business systems · Devizur

References

Primary documentation used for terminology and current platform guidance: