You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/steps/6-build-agent.md
+70-58Lines changed: 70 additions & 58 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -49,8 +49,12 @@ If you used a different region, please [create a new Azure AI Foundry project](h
49
49
50
50
You'll be prompted to save the agent's configuration file. Assign the name `my-agent.agent.yaml` and save the file in the agents folder you created earlier. Once saved, the yaml file and the Agent Designer will open for you to configure your agent.
51
51
52
+
**Security Note 🔐**
53
+
54
+
Add the `my-agent.agent.yaml` file to your `.gitignore` file to prevent it from being committed to your repository. This file will contain sensitive information such as your subscription ID and agent ID, which should not be shared publicly.
55
+
52
56
On the Agent Designer,
53
-
- Give your agent a name. i.e `my-agent`
57
+
- Give your agent a name. i.e `my-agent`_that will have been auto-populated for you._
54
58
- Enter a foundation model for your agent from your model list. This model will power the agent's core reasoning and language capabilities. _Example. gpt-4o_
55
59
- System instructions for your agent. This tells the agent how it should behave. Enter the following:
56
60
@@ -76,9 +80,9 @@ If you used a different region, please [create a new Azure AI Foundry project](h
76
80
responses.
77
81
tools: [] # We'll add tools later
78
82
````
79
-
3. **Deploy Agent**
83
+
3. **Create Agent**
80
84
81
-
Click on the **Deploy to Azure AI Foundry** button in the Agent Designer to deploy your agent to Azure AI Foundry Once created, the agent will pop up in the AI Foundry extension under the "Agents" section.
85
+
Click on the **Create Agent on Azure AI Foundry** button in the Agent Designer to create and deploy your agent to Azure AI Foundry. Once created, the agent will pop up in the AI Foundry extension under the "Agents" section.
82
86
83
87

84
88
@@ -131,55 +135,59 @@ Tools calling is a powerful feature that allows your agent to perform specific t
131
135
132
136
6. Once connected, click **close**
133
137
134
-
### Prepare the Bing Grounding tool YAML
138
+
### Add bing tool to your Agent
139
+
With your `my-agent.agent.yaml` file open, click on the Foundry icon at the top right corner to open the Agent Designer.
135
140
136
-
Back on Visual Studio Code, create a tool configuration .yaml file called `bing.yaml` in the same directory as your agent configuration file (the agent folder). Paste in the following into the `bing.yaml` file:
-`bing_grounding_connection_name` = The connection name **NOT** the bing resource name
149
+
- Select the `Agent Tool - Bing Grounding` tool from the list of available built-in tools, and this will add the configuration for the Bing Search API tool to your agent configuration file.
152
150
153
-
Save the `bing.yaml` file.
151
+
- To add the connection to the Bing resource you created earlier, type the **/** character after the **-** under **tool_connections**, and start typing `subscriptions`, and you'll see the IntelliSense kick in with your own subscription details. Select to complete the connection selection.
154
152
155
-
On the Agent Designer, click on the + icon next to the "Tools" section. This will prompt you to select a yaml file for the tool. Select the `bing.yaml` file you created earlier. Click on **Update Agent on Azure AI Foundry** to update your agent with the new tool to Azure AI Foundry.
and replace the placeholders with your information:
160
+
- `subscription_ID` = Your Azure Subscription ID
161
+
- `resource_group_name` = Your Resource Group name
162
+
- `project_name` = Your Project name on AI Foundry
163
+
- `bing_grounding_connection_name` = The connection name **NOT** the bing resource name
158
164
159
-
Now that we have added the Bing Search API tool to our agent, we can test it in the Playground. Open the "Agent Playground" and send the agent a message like _"What's the weather in Nairobi right now?"_ The agent should use the Bing Search API tool to fetch the current weather information and respond with a friendly message.
165
+
- A Bing Grounding connection should appear under the **Tool** section on the Agent Designer. Click on **Update Agent on Azure AI Foundry** to update your agent with the new tool configuration.
166
+
167
+
Now that you've added the Bing Grounding to your agent, you can test it in the Playground. Open the "Agent Playground" and send the agent a message like _"What's the weather in Nairobi right now?"_ The agent should use the Bing Search API tool to fetch the current weather information and respond with a friendly message.
160
168
161
169

162
170
163
171
164
-
<!--## Step 4️⃣: Agent playground to Code
172
+
## Step 4️⃣: Agent playground to Code
165
173
166
-
The Agent Playground is a great way to test your agent's capabilities, but it's not the only way to interact with it. In this step, we will update our application to use the agent we just created. This will allow us to use the agent in our application and make it more useful.
174
+
The Agent Playground is a great way to test your agent's capabilities, but it's not the only way to interact with it. In this step, you will update our application to use the agent you just created.
167
175
168
176
### Get Agent code
169
177
Open the **Agent Playground** on the [AI Foundry portal](https://ai.azure.com/) and click on **View Code**. This will show you the code that is used to interact with the agent.
Switch to the **JavaScript** tab, copy and paste the code into a new file called `agent.js` in the `packages/webapi` directory of your project. The code will already have the necessary setup for the agent, and will retrieve and display the current thread.
181
+
Switch to the **JavaScript** tab, copy and paste the code into a new file called `agent.js` in the `packages/webapi` directory of your project. The code will already have the necessary setup for the agent, including your hard-coded connection string and agent ID.
174
182
175
183
Run the code using `node agent.js` and you should see the output in the terminal.
176
184
177
-
To send a message to the agent, you can update the `client.agents.createMessage` method to include the message you want to send. For example, you can replace the content with "When is the current weather in Cairo?" and run the code again. You should see the agent's response in the terminal.
185
+
To send a message to the agent, you can update the `client.agents.createMessage` method to include the message you want to send. For example, you can replace the content with "Give me a summary of this year's Keynote at Microsoft Build" and run the code again. You should see the agent's response in the terminal.
@@ -463,24 +475,25 @@ On the app, select the **Agent** mode from the dropdown. Type a message in the i
463
475
464
476
If you ask the agent a question that requires real-time information, such as _"What's the current weather in Spain?"_, the agent should ground its response using the Bing Search API and provide you with the latest information.
465
477
466
-
-->
478
+

467
479
468
480
469
-
## ✅ Activity: Push your updated code to the repository - TBD
481
+
## ✅ Activity: Push your updated code to the repository
470
482
471
483
### Quest Checklist
472
484
473
485
To complete this quest and **AUTOMATICALLY UPDATE** your progress, you MUST push your code to the repository as described below.
474
486
475
487
**Checklist**
476
488
477
-
-[ ] Have a `agent` folder in the packages directory
489
+
- [ ] Ensure your agent configuration file is added to `.gitignore` to prevent it from being committed. DON'T PUSH IT TO THE REPOSITORY.
490
+
- [ ] Have an `agentService.js` file in the `packages/webapi` directory
478
491
479
492
1. In the terminal, run the following commands to add, commit, and push your changes to the repository:
480
493
481
494
```bash
482
495
git add .
483
-
git commit -m "Added agent"
496
+
git commit -m "Added agent mode"
484
497
git push
485
498
```
486
499
2. After pushing your changes, **WAIT ABOUT 15 SECONDS FOR GITHUB ACTIONS TO UPDATE YOUR README**.
@@ -494,6 +507,5 @@ To complete this quest and **AUTOMATICALLY UPDATE** your progress, you MUST push
494
507
Here are some additional resources to help you learn more about building AI agents and extending their capabilities with tools:
495
508
- [Azure AI Agents JavaScript examples](https://github.com/Azure-Samples/azure-ai-agents-javascript)
496
509
- [Your First AI Agent in JS with Azure AI Agent Service](https://www.youtube.com/live/RNphlRKvmJQ?si=I3rUp-LmnvS008ym)
497
-
- [Build Apps and Agents with Visual Studio Code and Azure blog](https://devblogs.microsoft.com/blog/build-apps-and-agents-with-visual-studio-code-and-azure)
498
-
- [📹 DEMFP781: From Prompt to Product: Build an AI Agent That Generates UI](https://build.microsoft.com/en-US/sessions/DEMFP781?source=sessions)
499
-
- [Build with the AI Foundry JavaScript SDK](https://learn.microsoft.com/en-us/azure/ai-foundry/how-to/develop/sdk-overview?pivots=programming-language-javascript)
510
+
- [Create a new Agent - JS/TS](https://learn.microsoft.com/en-us/azure/ai-services/agents/quickstart?pivots=programming-language-javascript)
511
+
- [📹 DEMFP781: From Prompt to Product: Build an AI Agent That Generates UI](https://build.microsoft.com/en-US/sessions/DEMFP781?source=sessions)
0 commit comments