SolutionJet Multi-Cloud, DevSecOps & Agentic AI Solutions
AzureAI Service · Agentic AI

Stop Herding Cats: How Azure Prompt Flow Makes Your AI Agents Play Nice

By SolutionJet Architecture Team

🚀 Azure Prompt Flow

Basically, Azure Prompt Flow is your easy button for building apps with those big AI models (LLMs). It lets you quickly connect the LLM, your specific instructions (prompts), and any extra code into a simple workflow. This makes creating, testing, tweaking, and launching your AI applications way, way faster and less complicated.

🛍️ Generative AI Order Flow: Inventory Perspective

Here is simple order processing use case that illustrates how an AI Agent, built within Azure AI Foundry, can handle an order request, interact with an inventory system, and provide a smart, context-aware response. The core is the Prompt Flow, orchestrating the LLM's intelligence with external tools and data.

Generative AI order flow from an inventory perspective, orchestrated by Prompt Flow

Step by Step Processing: Order Flow with Generative AI

Now lets take a deeper look what Microsoft Foundry components could be used under the hood to automate and integrate with Microsoft Services for each of these agents

Phase 1: Request and Intent Identification

The AI Agent receives the user's request and utilizes the LLM for initial analysis and tool determination.

StepActionComponentDescription
1User Input/RequestClient ApplicationA customer or internal user inputs a request, such as "Do you have 15 units of the 'Delta-9' widget in stock?"
2Agent InvocationFoundry EndpointThe input is sent to the deployed **Foundry Agent Service** endpoint.
3Intent AnalysisLLM (e.g., GPT-4o)The LLM, as the core of the Agent, analyzes the prompt and identifies two key things: Intent (Checking inventory) and Extracted Parameters (Item: "Delta-9 widget," Quantity: 15). Crucially, the LLM determines it needs a Tool to answer.

Phase 2: Tool Execution and Data Retrieval (The RAG Retrieval)

The Prompt Flow Orchestrator executes the external tool to securely retrieve live, structured data.

StepActionComponentDescription
4Tool Selection & CallPrompt Flow OrchestratorThe flow identifies the Inventory Check Tool is necessary. The LLM formats the necessary JSON input (Item ID, Quantity) for the Tool.
5Secure External QueryInventory Check Tool (Logic App)The tool—an Azure Logic App or custom function secured by Microsoft Entra Agent ID—connects securely to the external System of Record (SAP/Dynamics).
6Return Raw DataInventory Check ToolThe external system returns the raw result (e.g., {"Status": "Available", "Quantity_on_hand": 22, "Warehouse": "West"}) back to the Prompt Flow.

Phase 3: Generative Response and Final Output (The RAG Augmentation)

The flow applies logic to the retrieved data, and the LLM synthesizes the final, conversational response.

StepActionComponentDescription
7Conditional LogicPrompt Flow NodeThe flow checks the raw data (e.g., Is "Quantity_on_hand" >= 15?). A. If Yes (In Stock), proceed to Step 8. B. If No (Out of Stock), route to an alternative LLM prompt for a back-order suggestion.
8Generative SynthesisLLM (GPT-4o)The raw data is passed back to the LLM along with the original user query. The LLM converts the raw data into a natural, conversational response (e.g., "Yes, we currently have 22 units of the Delta-9 widget available in the West warehouse, so your order of 15 is good to go!").
9Final OutputFoundry EndpointThe synthesized, context-aware, conversational response is returned to the user in the client application.

Here Prompt Flow acts as the crucial middle layer, allowing the LLM (the Brain) to utilize the Tool (the Hands) to interact with the real-world business system before generating a final, informed response

🎭 LLM vs. Prompt Flow: The Communication Mechanism

In Azure AI Foundry's Prompt Flow, the interaction between the intelligent model and the deterministic workflow is managed through Function Calling (or Tool Calling).

1. The LLM's Role: The Reasoning Agent (Step 3)

The LLM's job is not to execute code, but to determine the best course of action based on the user's request.

  • Pre-Step: The Prompt Flow gives the LLM (e.g., GPT-4o) a list of available tools in the System Prompt. This list includes the function signature for the Inventory Check Tool, specifying its name (inventory_check), description, and required parameters (item_id, quantity).
  • Action (Step 3): When the user asks, "Do you have 15 units of the 'Delta-9' widget?", the LLM realizes it cannot answer this question from its general training data.
  • The "Hint": Instead of generating a natural language answer, the LLM generates a structured output: a JSON object that represents the function call. This is the signal to the Orchestrator.

Example LLM Output (The Hint/Signal):

{
  "function": "inventory_check",
  "arguments": {
    "item_id": "Delta-9 widget",
    "quantity": 15
  }
}

2. The Prompt Flow Orchestrator's Role: The Action Agent (Step 4)

The Prompt Flow is the deterministic, reliable workflow engine built to interpret and execute the LLM's instructions.

  • Action (Step 4): The Prompt Flow Orchestrator receives the LLM's output. It sees that the output is not a final text response, but the structured JSON object requesting a function call.
  • Execution: The Orchestrator immediately intercepts this JSON, extracts the function name (inventory_check) and the parameters, and then triggers the actual execution of the pre-defined Inventory Check Tool (which is a Python script, Logic App, or API call).
  • Why the Orchestrator? This separation of concerns ensures safety, determinism, and control. The LLM is a probabilistic engine and cannot handle security or complex workflow logic. The Prompt Flow provides the necessary control plane (auditing, retries, security context, and routing) to safely interact with the sensitive, deterministic systems of record (like SAP).

✅ Ambiguity ?

In case you wondering how the retrieval lookup execution happened in LLM or within the flow orchestrator itself ? Lets recognize the two distinct steps involved:

  1. LLM Decides: The LLM uses its intelligence to decide what needs to be done ("I need to call the inventory tool with these arguments").
  2. Prompt Flow Does: The Prompt Flow uses its deterministic logic to take that LLM decision and execute the underlying system integration securely and reliably.

The LLM is the intent router, and the Prompt Flow is the execution engine.

More in this series