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 solution requires workflows that support natural language, interact with humans, and use agents connected to large language models (LLMs) to complete tasks, create a conversational agent workflow in Azure Logic Apps. This workflow type is the best option for such scenarios and is typically user-driven, short-lived, or session-based.
All agent workflows perform tasks by using an agent connected to an LLM. The agent uses an iterative looped process to solve complex, multi-step 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 instructions and 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, conversational agent workflows support a vast range of scenarios that can greatly benefit from AI capabilities.
The following screenshot shows an example conversational agent workflow that you create in this guide. The workflow uses an agent to get the current weather and send that information in email. The diagram shows the agent information pane where you set up the agent and provide instructions through a chat interface 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 Conversational Agents type, which works through human-provided interactions or inputs. 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 an Azure OpenAI Service resource with a deployed Azure OpenAI Service model.
Agent workflows support only specific models. For more information, see Supported models.
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:
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.
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 ContributorFor 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 generally 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 a conversational agent workflow, you must select the Conversational Agents workflow type. You can't start with the Stateful or 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. |
| 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 currently unsupported. |
| Documentation | This guide covers the basic steps to create a conversational agent workflow. Documentation for advanced features is in progress. |
| General limits | For general information about the limits in Azure OpenAI Service and Azure Logic Apps, see the following articles: - Azure OpenAI Service quotas and limits - Azure Logic Apps limits and configuration |
Create a conversational agent workflow
Follow these steps to create a workflow with an empty Agent.
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 Conversational Agents > Create.
The designer opens and shows a workflow that starts with the required trigger named When a new chat session starts and 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.
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.
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 The 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.
- 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. 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:
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
Conversational agents can accept extra input through the chat interface at runtime.
For this example, the weather agent example uses the following sample instructions where you later ask questions and provide your own email address for testing:
You're an AI agent that answers questions about the weather for a specified location. You can also send a weather report in email if you're provided email address. If no address is provided, ask for an email address.
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:
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 Chat.
In the chat client interface, ask the following question: What is the current weather in Seattle?
Check that the response is what you expect, for example:
Return to your workflow in the designer.
On the workflow sidebar, 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 still working.
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.
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, 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 current weather
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 current weather. 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 current weather.
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 current weather.
On the Details tab, for Description, enter the tool description.
This example uses Gets 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 current weather' 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 current weather.
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 current weather 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 current weather 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 current weather.
Note
Microsoft recommends that you follow the action's Swagger definition. For example, to find this information for the Get current weather action, see the MSN Weather connector technical reference article. The example action is provided by the MSN Weather managed connector, which is hosted and run in a shared cluster on 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 current 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 action, 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 report in email.
The second example agent tool looks like the following example:
Create agent parameters for the 'Send an email (V2)' action
For the Send an email (V2) action, the general steps to create agent parameters are similar to the steps in Create agent parameters for the 'Get current weather' action except for the different parameters.
In the Send an email (V2) action, follow the earlier general steps to create agent parameters for the To, Subject, and Body parameters. For the action's Swagger definition, see Send an email (V2).
When you're done, your Send an email (V2) action has agent parameters that look like the following example:
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.
Authentication and authorization
For nonproduction activities, such as design, development, and quick testing, the Azure portal provides, manages, and uses a developer key to run your workflow and execute actions on your behalf. The following list recommends some best practices for handling this developer key:
Treat the developer key strictly and only as a design-time convenience for authentication and authorization.
Before you expose your workflow to agents, automation, or wider user populations, migrate to Easy Auth or signed SAS with network restrictions.
Basically, if anyone or anything outside your Azure portal session needs to call your logic app workflow, the developer key is no longer appropriate. Make sure that you enable Easy Auth or use managed identity–based flows instead.
When you're ready to release your agent workflow into production, make sure to follow the migration steps to prepare for production authentication and authorization. For more information, see the Authentication and authorization.
Migrate to production authentication
On your logic app resource, set up Easy Auth for authentication and authorization.
Enforce any authentication required access patterns.
Optionally, lock down any trigger endpoint URLs by disabling or regenerating any unused SAS URLs.
For conversational agent workflows, get the chat client URL so you can embed an external chat client interface wherever you want to support human interactions.
Troubleshoot authentication migration
The following table describes common problems you might encounter when you try to migrate from a developer key to Easy Auth, their possible causes, and actions you can take:
| Symptom | Likely cause | Action |
|---|---|---|
| Portal tests work, but external calls get 401 response. | External calls don't have a valid Easy Auth access token or signed SAS tokens. | Set up Easy Auth or use a workflow trigger URL with a signed SAS. |
| Designer tests work, but Azure API Management calls fail. | API Management calls are missing expected header information. | Add OAuth 2.0 token acquisition in API Management policy or use managed identity. |
| Access is inconsistent after a role changes. | Cached session in the Azure portal | - Sign out and sign back in. Get a fresh token. |
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.