Azure AI Agent¶
Azure AI Agent is a third-party agent hosted on Microsoft Azure through the AI Foundry. This cloud-hosted agent handles tasks such as interpreting user queries, determining when to invoke specific tools, executing these tools, and returning processed results to the user.
Our AI Refinery SDK allows seamless integration with a user's customized Azure AI Agent using the AzureAIAgent class. This integration brings the full power of the Azure AI Agent to applications, enhancing performance and capabilities on our AI Refinery platform.
Creating Azure AI Agent ¶
Before creating user's agent in an Azure AI Foundry project, user will first need to create a project and set up resource correctly. To make things smoother, it's best to explicitly choose the AI hub resource option rather than going with Azure's default recommendation (Azure AI Foundry resource). This choice is important because only hub resource based projects provide you with the essential connection stringrequired for agent integration.
Users can customize an Azure AI Agent through Microsoft AI Foundry. To create an agent, follow these steps:
- Log in to AI Foundry.
- In the left sidebar, click on Agents.
- Click Create Agent.
- Interact with the Copilot Helper, which will guide you step-by-step in providing:
- Name of the agent
- Description
- Simple instructions for the agent to follow
Once created, users can optionally customize their agent by:
- Adjusting the temperature (controls creativity vs. determinism)
- Uploading files to the Knowledge Base
- Enabling built-in tools such as the Code Interpreter
Onboarding Azure AI Agent¶
To use the Azure AI agents through our AI Refinery SDK, users need the following parameters:
| Variable | Description |
|---|---|
connection_string |
To authenticate and connect the application to the Azure AI Foundry project. |
agent_id |
Unique identifier assigned to each agent within the Azure AI Agent Service and typically starts with asst_. |
contexts |
Allows for the provision of additional information during communication with the Azure AI Agent. |
Workflow Overview¶
The workflow of the AzureAIAgent class consists of four components:
- Initialization: An agent is created in Azure AI Foundry and registered in AI Refinery with the specified configuration.
- Sending a Query: A user query is forwarded from AI Refinery to the
Azure AI Agentrunning on the Microsoft platform. - Microsoft-Side Processing: The
Azure AI Agentdecides whether to use predefined tools, knowledge bases, or other resources and processes the query in the Microsoft platform. - Receiving and Parsing the Response: The
Azure AI Agentreturns the processed results to AI Refinery, where they are then parsed to extract the final answer.
Usage and Quickstart¶
To quickly set up an AI Refinery project with an AzureAIAgent, the user should first create their own Azure AI Agent in AI Foundry. Once the agent is ready, use the YAML configuration template below to integrate it into the AI Refinery project.
Specifically, ensure the following configurations are included:
- Add a utility agent with
agent_class: AzureAIAgentunderutility_agents. - Ensure the
agent_nameyou chose for yourAzureAIAgentis listed in theagent_listunderorchestrator. - Congfigure Azure authentication (
az loginorConnect-AzAccount) with the terminal you start the AI Refinery project. - Use the latest
airefinery-sdkwithazure-ai-projects==1.0.0b8for functionality.
Template YAML Configuration of AzureAIAgent¶
See the YAML template below for the AzureAIAgent configuration.
orchestrator:
agent_list:
- agent_name: <name of the agent> # The name you choose for your AzureAIAgent.
utility_agents:
- agent_class: AzureAIAgent
agent_name: <name of the agent> # The name you choose for your AzureAIAgent
agent_description: <description of the agent> # Description of functionality
config:
connection_string: <project connection string> # A connection string to access the project in Azure AI Foundry
agent_id: <unique agent ID> # A unique agent ID is assigned upon creation; Requires `az login` or `Connect-AzAccount` to retrieve it.
contexts:
- "date"
- "chat_history"