Workflows, Tool-Augmented Flows and Multistep Reasoning
30-second answer
A workflow breaks one AI task into small steps you control, for example classify, extract, call a tool, draft, verify. Use structured outputs with a strict JSON schema between steps, give tool calls timeouts, bounded retries and a fallback, and check the result before anything is sent. Low temperature suits classification and extraction, and a reasoning model suits the one step that needs deep planning.
Simulate it » No Azure account neededExam objective: 2.1.3 Design workflows, tool-augmented flows and multistep reasoning pipelines. (Skills measured as of April 16, 2026)
Simulations
Feel it before you read it. No account needed, nothing leaves this page.
Open <strong>Build ➜ Workflows</strong>. A workflow lets you wire steps together visually, or in code, with branches and checks.
👆 Click the glowing item in the portal to continue
Read the steps as text
- Open Build ➜ Workflows. A workflow lets you wire steps together visually, or in code, with branches and checks.
- Each step has one job. Step 3 calls a real system as a tool, so it has a retry and a branch for when the system is down.
- Decide what happens on failure before it happens: retry, then a safe fallback that the next steps respect.
- The run history shows which step each run reached. Tracing (a later lesson) shows the detail inside each step.
🧪 Simulation for learning. Screens are simplified versions of the Azure portal; names, prices and IDs are examples. Nothing here touches real Azure.
🖱️ Drag to rotate · scroll or pinch to zoom
A multistep flow with checks
A workflow breaks one big request into steps you control: classify, extract to a JSON schema, call a tool, draft, then verify. Retries, fallbacks and a final check live in code, so one bad step can’t slip through unseen.
🤔 What happens if…
Read this tour as text
- Deploy a model, call the deployment. A deployment is a named copy of a model with a version, a deployment type and capacity. Your app calls the deployment name, never the model name. Pick a large model for hard work and a small language model for cheap, fast, simple work.
- RAG: retrieve first, then answer. Retrieval-augmented generation searches your own content (Azure AI Search, hybrid keyword plus vector), puts the best chunks in the prompt and asks the model to answer from them with citations. Without retrieval the model guesses.
- A multistep flow with checks. A workflow breaks one big request into steps you control: classify, extract to a JSON schema, call a tool, draft, then verify. Retries, fallbacks and a final check live in code, so one bad step can’t slip through unseen.
- Evaluate before you ship. Evaluators score each answer on a test set: groundedness (is it supported by the context?), relevance, coherence and safety checks. A fabrication shows up as a low groundedness score on one row, so you fix it before users see it.
- SDK, project endpoint and connections. The Foundry SDK (
azure-ai-projects) opens one door: AIProjectClient with the project endpoint and DefaultAzureCredential. From it your app gets an OpenAI-compatible client, deployments and connections (Azure AI Search, Application Insights) with no secrets in code. - Design the agent: role, goal, tool schema. An agent is a model plus instructions (role and goal), tools and a conversation (thread). A strict function schema names each parameter and marks the required ones, so the model asks the user instead of inventing a value.
- Retrieval, function calling and memory. One agent can use file search for documents, a function for live data and memory for what it learned about a user. The model asks to call a function; your code runs it and returns the result. Memory survives into a new conversation.
- Multi-agent orchestration. Several specialist agents can share a job. Sequential passes work down a line, concurrent fans out and merges, handoff moves control to the right specialist, group chat lets agents take turns in one shared conversation and Magentic lets a manager agent plan and delegate. Microsoft Agent Framework builds all five.
- Autonomy with approvals. Reads are safe, writes are not. A tool marked approval required pauses the run until a person decides. A hard limit in code blocks what no one should approve, whatever the model says.
- Monitor and debug agent runs. Agent evaluators read the whole run: intent resolution, tool call accuracy and task adherence. Error analysis groups the failing rows, such as a made-up tool argument, and points to the fix.
- Tune prompts and parameters. Instructions shape tone and rules, a few-shot example shows the format, temperature and top_p change how adventurous the wording is, and max output tokens caps length. A self-critique loop drafts, checks against a checklist and revises once.
- Trace every call and count tokens. OpenTelemetry spans record each agent run, model call and tool call, with tokens and latency, and Application Insights stores them. Tracing is opt-in, and recording message content is for development only because it captures prompts and answers.
- Route requests to the right model. A hybrid design puts rules first for answers code can decide, a small model for easy language work and a large or reasoning model only when needed. A model router can pick for you. Fewer big-model calls means a lower bill and faster replies.
Contoso handles warranty claim emails. Run a five-step flow with a tool and a verification, break the tool to see the fallback, then cut the bill by sending only the hard requests to the large model.
🎓 Education-only simulation. Your lab is saved in this browser, so you can leave and continue later.
😟 THE PROBLEM
One giant prompt classifies, extracts, looks things up and replies, and nobody can tell which part failed.
😊 THE SOLUTION
Split the work into steps with checks, retries and a safe fallback.
- One prompt does everything✓ One job per step
- A system times out✓ Retry, then a fallback value
- A wrong reply gets sent✓ A verify step before sending
Start with a question
Why does a bakery use a checklist for a wedding cake?
One person doing everything in one go makes mistakes. A good bakery splits the job: measure, mix, bake, cool, decorate, check. Each stage has one purpose, and someone checks the result before the cake leaves.
An AI workflow is that checklist. Instead of asking a model to read a claim email, look up the warranty and write a reply in one prompt, you run steps. Each step does one job, and a check at the end stops a wrong cake from leaving the shop.
Explain it like I’m 10
The technical explanation
The five steps of a claims flow
| Step | What it does | Setting that matters |
|---|---|---|
| 1 Classify | Warranty, refund or other | Temperature 0, short answer |
| 2 Extract | Pull product, serial number and date | Structured output with a strict JSON schema |
| 3 Tool | Call check_warranty(serial) | Timeout, bounded retries, fallback value |
| 4 Draft | Write the reply from the facts | Only the verified facts go in the prompt |
| 5 Verify | Compare the draft with the facts | Rules or a second model, refuse to send on mismatch |
kind = openai.responses.create(model=model, temperature=0,
input=f"Classify as warranty, refund or other: {email}").output_text
fields = json.loads(openai.responses.create(model=model, input=email,
text={"format": {"type": "json_schema", "name": "claim", "strict": True,
"schema": CLAIM_SCHEMA}}).output_text)
status = with_retry(lambda: check_warranty(fields["serial_number"]), attempts=3) or "needs_human_review"
draft = openai.responses.create(model=model, input=f"Write a reply. Facts: {fields} {status}").output_text
print(draft if verify(draft, fields, status) else "Held for a person to check")
Structured outputs, not hopeful prompts
Asking for JSON in words isn’t enough. JSON mode (json_object) only promises something that parses. Structured outputs (json_schema with strict: true) make the reply match your schema: every required field present, no extras when additionalProperties is false. That’s what lets step 3 trust the serial number from step 2.
Tools and multistep reasoning
A tool-augmented flow lets a model ask for a tool when it needs data or an action. Your code runs the tool and returns the result. For one step that needs real planning, such as comparing contract clauses, use a reasoning model for that step and keep cheap models for the rest. Foundry also has a workflow builder in preview as of 25 November 2026, where you wire steps, agents and conditions together without writing the control flow by hand.
Architect level Where to put the checks
Put a check wherever a mistake becomes expensive. After extraction, validate the schema and the serial number format. After the tool, treat an empty or error result as a failure, not as data. Before sending, compare every fact in the draft with its source. Cheap rule checks catch most errors; a second model can review tone and completeness. Log each step so a held claim shows exactly where it stopped.
Real-world business scenario
Fabrikam Appliances (fictional)
- The problem
- Claims arrived as free-text emails. One prompt did everything and sometimes promised warranty dates the warranty system didn't show.
- What they used
- A five-step flow: classify at temperature 0, extract to a strict schema, call check_warranty with three retries, draft from the verified facts, then verify the dates before sending. A tool failure sends the claim to human review.
- Why that choice
- Each step is testable, the tool result is the only source of warranty facts, and a failure ends in a person's queue instead of a wrong promise.
- The result
- Wrong-date replies stopped, and the team could see in the run history exactly which step held each claim.
When to use it and when not to
✓ Use it when…
- The task has natural stages, such as classify, look up, write.
- A step calls a system that can fail or return data the reply depends on.
- You need an audit trail of what happened at each step.
✕ Think twice when…
- One simple question and answer. A single call is enough.
- The steps are not known in advance. An agent that plans may suit better.
- Every step uses the largest model. Match the model to each step.
↔ Alternatives to consider
- A single prompt for simple tasks.
- An agent with tools when the model should decide the steps.
- Multi-agent orchestration when specialists share the work.
Test yourself with exercises
5 original practice questions in the AI-103 style. Pick your answers, then check them. You will see why each option is right or wrong. Score 75% or more and this topic is marked complete.
Interview preparation
Say your answer out loud first, then open the model answer. Interviewers care more about your reasoning than the exact words.
Beginner Why not put everything in one prompt?
Model answer
One big prompt hides where things go wrong. If classification, lookup and writing are separate steps, I can test each one, trace each one and fix the one that fails.
Intermediate What is the difference between JSON mode and structured outputs?
Model answer
JSON mode promises valid JSON, but the keys are the model's choice. Structured outputs with a strict schema promise the exact keys and types, so my code can parse the result without guessing.
Experienced developer How do you handle a flaky tool inside a flow?
Model answer
I set a timeout, retry a limited number of times, and then take a defined fallback such as marking the item for human review. The later steps must respect that fallback, and the verify step must refuse to send anything built without the facts.
Scenario A claims flow sent a wrong warranty date. What do you add?
Model answer
A verify step that compares the draft with the tool result before sending, for example that the date in the text equals the date the tool returned. If it doesn't match, the flow holds the claim.
Quick revision
Key points
- Give each step one job and check between steps.
- Structured outputs make step outputs parseable.
- Bound tool calls with timeouts and retries, then fall back safely.
- Verify the draft against the facts before sending.
- Use low temperature for classification and extraction.
Important terminology
- Workflow
- A sequence of steps, some model calls and some code or tools, where each step has one job and its output feeds the next.
- Tool-augmented flow
- A flow where the model can ask for tools, such as a function or an API, to get data or act.
- Structured outputs
- A model setting that forces the reply to match a JSON schema, so code can parse it.
- Fallback
- What the flow does when a step fails, such as holding the item for a person.
- Verification step
- A check, in code or a second model, that the result matches the facts before it is used.
- Multistep reasoning
- Solving a problem by working through several steps, either in a reasoning model or across steps of a flow.
Common mistakes
- Assuming a tool will always answer.
- Parsing free text between steps.
- Letting a failed step silently produce a guess.
Exam tips
- "Code must parse the model reply" = structured outputs with a strict schema.
- "Tool times out, no wrong reply may be sent" = bounded retries and a fallback.
- "Hard to diagnose failures" = split into steps.
Five quick revision questions
-
1.What does a strict schema guarantee?Show
The exact keys and types in the reply.
-
2.What should happen when a tool keeps failing?Show
A safe fallback, such as human review.
-
3.Which temperature suits classification?Show
A low one, often 0.
-
4.What is a verify step?Show
A check of the draft against the facts before sending.
-
5.Why split a prompt into steps?Show
So each step can be tested and traced.
Official references
Finished this lesson? Tick it off. Your progress is saved in this browser.
Next up: Evaluate Models and Apps: Groundedness, Relevance and Safety
Lesson done? Make it stick with a quick gameSort It, Match the Pairs, Lightning Round and Who Am I? Earn XP and badges.