Build the multi-agent workflow
In this exercise, you use the Foundry visual workflow designer to route questions to the correct specialist agents. You then connect Application Insights for server-side tracing and publish the supervisor entry agent as an Agent Application.
This exercise should take approximately 35 minutes to complete.
[!NOTE] Foundry visual workflows and workflow tracing are in preview. Foundry plans to retire visual workflows on December 1, 2026. For production solutions, implement this pattern with Microsoft Agent Framework.
Prerequisites
To complete this exercise, you need the Foundry project and four agents from Exercise 2. You also need permission to create an Application Insights resource and publish agents. To query trace telemetry, you need the Log Analytics Reader role on the connected Application Insights resource. If its Log Analytics tables are protected, you also need the Privileged Monitoring Data Reader role.
Connect Application Insights
- In the Foundry portal, open the
zava-web-iqproject. - Select Build > Agents, and then select the Traces tab.
- Select Connect.
- Create a new Application Insights resource named
zava-web-iq-insights, or select an existing resource. - Complete the connection and wait until tracing shows as enabled.
Server-side tracing requires no code changes. Foundry begins recording agent and workflow runs after the connection is active.
[!IMPORTANT] Traces can contain prompts, model responses, tool arguments, and tool results. Don't use secrets or personal data in this lab. Apply appropriate access controls and retention settings to Application Insights.
Create the workflow
- Select Build, and then select Create new workflow.
- Select a custom or sequential workflow template, and name the workflow
Zava Web IQ Workflow. - Add an Ask a question node, enter
How can Zava Retail help?, and save the user response asquestion. - Add an Invoke agent node, select the existing
Supervisor Agent, and enter{Local.question}as its input. - In Action settings, select Save output json_schema as, create a variable named
routing, and select Done. - Add an If/else node after the supervisor.
- Create three branches with these Power Fx conditions:
- Inventory:
Local.routing.route = "inventory". - Market:
Local.routing.route = "market". - Combined:
Local.routing.route = "combined".
- Inventory:
[!IMPORTANT] Foundry doesn't save workflow changes automatically. Select Save after each branch is complete.
Configure the inventory route
- On the
inventorybranch, add an Invoke agent node forInventory Agent. - Enter
{Local.routing.question}as the input. In Action settings, save the text output asinventory_findings. - Add a Set a variable node that creates
market_findingswith the text valueNot requested. - Add an Invoke agent node for
Summarizer Agent. - Pass
{Local.question},{Local.inventory_findings}, and{Local.market_findings}in a labeled text block. Save the text output assummary. - Add a Send a message node with
{Local.summary}as the message.
Configure the market route
- On the
marketbranch, invokeMarket-Intelligence Agentwith{Local.routing.question}. - In Action settings, save its text output as
market_findings. - Add a Set a variable node that creates
inventory_findingswith the text valueNot requested. - Invoke
Summarizer Agentwith{Local.question},{Local.inventory_findings}, and{Local.market_findings}in a labeled text block. Save the text output assummary. - Add a Send a message node with
{Local.summary}as the message.
Configure the combined route
-
On the
combinedbranch, invokeInventory Agentwith{Local.routing.question}, and save the text output asinventory_findings. -
Invoke
Market-Intelligence Agentwith{Local.routing.question}, and save the text output asmarket_findings. -
Invoke
Summarizer Agentwith this input pattern:User question: {Local.question} Inventory findings from Zava internal data: {Local.inventory_findings} Market findings from public web search: {Local.market_findings} -
Save the summarizer text output as
summary, and add a Send a message node with{Local.summary}as the message. -
Select Save.
The specialist calls on the combined route can run sequentially for this lab. In a production Agent Framework workflow, run independent calls concurrently to reduce latency.
Test the workflow
- Select Run Workflow.
- Enter
Which products are at risk of stockout?. - Confirm that the supervisor and inventory nodes complete, while the market node doesn't run.
- Enter
What products are trending in retail searches this week?. - Confirm that the supervisor and market nodes complete, while the inventory node doesn't run.
- Save any workflow changes.
Publish the entry agent
Visual workflows run in the workflow Preview experience. Current Foundry publishing creates an Agent Application from an agent version, not from a visual workflow. Publish the supervisor as the stable entry application while retaining the workflow for this lab's orchestration tests.
- Open
Supervisor Agentin the Agent Builder. - Select the current version, and then select Publish.
- Name the Agent Application
zava-web-iq-appand use the Responses protocol. - Wait for the deployment to reach the running state.
- Record the application endpoint.
[!NOTE] The published supervisor classifies requests but doesn't execute the visual workflow by itself. Production publishing requires implementing the orchestration with Microsoft Agent Framework or an application service, then exposing that implementation through an endpoint.
Verify tracing
- Return to the workflow and run one more test question.
- Select the workflow's Traces tab, or open Build > Agents > Traces.
- Open the newest trace.
- Confirm that the trace contains spans for the supervisor, the selected specialist, model calls, and tool calls.
- Select the conversation details and review the ordered inputs and outputs.
Summary
In this exercise, you built conditional multi-agent orchestration, enabled server-side tracing with Application Insights, and published the supervisor entry agent as an Agent Application.
You have successfully completed this exercise.
Clean up
Keep the workflow, application, and Application Insights resource for Exercise 4.