Tag: Agent Flows

Add agent flows to a topic (AB-620 Exam Prep)

This post is a part of the AB-620: Designing and Building Integrated AI Agent Solutions in Copilot Studio Exam Prep Hub.
This topic falls under these sections:
Plan and configure agent solutions (30–35%)
   --> Configure topics
      --> Add agent flows to a topic


Note that there are 10 practice questions (with answers) at the end of each section to help you solidify your knowledge of the material. Also, there are 4 practice tests with 30 questions each available from the hub's main page below the exam topics section.

Introduction

One of the most powerful capabilities in Microsoft Copilot Studio is the ability to combine conversational topics with agent flows. While topics define how an agent interacts with users through conversation, agent flows enable the agent to perform business processes, automate tasks, integrate with enterprise systems, and orchestrate complex workflows.

For the AB-620 certification exam, you should understand how topics and agent flows work together, when to invoke an agent flow, how data is passed between topics and flows, and how to build resilient, reusable conversational experiences.


Understanding Topics and Agent Flows

Before discussing how to add agent flows to a topic, it is important to understand the role of each component.

Topics

A topic represents a conversational pathway that allows an agent to:

  • Respond to user requests
  • Ask questions
  • Collect information
  • Make decisions
  • Guide users through conversations
  • Call actions and tools
  • Invoke agent flows

Topics determine when something should happen.


Agent Flows

Agent flows define the business logic that performs actions such as:

  • Calling APIs
  • Running Power Automate flows
  • Accessing Dataverse
  • Updating CRM records
  • Sending emails
  • Creating support tickets
  • Querying databases
  • Calling AI models
  • Executing approval workflows

Agent flows determine how the work is completed.


Relationship Between Topics and Agent Flows

Think of the relationship like this:

Topic

  • Conducts the conversation
  • Collects user input
  • Determines intent
  • Decides what action is required

Agent Flow

  • Executes the requested business process
  • Returns results
  • Provides output back to the topic

Topic

  • Continues the conversation
  • Explains the outcome
  • Requests additional information if necessary

Why Use Agent Flows Instead of Placing All Logic in a Topic?

Separating conversational logic from business logic provides several advantages.

Benefits include:

  • Better maintainability
  • Reusable workflows
  • Easier testing
  • Simpler troubleshooting
  • Consistent business processes
  • Reduced duplication
  • Easier governance

Instead of rebuilding the same process in multiple topics, several topics can invoke the same agent flow.


When Should a Topic Invoke an Agent Flow?

Typical scenarios include:

  • Creating a support ticket
  • Looking up customer information
  • Checking inventory
  • Approving requests
  • Booking appointments
  • Updating CRM records
  • Searching enterprise knowledge
  • Calling external REST APIs
  • Sending notifications
  • Creating work items

Designing Topics Before Adding Flows

A well-designed topic should first determine:

  • What information is needed?
  • Which data must be collected?
  • What validation is required?
  • Which flow should execute?
  • What outputs are expected?
  • What should happen if the flow fails?

Planning these elements simplifies implementation.


Collecting Required Inputs

Topics typically gather user information before invoking an agent flow.

Examples include:

  • Customer ID
  • Product name
  • Order number
  • Email address
  • Department
  • Date
  • Priority
  • Approval comments

These values become the input parameters for the flow.

Example conversation:

Agent:
“What is your order number?”

User:
“100548”

Store value in variable.

Pass variable to the flow.


Input Parameters

Agent flows commonly accept parameters such as:

ParameterExample
Customer IDC10245
Emailnorm@company.com
Ticket PriorityHigh
Product NameSurface Laptop
Order NumberORD-14589
DepartmentHR

The topic passes these values to the flow when invoking it.


Output Parameters

Flows also return information.

Examples include:

  • Success status
  • Error message
  • Order status
  • Customer name
  • Case number
  • Appointment confirmation
  • Inventory quantity

The topic can use these outputs to continue the conversation.

Example:

Flow returns:

  • Success = True
  • TicketNumber = INC-45891

Topic responds:

“Your support ticket has been created successfully. Your ticket number is INC-45891.”


Passing Variables Between Topics and Flows

Copilot Studio variables enable communication between conversations and workflows.

Typical process:

  1. User provides input.
  2. Topic stores values in variables.
  3. Variables are passed into the flow.
  4. Flow executes.
  5. Flow returns output variables.
  6. Topic displays results.

This creates a seamless conversational experience.


Triggering an Agent Flow

Within a topic, an agent flow is typically invoked after:

  • Required inputs are collected
  • Validation succeeds
  • User confirms the request

Avoid invoking flows before all required information has been collected.


Validating Data Before Calling a Flow

Validation reduces failures.

Examples include validating:

  • Email addresses
  • Dates
  • Numeric values
  • Required fields
  • Customer IDs
  • Business rules

Example:

Incorrect:

Call flow first.

Receive error.

Correct:

Validate first.

Call flow only after validation succeeds.


Handling Flow Results

Every flow should return meaningful outputs.

Typical outcomes include:

Success

Continue conversation.

Example:

“Your vacation request has been submitted.”


Business Failure

Example:

“No customer exists with that ID.”

The topic can ask for a different ID.


System Failure

Example:

“The HR system is temporarily unavailable.”

The topic may:

  • Retry
  • Escalate
  • Ask the user to return later

Conditional Logic After Flow Execution

Topics frequently branch based on flow outputs.

Examples:

If Success = True

→ Confirm completion

If Success = False

→ Explain failure

If Approval Required

→ Route for approval

If Customer Not Found

→ Ask again


Reusing Agent Flows

One of the biggest advantages of agent flows is reuse.

Example:

Customer Lookup Flow

Used by:

  • Sales topic
  • Support topic
  • Billing topic
  • Warranty topic

Instead of maintaining four lookup implementations, only one flow requires maintenance.


Integrating Enterprise Systems

Topics frequently invoke flows that connect to:

  • Microsoft Dataverse
  • Dynamics 365
  • SharePoint
  • Microsoft Teams
  • SQL Server
  • Azure AI Search
  • SAP
  • ServiceNow
  • Salesforce
  • Custom REST APIs

The topic itself remains conversational while the flow manages integration.


Long-Running Operations

Some workflows require several minutes.

Examples:

  • Report generation
  • Data synchronization
  • Large database updates
  • AI document processing

Best practices include:

  • Inform users processing has begun.
  • Provide progress messages when possible.
  • Notify users when processing completes.
  • Continue asynchronously if supported.

Human-in-the-Loop Scenarios

Some flows require human approval.

Examples include:

  • Expense approvals
  • Vacation approvals
  • Purchase requests
  • Legal review
  • Financial authorization

The topic may:

  • Submit the request.
  • Inform the user approval is pending.
  • Resume once approval completes.

Error Handling

Topics should never assume a flow succeeds.

Always plan for:

  • Authentication failures
  • Connector failures
  • Missing inputs
  • Invalid responses
  • Timeout errors
  • API failures
  • Network outages

Provide friendly error messages rather than technical details.

Example:

“I couldn’t complete your request because the service is temporarily unavailable.”


Logging and Monitoring

Administrators should monitor:

  • Successful executions
  • Failed executions
  • Flow duration
  • Connector errors
  • API failures
  • User abandonment
  • Retry frequency

These metrics help improve reliability over time.


Security Considerations

Topics should only invoke flows users are authorized to execute.

Consider:

  • Microsoft Entra ID authentication
  • User permissions
  • Least privilege
  • Secure connectors
  • Data protection
  • Sensitive information masking

Never expose secrets or internal system information to users.


Best Practices

  • Keep conversational logic inside topics.
  • Keep business logic inside agent flows.
  • Validate inputs before invoking flows.
  • Use meaningful input and output parameters.
  • Handle failures gracefully.
  • Reuse flows whenever possible.
  • Log important events.
  • Protect sensitive information.
  • Use clear confirmation messages.
  • Test both successful and failure scenarios.

Common Mistakes

Avoid these common design errors:

  • Calling flows before collecting all required inputs
  • Ignoring returned output values
  • Exposing technical error messages
  • Duplicating identical business logic in multiple topics
  • Failing to validate user input
  • Hardcoding values instead of using variables
  • Not planning for connector failures
  • Building overly large topics instead of modular conversations

Exam Tips

For the AB-620 exam, remember the following:

  • Topics manage conversations, while agent flows perform business operations.
  • Topics should collect and validate data before invoking a flow.
  • Use variables to pass information between topics and flows.
  • Agent flows should return structured outputs that topics can evaluate.
  • Reuse agent flows whenever possible to reduce duplication.
  • Handle errors gracefully and provide meaningful user feedback.
  • Design topics to support enterprise integrations while maintaining a conversational experience.
  • Separate conversation design from business process implementation.
  • Secure flows with appropriate authentication and authorization.
  • Test both successful and unsuccessful execution paths.

Practice Exam Questions

Question 1

A Copilot Studio topic collects a user’s employee ID before invoking an agent flow. What is the primary purpose of collecting this information first?

A. To reduce the number of topics in the agent

B. To allow the flow to receive the required input parameter

C. To prevent authentication from occurring

D. To automatically create a Dataverse table

Answer: B

Explanation: Agent flows often require input parameters. The topic gathers the necessary information before invoking the flow.


Question 2

Which responsibility belongs primarily to a topic rather than an agent flow?

A. Updating a SQL database

B. Calling a REST API

C. Managing the conversation with the user

D. Executing a Power Automate workflow

Answer: C

Explanation: Topics handle conversational interactions, while agent flows perform business operations and integrations.


Question 3

Why is separating conversation logic from business logic considered a best practice?

A. It prevents users from accessing connectors.

B. It removes the need for authentication.

C. It allows topics to execute without variables.

D. It improves maintainability and enables workflow reuse.

Answer: D

Explanation: Separating responsibilities makes solutions easier to maintain, test, and reuse across multiple topics.


Question 4

An agent flow returns a value indicating that a customer record could not be found. What should the topic do next?

A. Ignore the response and continue.

B. Delete the conversation history.

C. Ask the user for a different customer identifier.

D. Disable the flow.

Answer: C

Explanation: The topic should respond appropriately to business outcomes by allowing the user to correct the information.


Question 5

Which of the following is the BEST example of an output parameter returned by an agent flow?

A. Ticket number generated after creating a support case

B. User’s spoken question

C. Conversation trigger phrase

D. Greeting message

Answer: A

Explanation: Output parameters communicate the results of a completed workflow back to the topic.


Question 6

Before invoking an agent flow, a topic should first:

A. Restart the conversation.

B. Validate required user inputs.

C. Disable error handling.

D. Create a new environment.

Answer: B

Explanation: Input validation prevents unnecessary failures and improves the user experience.


Question 7

Multiple topics need to retrieve customer information using identical business logic. What is the recommended design?

A. Copy the workflow into every topic.

B. Create separate connectors for each topic.

C. Build one reusable agent flow that all topics invoke.

D. Eliminate topics and use only flows.

Answer: C

Explanation: Reusable agent flows reduce maintenance and ensure consistent business logic across conversations.


Question 8

Which scenario is most appropriate for invoking an agent flow?

A. Displaying a welcome message

B. Asking for the user’s preferred language

C. Detecting user intent

D. Creating a purchase order in an ERP system

Answer: D

Explanation: Business operations involving enterprise systems are ideal candidates for agent flows.


Question 9

Why should a topic evaluate the outputs returned by an agent flow?

A. To determine how the conversation should continue

B. To reduce connector licensing costs

C. To automatically create new topics

D. To bypass authentication

Answer: A

Explanation: Output parameters allow the topic to make decisions based on the success, failure, or results of the workflow.


Question 10

An enterprise workflow may take several minutes to complete. What is the best user experience?

A. Close the conversation immediately.

B. Repeatedly invoke the flow until it finishes.

C. Inform the user that processing is underway and provide follow-up or asynchronous notification if appropriate.

D. Return a technical timeout message.

Answer: C

Explanation: Long-running operations should provide feedback to the user and, where appropriate, continue asynchronously rather than blocking the conversation or exposing technical errors.


Go to the AB-620 Exam Prep Hub main page

Implement error handling in agent flows (AB-620 Exam Prep)

This post is a part of the AB-620: Designing and Building Integrated AI Agent Solutions in Copilot Studio Exam Prep Hub.
This topic falls under these sections:
Plan and configure agent solutions (30–35%)
   --> Create and monitor agent flows in Copilot Studio
      --> Implement error handling in agent flows


Note that there are 10 practice questions (with answers) at the end of each section to help you solidify your knowledge of the material. Also, there are 4 practice tests with 30 questions each available from the hub's main page below the exam topics section.

Introduction

Error handling is a critical component of designing reliable AI agent solutions in Microsoft Copilot Studio. Regardless of how well an agent is designed, failures can occur due to unavailable services, invalid user input, authentication problems, network interruptions, connector failures, or unexpected business logic. A well-designed agent anticipates these situations and responds gracefully instead of simply failing.

For the AB-620 certification exam, you should understand how to design resilient agent flows that detect, manage, and recover from errors while maintaining a positive user experience.


Why Error Handling Matters

Enterprise AI agents frequently interact with multiple systems, including:

  • Microsoft Dataverse
  • Microsoft 365
  • Dynamics 365
  • Power Automate
  • Azure services
  • REST APIs
  • Third-party SaaS applications
  • Databases

Every external dependency introduces potential points of failure.

Without proper error handling, users may experience:

  • Confusing responses
  • Broken conversations
  • Incomplete business transactions
  • Duplicate operations
  • Lost data
  • Poor customer satisfaction

Good error handling minimizes these risks.


Common Sources of Errors

User Input Errors

Users may provide:

  • Invalid dates
  • Incorrect email addresses
  • Unsupported values
  • Missing required information
  • Unexpected free-form responses

Example:

User:
“I need vacation starting February 31.”

The agent should recognize the invalid date and ask for correction.


Authentication Errors

An agent may require the user to sign in before accessing protected resources.

Possible failures include:

  • Expired authentication tokens
  • Missing permissions
  • Incorrect identity
  • Authentication timeout

Example:

“I cannot access your HR information until you sign in.”


Authorization Errors

Authentication verifies identity.

Authorization verifies permissions.

Example:

A user successfully signs in but lacks permission to:

  • Approve expenses
  • View payroll
  • Modify customer records

The agent should explain the permission issue rather than displaying a generic failure.


Connector Failures

Power Platform connectors may fail because:

  • Service unavailable
  • Invalid credentials
  • API throttling
  • Timeout
  • Configuration problems

Example:

Salesforce connector unavailable.

The agent should notify the user and optionally retry later.


REST API Errors

Custom APIs may return:

  • 400 Bad Request
  • 401 Unauthorized
  • 403 Forbidden
  • 404 Not Found
  • 429 Too Many Requests
  • 500 Internal Server Error

Good flows interpret these responses appropriately.


Network Problems

Temporary issues include:

  • Slow internet
  • DNS failures
  • Temporary outages
  • Firewall issues

Agents should distinguish between temporary and permanent failures.


Data Validation Errors

Examples:

  • Required fields missing
  • Duplicate IDs
  • Invalid formats
  • Business rule violations

Instead of terminating the conversation, the agent should request corrected information.


Principles of Good Error Handling

Fail Gracefully

Never expose technical errors.

Poor response:

Exception 0x800401…

Better response:

“I couldn’t complete your request because the service is temporarily unavailable. Please try again in a few minutes.”


Provide Helpful Guidance

Users should know:

  • What happened
  • What they can do next
  • Whether retrying will help

Example:

“The inventory service is unavailable. You can try again later or contact support.”


Preserve Conversation Context

If possible, maintain previously collected information.

Example:

Instead of asking all questions again, resume from the failed step after recovery.


Validate Early

Catch errors before calling external systems.

Validate:

  • Required fields
  • Email format
  • Date format
  • Numeric values
  • Business rules

Earlier validation reduces unnecessary API calls.


Retry Temporary Failures

Some failures are temporary.

Examples:

  • Network interruptions
  • Service throttling
  • Temporary outages

Automatic retries may succeed without involving the user.

Avoid excessive retries that overload services.


Error Handling in Copilot Studio

Copilot Studio allows makers to design conversational logic that accounts for exceptions.

Typical techniques include:

  • Conditional branches
  • Variable validation
  • Alternative conversation paths
  • Power Automate error responses
  • Custom messages
  • Human escalation
  • Confirmation prompts

Using Conditions

Conditional logic helps detect problems before continuing.

Example:

If Order ID exists
Continue
Else
Ask user for Order ID

Another example:

If Email format valid
Continue
Else
Request valid email

Using Variables Safely

Agent variables should always be checked before use.

Example:

If CustomerID is empty
Collect CustomerID
Else
Continue

This prevents null or missing values from causing downstream failures.


Handling Power Automate Flow Errors

Many Copilot Studio actions invoke Power Automate.

A flow should return structured results.

Example response:

Status = Success
Message = Order Created

or

Status = Failed
Reason = Customer Not Found

The agent can then decide how to respond.


Returning Structured Error Messages

Instead of generic text, return structured outputs.

Example:

FieldValue
SuccessFalse
ErrorCodeCustomerNotFound
ErrorMessageCustomer does not exist

This makes downstream handling easier.


Human-in-the-Loop Recovery

Sometimes automation should stop and transfer the conversation.

Examples:

  • Sensitive requests
  • Escalations
  • Financial approvals
  • Legal questions
  • Repeated failures

The agent can:

  • Create a support ticket
  • Notify a supervisor
  • Transfer to a live agent
  • Request manual review

Timeout Handling

External systems may respond slowly.

Best practices include:

  • Notify users that processing is occurring.
  • Set reasonable timeout limits.
  • Offer retry options.
  • Continue asynchronously when appropriate.

Example:

“This is taking longer than expected. I’ll let you know once the request is complete.”


Handling Missing Knowledge

Generative answers may not find relevant information.

Instead of hallucinating, the agent should:

  • State that it cannot locate the information.
  • Suggest alternative resources.
  • Escalate if appropriate.

Example:

“I couldn’t find an answer in the available company knowledge.”


Logging Errors

Users should not see technical logs, but administrators need diagnostic information.

Useful logging includes:

  • Timestamp
  • User session
  • Connector used
  • API endpoint
  • Error code
  • Conversation step
  • Flow name
  • Correlation ID

Logs simplify troubleshooting.


Monitoring Repeated Failures

A single failure may not indicate a problem.

Repeated failures could indicate:

  • Broken connector
  • Expired credentials
  • API changes
  • Service outage
  • Poor conversation design

Administrators should monitor trends rather than isolated events.


User-Friendly Error Messages

Good messages are:

  • Clear
  • Brief
  • Non-technical
  • Actionable

Poor:

Error 500

Better:

“The order system is temporarily unavailable. Please try again later.”


Designing Recovery Paths

Recovery should allow users to continue.

Examples:

  • Retry operation
  • Correct invalid input
  • Use another data source
  • Escalate to human
  • Skip optional step
  • Resume later

Preventing Duplicate Operations

Retries can accidentally repeat transactions.

Example:

If payment succeeds but confirmation fails, retrying may charge the customer twice.

Best practices include:

  • Confirmation checks
  • Transaction IDs
  • Idempotent operations
  • Duplicate detection

Security During Errors

Error messages should never expose:

  • Connection strings
  • Passwords
  • Tokens
  • API keys
  • Stack traces
  • Internal server names

Always sanitize user-facing responses.


Designing for Resilience

Resilient agents include:

  • Input validation
  • Authentication checks
  • Authorization checks
  • Retry logic
  • Timeout handling
  • Alternative conversation paths
  • Human escalation
  • Structured error messages
  • Logging
  • Monitoring

Exam Tips

For the AB-620 exam, remember:

  • Validate user input before calling external services.
  • Use conditions to prevent invalid operations.
  • Handle connector failures gracefully.
  • Avoid exposing technical details to users.
  • Return structured responses from Power Automate flows.
  • Escalate complex or sensitive failures to humans when appropriate.
  • Monitor recurring failures using telemetry and logs.
  • Design recovery paths instead of ending conversations abruptly.
  • Protect sensitive information in all error messages.
  • Build resilient conversational experiences that maintain user trust.

Practice Exam Questions

Question 1

An agent calls a REST API that occasionally returns HTTP 429 (Too Many Requests). What is the BEST design strategy?

A. Permanently disable the API call

B. Retry the request after an appropriate delay

C. Ignore the error and continue

D. Ask the user to refresh their browser

Answer: B

Explanation: HTTP 429 indicates rate limiting. The appropriate strategy is to wait and retry rather than immediately failing or repeatedly calling the service.


Question 2

A Power Automate flow fails because a required input variable is empty. What should the agent do first?

A. Retry the flow indefinitely

B. Display the raw flow error

C. Prompt the user to provide the missing information

D. End the conversation

Answer: C

Explanation: Missing required inputs should be collected before attempting the operation again.


Question 3

Which information should NOT be included in a user-facing error message?

A. A friendly explanation

B. Suggested next steps

C. Whether the operation can be retried

D. API keys and stack traces

Answer: D

Explanation: Sensitive implementation details should never be exposed to users because they create security risks.


Question 4

A connector to an external CRM system is temporarily unavailable. Which response provides the best user experience?

A. “Unhandled exception occurred.”

B. End the conversation immediately.

C. “The CRM service is temporarily unavailable. Please try again shortly.”

D. Continue as though the update succeeded.

Answer: C

Explanation: Users should receive clear, actionable information without misleading them or exposing technical details.


Question 5

Why should agent flows validate user input before invoking external services?

A. It reduces unnecessary API calls and catches errors earlier.

B. It guarantees network availability.

C. It eliminates authentication requirements.

D. It automatically fixes invalid data.

Answer: A

Explanation: Early validation improves efficiency, reduces failures, and enhances the overall user experience.


Question 6

A flow returns the following values:

  • Success = False
  • ErrorCode = CustomerNotFound
  • ErrorMessage = Customer does not exist

Why is this approach recommended?

A. It hides all errors from administrators.

B. It increases API response speed.

C. It provides structured information that downstream logic can evaluate.

D. It replaces logging.

Answer: C

Explanation: Structured responses enable agent logic to make consistent decisions based on defined outcomes.


Question 7

When should an agent transfer a conversation to a human?

A. Every time an API call completes

B. When repeated failures or business requirements require manual intervention

C. After every authentication request

D. Only after restarting the conversation

Answer: B

Explanation: Human escalation is appropriate for scenarios where automation cannot safely or effectively complete the task.


Question 8

Which practice helps prevent duplicate transactions when retrying failed operations?

A. Ignoring retries

B. Deleting transaction history

C. Removing confirmation messages

D. Using transaction IDs or idempotent operations

Answer: D

Explanation: Idempotency and unique transaction identifiers help ensure repeated requests do not produce duplicate results.


Question 9

Why should administrators monitor recurring flow failures?

A. To identify underlying service or configuration issues

B. To reduce conversation length

C. To eliminate authentication

D. To prevent users from accessing the agent

Answer: A

Explanation: Repeated failures often indicate systemic issues such as expired credentials, connector problems, or service outages.


Question 10

Which statement best describes resilient agent design?

A. Errors should always terminate the conversation.

B. Users should always see detailed exception information.

C. Agents should anticipate failures, recover where possible, and provide helpful guidance.

D. External systems should never be called.

Answer: C

Explanation: Resilient agents are designed to recover gracefully, guide users through problems, and continue conversations whenever practical.


Go to the AB-620 Exam Prep Hub main page