Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to: Azure Logic Apps (Standard)
Important
This capability is in preview and is subject to the Supplemental Terms of Use for Microsoft Azure Previews.
When your scenario requires workflows that support natural language and use agents connected to large language models (LLMs) to make decisions and complete tasks without human interactions, create an autonomous agent workflow in Azure Logic Apps. This workflow type is the best option for scenarios where agents must work without human intervention, might need to run for a long time, and require stronger governance, isolation, and automated rollback or compensation strategies.
All agent workflows perform tasks by using an agent connected to an LLM. The agent uses an iterative looped process to solve complex, multistep problems. An LLM is a trained program that recognizes patterns and performs jobs without human interaction. An agent workflow lets you separate an agent's decision logic, which includes the LLM, prompts, and orchestration, from the integration and task execution components.
An agent provides the following capabilities and benefits when connected to a model:
- Accepts instructions about the agent's role, how to operate, and how to respond.
- Receives and responds to requests or prompts.
- Processes inputs, analyze data, and make choices, based on available information.
- Chooses tools to complete the tasks necessary to fulfill requests. A tool is a sequence with one or more actions that complete a task.
- Adapts to environments that require flexibility and are fluid, dynamic, unpredictable, or unstable.
With 1,400+ connectors that provide actions that you can use to create tools for an agent to use, autonomous agent workflows support a vast range of scenarios that can greatly benefit from AI capabilities.
The following screenshot shows an example autonomous agent workflow that you create in this guide. The workflow uses an agent to get the weather forecast and send that forecast in email. The diagram shows the agent information pane where you set up the agent and provide instructions that don't require human interaction for the agent to follow:
For the high-level steps that describe how the agent works and more overview information about agent workflows, see AI agent workflows in Azure Logic Apps.
This guide shows how to create an example Standard logic app workflow with the Autonomous Agents type, which works without human interaction or inputs, and how to update an existing stateful workflow to include an agent. To fulfill requests, the agent uses tools that you build to complete the necessary tasks in real-world services and systems.
Prerequisites
An Azure account and subscription. If you don't have a subscription, sign up for a free Azure account.
A new or existing Standard logic app resource or project. You can work in either development environment:
Azure portal: A Standard logic app resource.
If you don't have this resource, see Create an example Standard workflow in the Azure portal.
Visual Studio Code: A Standard logic app project.
Make sure that you have the latest Azure Logic Apps (Standard) extension for Visual Studio Code. If you don't have this project, see Create Standard workflows in Visual Studio Code.
The examples in this guide use the Azure portal. However, after you open the workflow designer, the steps to use the designer are mostly similar between the portal and Visual Studio Code. Some interactions have minor differences.
For your model source, you need one of the following sources:
Model source Description Azure OpenAI Service resource with a deployed Azure OpenAI Service model You need the resource name when you create a connection to your deployed model in Azure OpenAI Service from an agent in your workflow. If you don't have this resource and model, see the following articles:
- Create and deploy an Azure OpenAI Service resource
- Deploy a model
Agent workflows support only specific models. For more information, see Supported models.Azure OpenAI Service resource connected to an Azure AI Foundry project and a deployed Azure OpenAI model in Azure AI Foundry Make sure that you have a Foundry project, not a Hub based project. If you don't have this project, resource, and model, see the following articles:
- Create and deploy an Azure OpenAI Service resource
- Create a project for Azure AI Foundry
- Connect Azure AI services after you create a project or Create a new connection in Azure AI Foundry portal
- Deploy a model
Agent workflows support only specific models. For more information, see Supported models.Important
Although agent workflows don't incur extra charges in Azure Logic Apps, model usage incurs charges. For more information, see the Azure Pricing calculator.
The authentication to use when you create a new connection between an agent and your deployed model.
Note
For Azure AI Foundry projects, you must use managed identity authentication.
Managed identity authentication
This connection supports authentication by using Microsoft Entra ID with a managed identity. In production scenarios, Microsoft strongly recommends that you use a managed identity when possible because this option provides optimal and superior security at no extra cost. Azure manages this identity for you, so you don't have to provide or manage sensitive information such as credentials or secrets. This information isn't even accessible to individual users. You can use managed identities to authenticate access for any resource that supports Microsoft Entra authentication.
To use managed identity authentication, your Standard logic app resource must enable the system-assigned managed identity. By default, the system-assigned managed identity is enabled on a Standard logic app. This release currently doesn't support using the user-assigned managed identity.
Note
If the system-assigned identity is disabled, reenable the identity.
The system-assigned identity requires one of the following roles for Microsoft Entra role-based access control (RBAC), based on the principle of least privilege:
Model source Role Azure OpenAI Service resource - Cognitive Services OpenAI User (least privileged)
- Cognitive Services OpenAI ContributorAzure AI Foundry project Azure AI User For more information about managed identity setup, see the following resources:
URL and key-based authentication
This connection supports authentication by using the endpoint URL and API key for your deployed model. However, you don't have to manually find these values before you create the connection. The values automatically appear when you select your model source.
Important
Use this authentication option only for the examples in this guide, exploratory scenarios, nonproduction scenarios, or if your organization's policy specifies that you can't use managed identity authentication.
In general, make sure that you secure and protect sensitive data and personal data, such as credentials, secrets, access keys, connection strings, certificates, thumbprints, and similar information with the highest available or supported level of security. Don't hardcode sensitive data, share with other users, or save in plain text anywhere that others can access. Set up a plan to rotate or revoke secrets in the case they become compromised. For more information, see the following resources:
To follow along with the examples, you need an email account to send email.
The examples in this guide use an Outlook.com account. For your own scenarios, you can use any supported email service or messaging app in Azure Logic Apps, such as Office 365 Outlook, Microsoft Teams, Slack, and so on. The setup for other email services or apps are similar to the examples, but have minor differences.
Supported models for agent workflows
The following list identifies the models that you can use for agent workflows:
- gpt-5
- gpt-4.1
- gpt-4.1-mini
- gpt-4.1-nano
- gpt-4o
- gpt-4o-mini
- gpt-4
- gpt-35-turbo
Limitations and known issues
The following table describes the current limitations and any known issues in this release.
| Limitation | Description |
|---|---|
| Supported workflow types | To create an autonomous agent workflow, select the Autonomous Agents workflow type or add an Agent action to an existing Stateful workflow. You can't use the Stateless workflow type, and then add an agent. |
| Authentication | For managed identity authentication, you can use only the system-assigned managed identity at this time. Support is currently unavailable for the user-assigned managed identity. Note: For Azure AI Foundry projects, you must use managed identity authentication. |
| Agent tools | - To create tools, you can use only actions, not triggers. - A tool starts with action and always contains at least one action. - A tool works only inside the agent where that tool exists. - Control flow actions are unsupported. |
| Documentation | This guide covers the basic steps to create an autonomous agent workflow. Documentation for advanced features is in progress. |
| General limits | For general information about the limits in Azure OpenAI Service, Azure AI Foundry, and Azure Logic Apps, see the following articles: - Azure OpenAI Service quotas and limits - Azure OpenAI in Azure AI Foundry Models quotas and limits - Azure Logic Apps limits and configuration |
Create an autonomous agent workflow
You can start with either a new workflow or add an agent to a nonagent Stateful workflow.
Create a new workflow
To create a partial workflow with an empty Agent, follow these steps:
In the Azure portal, open your Standard logic app resource.
On the logic app menu, under Workflows, select Workflows.
On the Workflows page toolbar, select Add > Add.
On the Create workflow pane, complete the following steps:
For Workflow name, provide a name for your workflow to use.
Select Autonomous Agents > Create.
The designer opens and shows a partial workflow, which includes an empty Agent action that you need to set up later.
Before you can save your workflow, you must complete the following setup tasks for the Agent action:
Create a connection to your deployed model. You complete this task in a later section.
Provide system instructions that describe the roles that the agent plays, the tasks that the agent can perform, and other information to help the agent better understand how to operate. You also complete this task in a later section.
Add a trigger to your workflow.
Your workflow requires a trigger to control when the workflow starts running. You can use any trigger that fits your scenario. For more information, see Triggers.
On the designer, select Add trigger.
On the Add a trigger pane, follow these general steps to add the best trigger for your scenario.
This example uses the Request trigger named When a HTTP request is received. For this article, you don't need any other trigger setup.
Continue to the next section so you can set up the connection between your agent and your model.
Note
If you try to save the workflow now, the designer toolbar shows a red dot on the Errors button. The designer alerts you to this error condition because the agent requires setup before you can save any changes. However, you don't have to set up the agent now. You can continue to create your workflow. Just remember to set up the agent before you save your workflow.
Add an agent to a nonagent workflow
For an existing Stateful workflow, you can add an Agent action to include autonomous agent and LLM capabilities by following these steps:
In the Azure portal, open your Standard logic app resource.
On the logic app menu, under Workflows, select Workflows.
On the Workflows page, select the Stateful workflow where you want to add an agent.
After the designer opens, follow the general steps to add an action named Agent to your workflow, for example:
Continue with the next section to connect the agent to your model.
Connect the agent to your model
Now, create a connection between the agent and your deployed model by following these steps:
On the designer, select the title bar on the Agent action to open the Create connection pane.
This pane opens only if you don't have an existing working connection.
In the Create a new connection section, provide the following information:
Parameter Required Value Description Connection Name Yes <connection-name> The name to use for the connection to your deployed model.
This example uses fabrikam-azure-ai-connection.Agent Model Source Yes - Azure OpenAI
- Foundry Agent ServiceThe source for the deployed model. Authentication Type Yes - Managed identity
- URL and key-based authenticationThe authentication type to use for validating and authorizing an identity's access to your deployed model.
Note: For Azure AI Foundry projects, you must use managed identity authentication.
- Managed identity requires that your Standard logic app have a managed identity enabled and set up with the required roles for role-based access. For more information, see Prerequisites.
- URL and key-based authentication requires the endpoint URL and API key for your deployed model. These values automatically appear when you select your model source.
Important: For the examples and exploration only, you can use URL and key-based authentication. For production scenarios, use Managed identity.Subscription Yes <Azure-subscripton> Select the Azure subscription associated with your Azure OpenAI Service resource. Azure OpenAI Resource Yes, only when Agent Model Source is Azure OpenAI <Azure-OpenAI-Service-resource-name> Select your Azure OpenAI Service resource. AI Foundry Project Yes, only when Agent Model Source is Foundry Agent Service <Azure-AI-Foundry-project-name> Select your project in Azure AI Foundry.
Note: If you recently assigned the necessary role on your project, you might experience a delay before role permissions take effect. Meanwhile, an error message appears that you don't have correct permissions on the project.API Endpoint Yes Automatically populated The endpoint URL for your deployed model in Azure OpenAI Service.
This example useshttps://fabrikam-azureopenai.openai.azure.com/.API Key Yes, only when Authentication Type is URL and key-based authentication Automatically populated The API key for your deployed model in Azure OpenAI Service. For example, if you select Azure OpenAI as your model source and Managed identity for authentication, your connection information looks like the following sample:
If you select Foundry Agent Service as your model source with Managed identity for authentication, your connection information looks like the following sample:
When you're done, select Create new.
If you want to create another connection, on the Parameters tab, scroll down to the bottom, and select Change connection.
Continue to the next section.
Rename the agent
Clearly identify the agent's purpose by updating the agent name in following steps:
If the agent information pane isn't open, on the designer, select the agent title bar to open the pane.
On the agent information pane, select the agent name, and enter the new name, for example, Weather agent.
Note
If the connection to your model is incorrect, the Deployment Model Name list appears unavailable.
Continue to the next section to provide system instructions for the agent.
Set up system instructions for the agent
The agent requires system instructions that describe the roles that the agent can play and the tasks that the agent can perform. To help the agent learn and understand these responsibilities, you can also include the following information:
- Workflow structure
- Available actions
- Any restrictions or limitations
- Interactions for specific scenarios or special cases
To get the best results, make sure that your system instructions are prescriptive and that you're willing to refine these instructions over multiple iterations.
Under Instructions for Agent, in the System instructions box, enter all the information that the agent needs to understand its role and tasks.
Note
Autonomous agents don't accept input through the chat interface at runtime.
For this example, the weather agent example uses the following sample instructions where you later provide a subscriber list with your own email address for testing:
You're an AI agent that generates a weather report, which you send in email to each subscriber on a list. This list includes each subscriber's name, location, and email address to use.
Format the weather report with bullet lists where appropriate. Make your response concise and useful, but use a conversational and friendly tone. You can include suggestions like "Carry an umbrella" or "Dress in layers".
Here's how the example looks with the system instructions for the agent:
Optionally, on the agent, you can provide user instructions that the agent can use as prompts or questions.
For better results, make each user instruction focus on a specific task, for example:
On the agent information pane, in the User instructions section, select Add new item.
In the User instructions Item - 1 box, enter the question to ask the agent.
To add another instruction, select Add new item again.
In the User instructions item - 2 box, enter another question to ask the agent.
Repeat until you finish adding all the questions to ask the agent.
Now, you can save your workflow. On the designer toolbar, select Save.
To make sure your workflow doesn't have errors at this stage, follow these steps:
On the designer toolbar, select Run > Run.
On the workflow menu, under Tools, select Run history.
On the Run history page, on the Run history tab, in the Identifier column, select the latest workflow run.
Note
If the page doesn't show any runs, on the toolbar, select Refresh.
If the Status column shows a Running status, the agent workflow is either still working or waiting. The latter behavior happens if you enabled chat channels on your agent in an earlier release. The current release no longer includes chat channels.
The monitoring view opens and shows the workflow operations with their status. The Agent log pane is open and shows the system instructions that you provided earlier. The pane also shows the agent's response. For autonomous agent workflows, the chat box is unavailable and in ready-only mode.
However, the agent doesn't have any tools to use at this time, which means that the agent can't actually take any specific actions, such as send email to a subscriber list, until you create tools that the agent needs to complete their tasks. You might even get an email that your email server rejected the message.
Return to the designer. On the monitoring view toolbar, select Edit.
Create a tool to get weather forecast
For an agent to run prebuilt actions available in Azure Logic Apps, you must create one or more tools for the agent to use. A tool must contain at least one action and only actions. The agent calls the tool by using specific arguments.
In this example, the agent needs a tool that gets the weather forecast. You can build this tool by following these steps:
On the designer, inside the agent and under Add tool, select the plus sign (+) to open the pane where you can browse available actions.
On the Add an action pane, follow these general steps to add an action for your scenario.
This example uses the MSN Weather action named Get forecast for today.
After you select the action, both the Tool and the action appear inside the agent on the designer at the same time. Both information panes also open at the same time.
On the tool information pane, rename the tool to describe its purpose.
This example uses Get weather.
On the Details tab, for Description, enter the tool description.
This example uses Get the weather for the specified location.
Under Description, the Agent Parameters section applies only for specific use cases. For more information, see Create agent parameters.
Continue to the next section to learn more about agent parameters, their use cases, and how to create them, based on these use cases.
Create agent parameters for the 'Get forecast' action
Actions usually have parameters that require you to specify the values to use. Actions in tools are almost the same except for one difference. You can create agent parameters that the agent uses to specify the parameter values for actions in tools. You can specify model-generated outputs, values from nonmodel sources, or a combination. For more information, see Agent parameters.
The following table describes the use cases for creating agent parameters and where to create them, based on the use case:
| To | Where to create agent parameter |
|---|---|
| Use model-generated outputs only. Share with other actions in the same tool. |
Start from the action parameter. For detailed steps, see Use model-generated outputs only. |
| Use nonmodel values. | No agent parameters needed. This experience is the same as the usual action setup experience in Azure Logic Apps but is repeated for convenience in Use values from nonmodel sources. |
| Use model-generated outputs with nonmodel values. Share with other actions in the same tool. |
Start from the tool, in the Agent Parameters section. For detailed steps, see Use model outputs and nonmodel values. |
Use model-generated outputs only
For an action parameter that uses only model-generated outputs, create an agent parameter by following these steps:
In the tool, select the action to open the information pane.
For this example, the action is Get forecast for today.
On the Parameters tab, select inside the parameter box to show the parameter options.
On the right edge of the Location box, select the stars button.
This button has the following tooltip: Select to generate the agent parameter.
The Create agent parameter window shows the Name, Type, and Description fields, which are prepopulated from the source action parameter.
The following table describes the fields that define the agent parameter:
Parameter Value Description Name <agent-parameter-name> The agent parameter name. Type <agent-parameter-data-type> The agent parameter data type. Description <agent-parameter-description> The agent parameter description that easily identifies the parameter's purpose. Note
Microsoft recommends that you follow the action's Swagger definition. For example, for the Get forecast for today action, which is from the MSN Weather "shared" connector hosted and managed by global, multitenant Azure, see the MSN Weather connector technical reference article.
When you're ready, select Create.
The following diagram shows the example Get weather forecast for today action with the Location agent parameter:
Save your workflow.
Use values from nonmodel sources
For an action parameter value that uses only nonmodel values, choose the option that best fits your use case:
Use outputs from earlier operations in the workflow
To browse and select from these outputs, follow these steps:
Select inside the parameter box, and then select the lightning icon to open the dynamic content list.
From the list, in the trigger or action section, select the output that you want.
Save your workflow.
Use results from expressions
To create an expression, follow these steps:
Select inside the parameter box, and then select the function icon to open the expression editor.
Select from available functions to create the expression.
Save your workflow.
For more information, see Reference guide to workflow expression functions in Azure Logic Apps.
Use model outputs and nonmodel values
Some scenarios might need to specify an action parameter value that uses both model-generated outputs with nonmodel values. For example, you might want to create an email body that uses static text, nonmodel outputs from earlier operations in the workflow, and model-generated outputs.
For these scenarios, create the agent parameter on the tool by following these steps:
On the designer, select the tool where you want to create the agent parameter.
On the Details tab, under Agent Parameters, select Create Parameter.
Expand New agent parameter, and provide the following information, but match the action parameter details.
For this example, the example action is Get forecast for today.
Note
Microsoft recommends that you follow the action's Swagger definition. For example, to find this information for the Get forecast for today action, see the MSN Weather connector technical reference article. The example action is provided by the MSN Weather managed "shared" connector, which is hosted and run in global, multitenant Azure.
Parameter Value Description Name <agent-parameter-name> The agent parameter name. Type <agent-parameter-data-type> The agent parameter data type. Description <agent-parameter-description> The agent parameter description that easily identifies the parameter's purpose. You can choose from the following options or combine them to provide a description:
- Plain literal text with details such as the parameter's purpose, permitted values, restrictions, or limits.
- Outputs from earlier operations in the workflow. To browse and choose these outputs, select inside the Description box, and then select the lightning icon to open the dynamic content list. From the list, select the output that you want.
- Results from expressions. To create an expression, select inside the Description box, and then select the function icon to open the expression editor. Select from available functions to create the expression.When you're done, under Agent Parameters, the new agent parameter appears.
On the designer, in the tool, select the action to open the action information pane.
On the Parameters tab, select inside the parameter box to show the parameter options, and then select the robot icon.
From the Agent parameters list, select the agent parameter that you defined earlier.
For example, the finished Get weather tool looks like the following example:
Save your workflow.
Create a tool to send email
For many scenarios, an agent usually needs more than one tool. In this example, the agent needs a tool that sends the weather report in email.
To build this tool, follow these steps:
On the designer, inside the agent, next to the existing tool, select the plus sign (+) to add an action.
On the Add an action pane, follow these general steps to select another action for your new tool.
The examples use the Outlook.com action named Send an email (V2).
Like before, after you select the action, both the new Tool and action appear inside the agent on the designer at the same time. Both information panes open at the same time.
On the tool information pane, make the tool's purpose obvious by updating the tool name.
The examples use Send email.
On the Details tab, provide the following information:
For Description, enter the tool description.
This example uses Send weather forecast in email.
Create agent parameters for the 'Send an email (V2)' action
The steps in this section are nearly the same as Create agent parameters for the 'Get forecast' action, except for the different parameters in the Send an email (V2) action.
Follow the earlier steps to create the following agent parameters for the action parameter values in the action named Send an email (V2).
The action needs three agent parameters named To, Subject, and Body. For the action's Swagger definition, see Send an email (V2).
For example, the Send an email (V2) action looks like the following example:
When you're done, the example action uses the previously defined agent parameters as shown here:
The second example tool is now complete and looks like the following example:
Create a tool to provide subscriber list
Finally, for this example, create a tool named Get subscribers to provide a subscriber list for the agent parameter values to use. This tool uses the Compose action to supply the subscriber name, email address, and location. Or, you might source these inputs from blob storage or a database. Azure Logic Apps offers many options that you can use as data sources.
The following example shows how the Get subscribers tool might look:
Best practices for agents and tools
The following sections provide recommendations, best practices, and other guidance that can help you build better agents and tools.
Agents
The following guidance provides best practices for agents.
Prototype agents and tools with 'Compose' actions
Rather than use actual actions and live connections to prototype your agent and tools, use Compose actions to "mock" or simulate the actual actions. This approach provides the following benefits:
Compose actions don't produce side effects, which make these actions useful for ideation, design, and testing.
You can draft and refine system instructions, prompts, tool names and descriptions plus agent parameters and descriptions - all without having to set up and use live connections.
When you confirm that your agent and tools work with only the Compose actions, you're ready to swap in the actual actions.
When you switch over to the actual actions, you have to reroute or recreate your agent parameters to work with the actual actions, which might take some time.
Manage chat history context length
The workflow agent maintains the chat history or context, including tool invocations, based on the current limit on the number of tokens or messages to keep and pass into the model for the next interaction. Over time, the agent history grows and eventually exceeds your model's context length limit, or the maximum number of input tokens. Models differ in their context lengths.
For example, gpt-4o supports 128,000 input tokens where each token has 3-4 characters. When the agent history approaches the model's context length, consider dropping stale or irrelevant messages to stay below the limit.
Here are some approaches to reduce your agent history:
Reduce the size of results from tools by using the Compose action. For more information, see Tools - Best practices.
Carefully craft your system instructions and prompts to control the model's behavior.
Experimental capability: You have the option to try chat reduction so you can reduce the maximum number of tokens or messages to keep in chat history and pass into the model.
A workflow agent has almost the same advanced parameters as the Azure OpenAI built-in, service provider connector, except for the Agent History Reduction Type advanced parameter, which exists only in the agent. This parameter controls the history that the agent maintains, based on the maximum number of tokens or messages.
This capability is in active development and might not work for all scenarios. You can change the Agent History Reduction Type option to reduce the limit on tokens or messages. You then specify the numerical limit that you want.
To try the capability, follow these steps:
On the designer, select the agent's title bar to open the information pane.
On the Parameters tab, find the Advanced parameters section.
Check whether the parameter named Agent History Reduction Type exists. If not, open the Advanced parameters list, and select that parameter.
From the Agent History Reduction Type list, select one of the following options:
Option Description Token count reduction Shows the parameter named Maximum Token Count. Specifies the maximum number of tokens in agent history to keep and pass into the model for the next interaction. The default differs based on the currently used model in Azure OpenAI Service. The default limit is 128,000. Message count reduction Shows the parameter named Message Count Limit. Specifies the maximum number of messages in agent history to keep and pass into the model for the next interaction. No default limit exists.
Tools
The following guidance provides best practices for tools.
The name is the most important value for a tool. Make sure the name is succinct and descriptive.
The tool description provides useful and helpful context for the tool.
Both the tool name and description have character limits.
Some limits are enforced by the model in Azure OpenAI Service at run time, rather than when you save the changes in the agent in the workflow.
Too many tools in the same agent can have a negative effect on agent quality.
A good general guideline recommends that an agent includes no more than 10 tools. However, this guidance varies based on the model that you use from Azure OpenAI Service.
In tools, actions don't need to have all their inputs come from the model.
You can finely control which action inputs come from non-model sources and which inputs come from the model. For example, suppose a tool has an action that sends email. You can provide a plain and mostly static email body but use model-generated outputs for part of that email body.
Customize or transform tool results before you pass them to the model.
You can change the results from a tool before they pass into the model by using the Compose action. This approach provides the following benefits:
Improve response quality by reducing irrelevant context that passes into the model. You send only the fields that you need from a large response.
Reduce billing charges for tokens that pass into the model and avoid exceeding the model's limit on context length, the maximum number of tokens that pass into the model. You send only the fields that you need.
Combine the results from multiple actions in the tool.
You can mock the tool results to simulate the expected results from actual actions. Mock actions leave data unchanged at the source and don't incur charges for resource usage outside Azure Logic Apps.
Agent parameters
The following guidance provides best practices for agent parameters.
The name is the most important value for an agent parameter. Make sure the name is succinct and descriptive.
The agent parameter description provides useful and helpful context for the tool.
Troubleshoot problems
This section describes guidance to help troubleshoot errors or problems that you might encounter when you build or run agent workflows.
Review tool execution data
The workflow run history provides useful information that helps you learn what happened during a specific run. For an agent workflow, you can find tool execution inputs and outputs for a specific agent loop iteration.
On the workflow menu, under Tools, select Run history to open the Run history page.
On the Run history tab, in the Identifier column, select the workflow run that you want.
The monitoring view opens to show the status for each step.
Select the agent that you want to inspect. To the right side, the Agent log pane appears.
This pane shows the agent log, including tool executions during the interaction.
To get tool execution data at a specific point, find that point in the agent log, and select the tool execution reference, for example:
This action moves you to the matching tool in monitoring view. The agent shows the current iteration count.
In monitoring view, select the agent or the action with the inputs, outputs, and properties that you want to review.
The following example shows a selected action for the previously selected tool execution:
If you select the agent, you can review the following information that passes into the model and returns from the model, for example:
- Input messages passed into the model.
- Output messages returned from the model.
- Tools that the model asked the agent to call.
- Tool results that passed back into the model.
- Number of tokens that each request used.
To review a different agent loop iteration, in the agent, select the left or right arrow.
Logs in Application Insights
If you set up Application Insights or advanced telemetry for your workflow, you can review the logs for agent events, like any other action. For more information, see Enable and view enhanced telemetry in Application Insights for Standard workflows in Azure Logic Apps.
Model maximum context length exceeded
If your agent's log history exceeds the model's context length, or the maximum number of input tokens, you get an error that looks like the following example:
This model's maximum context length is 4097 tokens. However, you requested 4927 tokens (3927 in the messages, 1000 in the completion). Please reduce the length of the messages or completion.
Try reducing the limit on the number of tokens or messages that your agent keeps in log and passes into the model for the next interaction. For this example, you might select Token count reduction and set Maximum Token Count to a number below the error's stated maximum context length, which is 4097.
For more information, see Manage chat history context length.
Clean up example resources
If you don't need the resources that you created for the examples, make sure to delete the resources so that you don't continue to get charged. You can either follow these steps to delete the resource group that contains these resources, or you can delete each resource individually.
In the Azure search box, enter resource groups, and select Resource groups.
Find and select the resource groups that contain the resources for this example.
On the Overview page, select Delete resource group.
When the confirmation pane appears, enter the resource group name, and select Delete.