|
1 | 1 | **Microsoft Foundry Agent** is a specialized agent within the Microsoft Agent Framework, designed to provide enterprise-level conversational capabilities with seamless tool integration. It automatically handles tool calling, so you don't need to manually parse and invoke functions. The agent also securely manages conversation history using threads, which reduces the work of maintaining state. The Microsoft Foundry Agent supports many built-in tools, including code interpreter, file search, and web search. It also provides integration capabilities for Azure AI Search, Azure Functions, and other Azure services. |
2 | 2 |
|
3 | | -## Creating a Microsoft Foundry Agent |
| 3 | +## Creating an Azure AI Agent |
4 | 4 |
|
5 | 5 | A Microsoft Foundry Agent includes all the core capabilities you typically need for enterprise AI applications, like function execution, planning, and memory access. This agent acts as a self-contained runtime with enterprise-level features. |
6 | 6 |
|
7 | 7 | To use a Microsoft Foundry Agent: |
8 | 8 | 1. Create a Microsoft Foundry project. |
9 | 9 | 1. Add the project connection string to your Microsoft Agent Framework application code. |
10 | | -1. Set up authentication credentials. |
11 | | -1. Create a `ChatAgent` with an `AzureAIAgentClient`. |
12 | | -1. Define tools and instructions for your agent. |
| 10 | +1. Set up authentication credentials with `AzureCliCredential`. |
| 11 | +1. Connect to your project client with the `AzureOpenAIResponsesClient` class. |
| 12 | +1. Create an `Agent` instance with the client, instructions, and tools you want to use. |
13 | 13 |
|
14 | | -Here's the code that shows how to create a Microsoft Foundry Agent: |
| 14 | +Once your agent is created, you can create a conversation session to interact with your agent and get responses to your questions. |
15 | 15 |
|
16 | | -```python |
17 | | -from agent_framework import AgentThread, ChatAgent |
18 | | -from agent_framework.azure import AzureAIAgentClient |
19 | | -from azure.identity.aio import AzureCliCredential |
| 16 | +### Azure AI Agent key components |
20 | 17 |
|
21 | | -def get_weather( |
22 | | - location: Annotated[str, Field(description="The location to get the weather for.")], |
23 | | -) -> str: |
24 | | - """Get the weather for a given location.""" |
25 | | - return f"The weather in {location} is sunny with a high of 25°C." |
| 18 | +The Microsoft Agent Framework Azure AI Agent uses the following components to work: |
26 | 19 |
|
27 | | -# Create a ChatAgent with Azure AI client |
28 | | -async with ( |
29 | | - AzureCliCredential() as credential, |
30 | | - ChatAgent( |
31 | | - chat_client=AzureAIAgentClient(async_credential=credential), |
32 | | - instructions="You are a helpful weather agent.", |
33 | | - tools=get_weather, |
34 | | - ) as agent, |
35 | | -): |
36 | | - # Agent is now ready to use |
37 | | -``` |
| 20 | +- **AzureOpenAIResponsesClient** - manages the connection to your Microsoft Foundry project. This client lets you access the services and models associated with your project and provides enterprise-level authentication and security features. |
38 | 21 |
|
39 | | -Once your agent is created, you can create a thread to interact with your agent and get responses to your questions. For example: |
| 22 | +- **Agent** - the main agent class that combines the client, instructions, and tools to create a working AI agent that can handle conversations and complete tasks. |
40 | 23 |
|
41 | | -```python |
42 | | -# Create the agent thread for ongoing conversation |
43 | | -thread = agent.get_new_thread() |
44 | | - |
45 | | -# Ask questions and get responses |
46 | | -first_query = "What's the weather like in Seattle?" |
47 | | -print(f"User: {first_query}") |
48 | | -first_result = await agent.run(first_query, thread=thread) |
49 | | -print(f"Agent: {first_result.text}") |
50 | | -``` |
51 | | - |
52 | | -### Microsoft Foundry Agent key components |
53 | | - |
54 | | -The Microsoft Agent Framework Microsoft Foundry Agent uses the following components to work: |
55 | | - |
56 | | -- **AzureAIAgentClient** - manages the connection to your Microsoft Foundry project. This client lets you access the services and models associated with your project and provides enterprise-level authentication and security features. |
57 | | - |
58 | | -- **ChatAgent** - the main agent class that combines the client, instructions, and tools to create a working AI agent that can handle conversations and complete tasks. |
59 | | - |
60 | | -- **AgentThread** - automatically keeps track of conversation history between agents and users, and manages the conversation state. You can create new threads or reuse existing ones to maintain context across interactions. |
| 24 | +- **AgentSession** - automatically keeps track of conversation history between agents and users, and manages the conversation state. You can create new threads or reuse existing ones to maintain context across interactions. |
61 | 25 |
|
62 | 26 | - **Tools integration** - support for custom functions that extend agent capabilities. Functions are automatically registered and can be called by agents to connect with external APIs and services. |
63 | 27 |
|
|
0 commit comments