Skip to content

Commit 02f5f21

Browse files
committed
add next steps
1 parent e29af1b commit 02f5f21

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

articles/app-service/invoke-openapi-web-app-from-azure-ai-agent-service.md

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,43 +17,35 @@ ms.collection: ce-skilling-ai-copilot
1717

1818
To complete this tutorial, you need an Azure AI Agent project and a RESTful API hosted on Azure App Service. The API should have an OpenAPI specification that defines the API. The OpenAPI specification for the sample app in this tutorial is provided.
1919

20-
1. Ensure you complete the prerequisites and setup steps in the [quickstart](/azure/ai-services/agents/quickstart.md). This quickstart walks you through creating your Azure AI Hub and Agent project. You can also complete the agent configuration and sample the quickstart provides to get a full understanding of the tool and ensure your setup works.
21-
1. Follow the guidance to create the sample app and deploy it to Azure App Service. The sample app is a simple to-do list API that allows you to create, read, update, and delete items from the list.
20+
1. Ensure you complete the prerequisites and setup steps in the [quickstart](/azure/ai-services/agents/quickstart.md). This quickstart walks you through creating your Azure AI Hub and Agent project. You should complete the agent configuration and agent sample the quickstart provides to get a full understanding of the tool and ensure your setup works.
21+
1. Follow the guidance in the next section to create the sample app and deploy it to Azure App Service. The sample app is a simple to-do list app that allows you to create, read, update, and delete items from the list.
2222

2323
## Create and deploy the sample app
2424

25-
1. Ensure you have the [Azure CLI](https://learn.microsoft.com/cli/azure/install-azure-cli) installed and that you're logged into your Azure account. You can sign-in using the following command.
26-
25+
1. Ensure you have the [Azure CLI](/cli/azure/install-azure-cli) installed and that you're logged into your Azure account. You can sign-in using the following command.
2726
```bash
2827
az login
2928
```
30-
3129
1. Ensure you have [Git installed](https://git-scm.com/downloads).
3230
1. Ensure you have the latest [.NET 9.0 SDK installed](https://dotnet.microsoft.com/download/dotnet/9.0).
3331
1. In the terminal window, use `cd` to go to a working directory.
3432
1. Clone the sample repository, and then go to the repository root. This repository contains an app based on the tutorial [ASP.NET Core web API documentation with Swagger / OpenAPI](/aspnet/core/tutorials/web-api-help-pages-using-swagger?tabs=visual-studio). It uses a Swagger generator to serve the [Swagger UI](https://swagger.io/swagger-ui/) and the Swagger JSON endpoint.
35-
3633
```bash
3734
git clone https://github.com/Azure-Samples/dotnet-core-api
3835
cd dotnet-core-api
3936
```
40-
4137
1. You can run the app locally to ensure it works. To start the app, run the following commands.
42-
4338
```bash
4439
dotnet restore
4540
dotnet run
4641
```
47-
4842
1. Navigate to `http://localhost:5000/swagger` in a browser to try the Swagger UI.
4943
1. Navigate to `http://localhost:5000/api/todo` to see a list of ToDo JSON items.
5044
1. To stop the app, press `Ctrl+C` in the terminal window.
5145
1. To deploy the app to Azure App Service, run the following command.
52-
5346
```bash
5447
az webapp up
5548
```
56-
5749
1. After the app is deployed, navigate to the URL provided in the terminal window to see the app running in Azure App Service. It can take a few minutes for the app to be fully deployed and running. Note this URL for later use.
5850

5951
## Connect your AI Agent to your App Service API
@@ -63,7 +55,6 @@ To complete this tutorial, you need an Azure AI Agent project and a RESTful API
6355
Now that you have the required infrastructure, you can put it all together and start interacting with your API using your AI Agent. For a general overview on how to do get started, see [How to use Azure AI Agent Service with OpenAPI Specified Tools](/azure/ai-services/agents/how-to/tools/openapi-spec.md). That overview includes prerequisites and other requirements including how to include authentication if your API requires it. The provided sample API is publicly accessible so authentication isn't required.
6456

6557
1. This specification is the OpenAPI specification for the sample app that is provided. On your local machine, create a file called `swagger.json` and copy the following contents.
66-
6758
```json
6859
{
6960
"openapi": "3.0.1",
@@ -314,14 +305,12 @@ Now that you have the required infrastructure, you can put it all together and s
314305
]
315306
}
316307
```
317-
318308
1. Replace the placeholder for `APP_SERVICE_URL` with your app's URL that you copied earlier. This URL is in the format `https://<app_name>.azurewebsites.net`.
319309
1. Review the file to understand the API and its endpoints. The `operationId` values are CRUD operations that can be performed on the to-do list. Once the app is up and running, you can use your AI Agent to invoke the API and perform the various operations on your behalf using natural language. At the end of the specification, you have the `securitySchemes` section. This security section is where you add authentication if your API requires it. This section is left blank for the sample app, but is included because the AI Agent Service requires it.
320310

321311
### Create the OpenAPI Spec tool definition
322312

323313
1. Create a file in the same directory as your `swagger.json` file called `tool.py`. Copy the following contents into the file. Ensure you complete the prerequisites and setup steps in the [quickstart](/azure/ai-services/agents/quickstart.md) to get the required packages installed as well as get you logged into your Azure account.
324-
325314
```python
326315
import os
327316
import jsonref
@@ -394,16 +383,26 @@ Now that you have the required infrastructure, you can put it all together and s
394383
project_client.agents.delete_agent(agent.id)
395384
print("Deleted agent")
396385
```
397-
398-
1. Replace the placeholder for your project's connection string. If you need help with finding the connection string, see the [Configure and run agent section of the quickstart](/azure/ai-services/agents/quickstart.md#configure-and-run-agent) for details on how to get your connection string.
399-
1. Review the file to understand how the OpenAPI tool is created and how the AI Agent is invoked. Each time the tool is invoked, the AI Agent uses the OpenAPI specification to determine how to interact with the API. The OpenAPI specification is passed into the file. The `message_content` variable is where you enter the natural language command that you want the AI Agent to perform. You're prompted to enter the message once you run the script. The AI Agent invokes the API and returns the results. It creates and deletes the AI Agent each time you run the script.
386+
1. Replace the placeholder for your project's connection string. If you need help with finding the connection string, see the [Configure and run agent section of the quickstart](/azure/ai-services/agents/quickstart.md#configure-and-run-agent).
387+
1. Review the file to understand how the OpenAPI tool is created and how the AI Agent is invoked. The OpenAPI specification is passed into the file. Each time the tool is invoked, the AI Agent uses the OpenAPI specification to determine how to interact with the API. The `message_content` variable is where you enter the natural language command that you want the AI Agent to perform. You're prompted to enter the message once you run the script. The AI Agent invokes the API and returns the results. It creates and deletes the AI Agent each time you run the script.
400388

401389
## Run the OpenAPI Spec tool
402390

403391
1. Open a terminal and navigate to the directory where you created the `tool.py` and `swagger.json` files. To run the script, run the following command.
404-
405392
```bash
406393
python tool.py
407394
```
395+
1. When prompted, enter a message for your Agent. For example, you can enter "What's on my to-do list?", "Add a task to buy bread," "Mark all my tasks as done," or any other question or action that can be performed on the list. The AI Agent then invokes the API and returns the results. You can also enter `Add an item to the to do list` and the AI Agent prompts you for the details of the item to add.
396+
397+
## Next steps
398+
399+
Now that you learned how to connect your AI Agent to an API on Azure App Service, you can explore the other AI integrations available with App Service:
400+
401+
> [!div class="nextstepaction"]
402+
> [Deploy an application that uses OpenAI on Azure App Service](./deploy-intelligent-apps.md)
403+
404+
> [!div class="nextstepaction"]
405+
> [Run a local SLM in a sidecar container in Azure App Service](./tutorial-sidecar-local-small-language-model.md)
408406
409-
1. When prompted, enter a message for your Agent. For example, you can enter "What's on my to-do list?", "Add a task to buy bread," "Mark all my tasks as done," or any other question or action that can be performed on the list. The AI Agent then invokes the API and returns the results. You can also enter `Add an item to the to do list` and the AI Agent prompts you for the details of the item to add.
407+
> [!div class="nextstepaction"]
408+
> [Deploy a .NET Blazor app connected to Azure SQL and Azure OpenAI on Azure App Service](./deploy-intelligent-apps-dotnet-to-azure-sql.md)

0 commit comments

Comments
 (0)