File tree Expand file tree Collapse file tree
examples/Python/WeatherAgent Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,32 +25,31 @@ This sample demonstrates using Azure App Configuration to load agent YAML specif
2525 pip install -r requirements.txt
2626 ```
2727
28- 1 . Configure your Azure App Configuration store with the agent YAML specification :
28+ 1 . Configure your Azure App Configuration store with the following key-value pairs :
2929
30+ | Key | Value |
31+ | -----| -------|
32+ | _ WeatherAgent: Spec_ | See YAML below |
33+ | _ WeatherAgent: ProjectEndpoint_ | Your Foundry project endpoint |
34+
35+ ** YAML specification for _ WeatherAgent:Spec_ :**
3036 ``` yaml
31- kind : Prompt
32- name : WeatherAgent
33- description : Weather Agent
34- instructions : You are a helpful assistant.
35- model :
36- id : gpt-4.1
37- connection :
38- kind : remote
37+ kind : Prompt
38+ name : WeatherAgent
39+ description : Weather Agent
40+ instructions : You are a helpful assistant.
41+ model :
42+ id : gpt-4.1
43+ connection :
44+ kind : remote
3945 ` ` `
40-
41- 1. Configure your Azure App Configuration store with project endpoint:
42-
43- ` ` ` console
44- Agent:ProjectEndpoint - Your Foundry project endpoint
45- ```
46-
47461. Set the required environment variables:
4847
4948 ` ` ` bash
5049 export AZURE_APPCONFIGURATION_ENDPOINT="https://your-appconfig.azconfig.io"
5150 ```
5251
53- # # Running the Application
52+ ## Run the Application
5453
5554Start the console application:
5655
Original file line number Diff line number Diff line change 11import asyncio
22import os
33from agent_framework .declarative import AgentFactory
4- from azure .identity .aio import AzureCliCredential
4+ from azure .identity .aio import DefaultAzureCredential as AsyncDefaultCredential
55from azure .identity import DefaultAzureCredential
66from azure .appconfiguration .provider import load
77
88async def main ():
9- endpoint = os .environ ["APP_CONFIGURATION_ENDPOINT " ]
9+ endpoint = os .environ ["AZURE_APPCONFIGURATION_ENDPOINT " ]
1010 credential = DefaultAzureCredential ()
1111
1212 config = load (endpoint = endpoint , credential = credential )
1313
14- yaml_str = config ["Agent :Spec" ]
14+ yaml_str = config ["WeatherAgent :Spec" ]
1515
1616 async with (
17- AzureCliCredential () as credential ,
18- AgentFactory (client_kwargs = {"async_credential" : credential , "project_endpoint" : config ["Agent :ProjectEndpoint" ]}).create_agent_from_yaml (yaml_str ) as agent ,
17+ AsyncDefaultCredential () as credential ,
18+ AgentFactory (client_kwargs = {"async_credential" : credential , "project_endpoint" : config ["WeatherAgent :ProjectEndpoint" ]}).create_agent_from_yaml (yaml_str ) as agent ,
1919 ):
2020 while True :
2121 print ("How can I help? (type 'quit' to exit)" )
@@ -32,4 +32,4 @@ async def main():
3232 print ("Exiting... Goodbye..." )
3333
3434if __name__ == "__main__" :
35- asyncio .run (main ())
35+ asyncio .run (main ())
File renamed without changes.
You can’t perform that action at this time.
0 commit comments