Where should business rules live when an Azure app uses AI agents?

November 15, 2026 4 answers
Asked by 7x!cableknob_583

For things like discount eligibility, transaction approval, and user permissions, would you put the rules in prompts, application code, a rules engine, or an agent framework?

Prompts seem hard to test and audit, but keeping every rule in code can make changes slower. How would you split the AI and deterministic parts, and would exposing rules through MCP be useful?

Answers

_nearly!sideways_5

Keep decisions that must follow business rules outside the prompt. Let the model interpret a request or extract the information needed, then pass that information to code or a rules engine for the actual decision.

That gives you something you can test and version independently of the prompt. The model can still explain the result, but the explanation should be based on the decision returned by the rules layer rather than the model deciding eligibility itself.

b.607+clampwork:

The extracted inputs need checking too. A deterministic rule can still produce the wrong outcome if the model supplies an incorrect customer or transaction detail.

Reply to this answer
w.36!sundial

I would separate workflow control from the agent as well. State machines, durable execution, and rules engines are better places for steps that need predictable transitions or human approval. For a distributed system, transaction handling belongs in the system design, not in model reasoning.

The agent framework can call those processes and help assemble inputs. I would be wary of treating an agent workflow as the source of truth just because it can coordinate tool calls.

Reply to this answer
_mostly!inbound_4

Code versus a rules engine depends on who needs to change the rules and how often. Code is a straightforward choice when changes go through a development cycle. A separate rules layer may be worth considering when rule changes need their own versioning and review process.

Either way, keep access checks enforced outside the model. A prompt telling an agent what a user may do is not the same thing as an authorization check.

Reply to this answer
a618~brassleaf_3

Exposing rules through MCP could be useful as a way for an agent to request a decision without embedding the rules in its prompt. MCP is the interface, though, not the guarantee that the decision is correct or that the agent is allowed to perform the resulting action.

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions