The azure-ai-foundry-agent
is a Python-based Azure Function application designed to interact with Azure AI Projects. It provides an HTTP-triggered endpoint for processing user messages and generating responses using AI agents.
This application is built to:
- Handle user requests with message input.
- Retrieve or create an AI agent thread.
- Interact with the Azure AI Project API to process messages.
- Generate responses based on AI agent capabilities.
- HTTP Trigger: Provides an anonymous endpoint
/agent_httptrigger
to accept user inputs. - Integration with Azure AI Projects: Uses the
azure-ai-projects
library to manage AI agents, threads, and messages. - Error Handling: Includes robust error checking and logging to ensure smooth operation.
To run this project, ensure that you have:
- Azure Functions Core Tools installed.
- Python 3.8 or later.
- Required libraries listed in
requirements.txt
. - Azure Subscription to set up required resources like AI Projects.
-
Clone the repository:
git clone https://github.com/azure-data-ai-hub/azure-ai-foundry-agent.git cd azure-ai-foundry-agent
-
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables:
- Add
AIProjectConnString
to your local settings or environment variables. This is crucial for connecting to Azure AI Projects.
- Add
-
Run the Azure Function locally:
func start
POST /agent_httptrigger
Name | Type | Description |
---|---|---|
message |
string | The user message to process. |
agentid |
string | The ID of the AI agent. |
threadid |
string | (Optional) The thread ID for context. |
{
"message": "Hello, AI Agent!",
"agentid": "agent123",
"threadid": "thread456"
}