-
Notifications
You must be signed in to change notification settings - Fork 77
Add AI Agent sample console app #1115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this supposed to be binary file? GitHub can't load it for review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure. Something wrong with its encoding. I tried in different browsers and also asked someone else to try with no luck.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You were right , I've updated the file encoding and it should now be visible in the diff
| kind: remote | ||
| ``` | ||
|
|
||
| 1. Configure your Azure App Configuration store with project endpoint: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this to add a key-value in appconfig store? The instruction is unclear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, updated instructions to be more clearer, please let me know if its better, also as part of the preq should we include instructions on how to create a project and deploy a model in Foundry ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about put it under examples/Python/WeatherAgent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that is better, this has been updated, thanks
| AgentFactory(client_kwargs={"async_credential": credential, "project_endpoint": config["Agent:ProjectEndpoint"]}).create_agent_from_yaml(yaml_str) as agent, | ||
| ): | ||
| while True: | ||
| print("How can I help? (type 'quit' to exit)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is a weather agent, the question should be related to weather.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean the initial prompt ? Instead of "How can I help ?", maybe we can include some sample output in the read me something like this
How can I help? (type 'quit' to exit)
User: What is the weather in Seattle ?
Agent response: I don’t have access to real-time data, but you can quickly check the current weather in Seattle
using a reliable source like [Weather.com](https://weather.com/weather/today/l/Seattle+WA) or your preferred weather app.
As a general overview, Seattle’s weather in early June is usually mild, with temperatures ranging from the mid-50s
to upper 60s °F (about 13–20°C). Expect partly cloudy skies with occasional showers.
If you need a weather forecast for a specific day or a longer period, let me know!
Press enter to continue...
How can I help? (type 'quit' to exit)
User: quit
Exiting... Goodbye...
Though because this agent has no tool configured its not able to give us real time weather data. Maybe we should update the agent yaml spec to include a tool like Bing search or openapi that gives the agent access to real time data? In this sample app we don't change any agent configuration and having a tool as part of the agent yaml spec can let users know that their tool configuration could also be part of the agent yaml spec.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think your proposal is reasonable, so we don't tie us to a "weather" scenario. Then we don't have to call it a WeatherAgent, but simply a ChatAgent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes and in the sample output, we can ask questions about real time data
| pip install -r requirements.txt | ||
| ``` | ||
|
|
||
| 1. Configure your Azure App Configuration store with the following key-value pairs: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 1. Configure your Azure App Configuration store with the following key-value pairs: | |
| 1. Add the following key-values to your Azure App Configuration store. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been updated, thanks
| - Azure App Configuration service | ||
| - Microsoft Foundry project | ||
| - Required environment variables: | ||
| - `AZURE_APPCONFIGURATION_ENDPOINT`: Endpoint URL of your Azure App Configuration instance |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is part of your instructions, so it's not a prereq.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zhenlan I wanted to confirm as part of the preq should we include instructions or link to relevant docs on how to create a project, deploy a model in Foundry and create a bing resource or to ease the set up for a user we can have a script that sets up all the resources in Foundry ?
| import asyncio | ||
| import os | ||
| from agent_framework.declarative import AgentFactory | ||
| from azure.identity.aio import DefaultAzureCredential as AsyncDefaultCredential |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why as AsyncDefaultCredential?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it causes a conflict, since on line 5 we still import DefaultAzureCredential in agent framework when constructing the AzureAIClient it expects async credentials to use for authentication (https://github.com/eavanvalkenburg/agent-framework/blob/0d9ae1920dea956856055770f71192ed6317f72d/python/packages/azure-ai/agent_framework_azure_ai/_client.py#L89) or if credential is not provided project_client should be provided

This PR
Adds the AI agent sample console app, that we will include in the AI Agent configuration doc. The agent is created declaratively check out creating agents declaratively for more information.
Sample yaml agent spec used for this sample
In the future we will build on this sample and include tool configuration to show case dynamic configuration.