Skip to content

Commit c820aa7

Browse files
authored
Merge pull request #825 from MicrosoftDocs/main
Merge main to live
2 parents c638f6c + a63247f commit c820aa7

66 files changed

Lines changed: 2189 additions & 292 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

agent-framework/integrations/ag-ui/backend-tool-rendering.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ ChatClient chatClient = new AzureOpenAIClient(
147147
new DefaultAzureCredential())
148148
.GetChatClient(deploymentName);
149149

150-
ChatClientAgent agent = chatClient.AsIChatClient().CreateAIAgent(
150+
ChatClientAgent agent = chatClient.AsIChatClient().AsAIAgent(
151151
name: "AGUIAssistant",
152152
instructions: "You are a helpful assistant with access to restaurant information.",
153153
tools: tools);

agent-framework/integrations/ag-ui/frontend-tools.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ static string GetUserLocation()
5757
AITool[] frontendTools = [AIFunctionFactory.Create(GetUserLocation)];
5858

5959
// Pass tools when creating the agent
60-
AIAgent agent = chatClient.CreateAIAgent(
60+
AIAgent agent = chatClient.AsAIAgent(
6161
name: "agui-client",
6262
description: "AG-UI Client Agent",
6363
tools: frontendTools);
@@ -67,7 +67,7 @@ The rest of your client code remains the same as shown in the Getting Started tu
6767

6868
### How Tools Are Sent to the Server
6969

70-
When you register tools with `CreateAIAgent()`, the `AGUIChatClient` automatically:
70+
When you register tools with `AsAIAgent()`, the `AGUIChatClient` automatically:
7171

7272
1. Captures the tool definitions (names, descriptions, parameter schemas)
7373
3. Sends the tools with each request to the server agent which maps them to `ChatAgentRunOptions.ChatOptions.Tools`
@@ -123,7 +123,7 @@ This middleware pattern allows you to:
123123

124124
The following are new concepts for frontend tools:
125125

126-
- **Client-side registration**: Tools are registered on the client using `AIFunctionFactory.Create()` and passed to `CreateAIAgent()`
126+
- **Client-side registration**: Tools are registered on the client using `AIFunctionFactory.Create()` and passed to `AsAIAgent()`
127127
- **Automatic capture**: Tools are automatically captured and sent via `ChatAgentRunOptions.ChatOptions.Tools`
128128

129129
## How Frontend Tools Work

agent-framework/integrations/ag-ui/getting-started.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ ChatClient chatClient = new AzureOpenAIClient(
9292
new DefaultAzureCredential())
9393
.GetChatClient(deploymentName);
9494

95-
AIAgent agent = chatClient.AsIChatClient().CreateAIAgent(
95+
AIAgent agent = chatClient.AsIChatClient().AsAIAgent(
9696
name: "AGUIAssistant",
9797
instructions: "You are a helpful assistant.");
9898

@@ -107,7 +107,7 @@ await app.RunAsync();
107107
- **`AddAGUI`**: Registers AG-UI services with the dependency injection container
108108
- **`MapAGUI`**: Extension method that registers the AG-UI endpoint with automatic request/response handling and SSE streaming
109109
- **`ChatClient` and `AsIChatClient()`**: `AzureOpenAIClient.GetChatClient()` returns OpenAI's `ChatClient` type. The `AsIChatClient()` extension method (from `Microsoft.Extensions.AI.OpenAI`) converts it to the `IChatClient` interface required by Agent Framework
110-
- **`CreateAIAgent`**: Creates an Agent Framework agent from an `IChatClient`
110+
- **`AsAIAgent`**: Creates an Agent Framework agent from an `IChatClient`
111111
- **ASP.NET Core Integration**: Uses ASP.NET Core's native async support for streaming responses
112112
- **Instructions**: The agent is created with default instructions, which can be overridden by client messages
113113
- **Configuration**: `AzureOpenAIClient` with `DefaultAzureCredential` provides secure authentication
@@ -149,7 +149,7 @@ dotnet add package Microsoft.Agents.AI --prerelease
149149
```
150150

151151
> [!NOTE]
152-
> The `Microsoft.Agents.AI` package provides the `CreateAIAgent()` extension method.
152+
> The `Microsoft.Agents.AI` package provides the `AsAIAgent()` extension method.
153153
154154
### Client Code
155155

@@ -174,11 +174,11 @@ using HttpClient httpClient = new()
174174

175175
AGUIChatClient chatClient = new(httpClient, serverUrl);
176176

177-
AIAgent agent = chatClient.CreateAIAgent(
177+
AIAgent agent = chatClient.AsAIAgent(
178178
name: "agui-client",
179179
description: "AG-UI Client Agent");
180180

181-
AgentThread thread = agent.GetNewThread();
181+
AgentThread thread = await agent.GetNewThreadAsync();
182182
List<ChatMessage> messages =
183183
[
184184
new(ChatRole.System, "You are a helpful assistant.")
@@ -256,7 +256,7 @@ catch (Exception ex)
256256

257257
- **Server-Sent Events (SSE)**: The protocol uses SSE for streaming responses
258258
- **AGUIChatClient**: Client class that connects to AG-UI servers and implements `IChatClient`
259-
- **CreateAIAgent**: Extension method on `AGUIChatClient` to create an agent from the client
259+
- **AsAIAgent**: Extension method on `AGUIChatClient` to create an agent from the client
260260
- **RunStreamingAsync**: Streams responses as `AgentResponseUpdate` objects
261261
- **AsChatResponseUpdate**: Extension method to access chat-specific properties like `ConversationId` and `ResponseId`
262262
- **Thread Management**: The `AgentThread` maintains conversation context across requests

agent-framework/integrations/ag-ui/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ To get started with AG-UI integration:
251251

252252
- [Agent Framework Documentation](../../overview/agent-framework-overview.md)
253253
- [AG-UI Protocol Documentation](https://docs.ag-ui.com/introduction)
254-
- [AG-UI Dojo App](https://github.com/ag-oss/ag-ui/tree/main/apps/dojo) - Example application demonstrating Agent Framework integration
254+
- [AG-UI Dojo App](https://dojo.ag-ui.com/) - Example application demonstrating Agent Framework integration
255255
- [Agent Framework GitHub Repository](https://github.com/microsoft/agent-framework)
256256

257257
::: zone-end

agent-framework/integrations/ag-ui/state-management.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ AIAgent CreateRecipeAgent(JsonSerializerOptions jsonSerializerOptions)
255255
var chatClient = azureClient.GetChatClient(deploymentName);
256256

257257
// Create base agent
258-
AIAgent baseAgent = chatClient.AsIChatClient().CreateAIAgent(
258+
AIAgent baseAgent = chatClient.AsIChatClient().AsAIAgent(
259259
name: "RecipeAgent",
260260
instructions: """
261261
You are a helpful recipe assistant. When users ask you to create or suggest a recipe,

agent-framework/integrations/ag-ui/testing-with-dojo.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ ms.service: agent-framework
1111

1212
# Testing with AG-UI Dojo
1313

14-
The [AG-UI Dojo application](https://github.com/ag-oss/ag-ui/tree/main/apps/dojo) provides an interactive environment to test and explore Microsoft Agent Framework agents that implement the AG-UI protocol. Dojo offers a visual interface to connect to your agents and interact with all 7 AG-UI features.
14+
The [AG-UI Dojo application](https://dojo.ag-ui.com/) provides an interactive environment to test and explore Microsoft Agent Framework agents that implement the AG-UI protocol. Dojo offers a visual interface to connect to your agents and interact with all 7 AG-UI features.
1515

1616
:::zone pivot="programming-language-python"
1717

@@ -226,18 +226,18 @@ If you see authentication errors:
226226

227227
## Next Steps
228228

229-
- Explore the [example agents](https://github.com/ag-oss/ag-ui/tree/main/integrations/microsoft-agent-framework/python/examples/agents) to see implementation patterns
229+
- Explore the [example agents](https://github.com/ag-ui-protocol/ag-ui/tree/main/integrations/microsoft-agent-framework/python/examples/agents) to see implementation patterns
230230
- Learn about [Backend Tool Rendering](backend-tool-rendering.md) to customize tool UIs
231231
<!-- - Implement [Human-in-the-Loop](human-in-the-loop.md) workflows for approval flows -->
232232
<!-- - Add [State Management](state-management.md) for complex interactive experiences -->
233233

234234
## Additional Resources
235235

236236
- [AG-UI Documentation](https://docs.ag-ui.com/introduction)
237-
- [AG-UI GitHub Repository](https://github.com/ag-oss/ag-ui)
238-
- [Dojo Application](https://github.com/ag-oss/ag-ui/tree/main/apps/dojo)
237+
- [AG-UI GitHub Repository](https://github.com/ag-ui-protocol/ag-ui)
238+
- [Dojo Application](https://dojo.ag-ui.com/)
239239

240-
- [Microsoft Agent Framework Integration Examples](https://github.com/ag-oss/ag-ui/tree/main/integrations/microsoft-agent-framework)
240+
- [Microsoft Agent Framework Integration Examples](https://github.com/ag-ui-protocol/ag-ui/tree/main/integrations/microsoft-agent-framework)
241241

242242
:::zone-end
243243

agent-framework/migration-guide/from-autogen/index.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ async def example():
234234
)
235235

236236
# Factory method (more convenient)
237-
agent = client.create_agent(
237+
agent = client.as_agent(
238238
name="assistant",
239239
instructions="You are a helpful assistant.",
240240
tools=[get_weather],
@@ -489,7 +489,7 @@ agent = ChatAgent(
489489
For detailed examples, see:
490490

491491
- [Azure AI with Code Interpreter](https://github.com/microsoft/agent-framework/blob/main/python/samples/getting_started/agents/azure_ai/azure_ai_with_code_interpreter.py) - Code execution tool
492-
- [Azure AI with Multiple Tools](https://github.com/microsoft/agent-framework/blob/main/python/samples/getting_started/agents/azure_ai/azure_ai_with_multiple_tools.py) - Multiple hosted tools
492+
- [Azure AI with Multiple Tools](https://github.com/microsoft/agent-framework/blob/main/python/samples/getting_started/agents/azure_ai_agent/azure_ai_with_multiple_tools.py) - Multiple hosted tools
493493
- [OpenAI with Web Search](https://github.com/microsoft/agent-framework/blob/main/python/samples/getting_started/agents/openai/openai_chat_client_with_web_search.py) - Web search integration
494494

495495
Requirements and caveats:
@@ -1183,7 +1183,7 @@ async def concurrent_example():
11831183
For concurrent execution examples, see:
11841184

11851185
- [Concurrent Agents](https://github.com/microsoft/agent-framework/blob/main/python/samples/getting_started/workflows/orchestration/concurrent_agents.py) - Parallel agent execution
1186-
- [Concurrent Custom Executors](https://github.com/microsoft/agent-framework/blob/main/python/samples/getting_started/workflows/orchestration/concurrent_custom_executors.py) - Custom parallel patterns
1186+
- [Concurrent Custom Executors](https://github.com/microsoft/agent-framework/blob/main/python/samples/getting_started/workflows/orchestration/concurrent_custom_agent_executors.py) - Custom parallel patterns
11871187
- [Concurrent with Custom Aggregator](https://github.com/microsoft/agent-framework/blob/main/python/samples/getting_started/workflows/orchestration/concurrent_custom_aggregator.py) - Result aggregation patterns
11881188

11891189
#### MagenticOneGroupChat Pattern
@@ -1703,7 +1703,7 @@ async def observability_example():
17031703
For detailed observability examples, see:
17041704

17051705
- [Zero-code Setup](https://github.com/microsoft/agent-framework/blob/main/python/samples/getting_started/observability/advanced_zero_code.py) - Environment variable configuration
1706-
- [Manual Setup](https://github.com/microsoft/agent-framework/blob/main/python/samples/getting_started/observability/setup_observability_with_parameters.py) - Programmatic configuration
1706+
- [Manual Setup](https://github.com/microsoft/agent-framework/blob/main/python/samples/getting_started/observability/configure_otel_providers_with_parameters.py) - Programmatic configuration
17071707
- [Agent Observability](https://github.com/microsoft/agent-framework/blob/main/python/samples/getting_started/observability/agent_observability.py) - Single agent telemetry
17081708
- [Workflow Observability](https://github.com/microsoft/agent-framework/blob/main/python/samples/getting_started/observability/workflow_observability.py) - Multi-agent workflow tracing
17091709

agent-framework/migration-guide/from-semantic-kernel/index.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ AzureAIAgent agent = new(definition, azureAgentClient);
7373
Agent creation in Agent Framework is made simpler with extensions provided by all main providers.
7474

7575
```csharp
76-
AIAgent openAIAgent = chatClient.CreateAIAgent(instructions: ParrotInstructions);
76+
AIAgent openAIAgent = chatClient.AsAIAgent(instructions: ParrotInstructions);
7777
AIAgent azureFoundryAgent = await persistentAgentsClient.CreateAIAgentAsync(instructions: ParrotInstructions);
7878
AIAgent openAIAssistantAgent = await assistantClient.CreateAIAgentAsync(instructions: ParrotInstructions);
7979
```
@@ -103,7 +103,7 @@ The agent is responsible for creating the thread.
103103

104104
```csharp
105105
// New.
106-
AgentThread thread = agent.GetNewThread();
106+
AgentThread thread = await agent.GetNewThreadAsync();
107107
```
108108

109109
## 4. Hosted Agent Thread Cleanup
@@ -160,7 +160,7 @@ ChatCompletionAgent agent = new() { Kernel = kernel, ... };
160160
In Agent Framework, in a single call you can register tools directly in the agent creation process.
161161

162162
```csharp
163-
AIAgent agent = chatClient.CreateAIAgent(tools: [AIFunctionFactory.Create(GetWeather)]);
163+
AIAgent agent = chatClient.AsAIAgent(tools: [AIFunctionFactory.Create(GetWeather)]);
164164
```
165165

166166
## 6. Agent Non-Streaming Invocation
@@ -281,7 +281,7 @@ serviceContainer.AddKeyedSingleton<SemanticKernel.Agents.Agent>(
281281
Agent Framework provides the `AIAgent` type as the base abstraction class.
282282

283283
```csharp
284-
services.AddKeyedSingleton<AIAgent>(() => client.CreateAIAgent(...));
284+
services.AddKeyedSingleton<AIAgent>(() => client.AsAIAgent(...));
285285
```
286286

287287
## 11. Agent Type Consolidation
@@ -381,7 +381,7 @@ Or, with the convenience methods provided by chat clients:
381381
```python
382382
from agent_framework.azure import AzureOpenAIChatClient
383383
from azure.identity import AzureCliCredential
384-
agent = AzureOpenAIChatClient(credential=AzureCliCredential()).create_agent(instructions="You are a helpful assistant")
384+
agent = AzureOpenAIChatClient(credential=AzureCliCredential()).as_agent(instructions="You are a helpful assistant")
385385
```
386386

387387
The direct method exposes all possible parameters you can set for your agent. While the convenience method has a subset, you can still pass in the same set of parameters, because it calls the direct method internally.
@@ -467,7 +467,7 @@ def get_weather(location: str) -> str:
467467
"""Get the weather for a given location."""
468468
return f"The weather in {location} is sunny."
469469

470-
agent = chat_client.create_agent(tools=get_weather)
470+
agent = chat_client.as_agent(tools=get_weather)
471471
```
472472

473473
> [!NOTE]
@@ -516,7 +516,7 @@ class Plugin:
516516
return f"The weather in {location} is sunny with a high of 25°C and a low of 15°C."
517517

518518
plugin = Plugin("Initial state")
519-
agent = chat_client.create_agent(tools=[plugin.get_weather, plugin.get_weather_details])
519+
agent = chat_client.as_agent(tools=[plugin.get_weather, plugin.get_weather_details])
520520

521521
... # use the agent
522522

@@ -575,7 +575,7 @@ kernel_function = KernelFunctionFromPrompt(
575575
agent_tool = kernel_function.as_agent_framework_tool(kernel=kernel)
576576

577577
# Use the tool with an Agent Framework agent
578-
agent = OpenAIResponsesClient(model_id="gpt-4o").create_agent(tools=agent_tool)
578+
agent = OpenAIResponsesClient(model_id="gpt-4o").as_agent(tools=agent_tool)
579579
response = await agent.run("What kind of day is it?")
580580
print(response.text)
581581
```
@@ -595,7 +595,7 @@ def get_weather(self, location: str) -> str:
595595
agent_tool = get_weather.as_agent_framework_tool()
596596

597597
# Use the tool with an Agent Framework agent
598-
agent = OpenAIResponsesClient(model_id="gpt-4o").create_agent(tools=agent_tool)
598+
agent = OpenAIResponsesClient(model_id="gpt-4o").as_agent(tools=agent_tool)
599599
response = await agent.run("What's the weather in Seattle?")
600600
print(response.text)
601601
```
@@ -663,7 +663,7 @@ async with collection:
663663
search_tool = search_function.as_agent_framework_tool()
664664

665665
# Use the tool with an Agent Framework agent
666-
agent = OpenAIResponsesClient(model_id="gpt-4o").create_agent(
666+
agent = OpenAIResponsesClient(model_id="gpt-4o").as_agent(
667667
instructions="You are a travel agent that helps people find hotels.",
668668
tools=search_tool
669669
)
@@ -779,7 +779,7 @@ from agent_framework.openai import OpenAIChatClient
779779
client = OpenAIChatClient()
780780

781781
# Set default options at agent creation
782-
agent = client.create_agent(
782+
agent = client.as_agent(
783783
instructions="You are a helpful assistant.",
784784
default_options={
785785
"max_tokens": 1000,

agent-framework/support/upgrade/typed-options-guide-python.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ response = await client.get_response(
5454
)
5555
```
5656

57-
> **Note:** For **Agents**, the `instructions` and `tools` parameters remain available as direct keyword arguments on `ChatAgent.__init__()` and `client.create_agent()`. For `agent.run()`, only `tools` is available as a keyword argument:
57+
> **Note:** For **Agents**, the `instructions` and `tools` parameters remain available as direct keyword arguments on `ChatAgent.__init__()` and `client.as_agent()`. For `agent.run()`, only `tools` is available as a keyword argument:
5858
>
5959
> ```python
6060
> # Agent creation accepts both tools and instructions as keyword arguments

agent-framework/tutorials/agents/agent-as-function-tool.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ AIAgent weatherAgent = new AzureOpenAIClient(
4848
new Uri("https://<myresource>.openai.azure.com"),
4949
new AzureCliCredential())
5050
.GetChatClient("gpt-4o-mini")
51-
.CreateAIAgent(
51+
.AsAIAgent(
5252
instructions: "You answer questions about the weather.",
5353
name: "WeatherAgent",
5454
description: "An agent that answers questions about the weather.",
@@ -62,7 +62,7 @@ AIAgent agent = new AzureOpenAIClient(
6262
new Uri("https://<myresource>.openai.azure.com"),
6363
new AzureCliCredential())
6464
.GetChatClient("gpt-4o-mini")
65-
.CreateAIAgent(instructions: "You are a helpful assistant who responds in French.", tools: [weatherAgent.AsAIFunction()]);
65+
.AsAIAgent(instructions: "You are a helpful assistant who responds in French.", tools: [weatherAgent.AsAIFunction()]);
6666
```
6767

6868
Invoke the main agent as normal. It can now call the weather agent as a tool, and should respond in French.
@@ -103,7 +103,7 @@ Create a `ChatAgent` that uses the function tool.
103103
from agent_framework.azure import AzureOpenAIChatClient
104104
from azure.identity import AzureCliCredential
105105

106-
weather_agent = AzureOpenAIChatClient(credential=AzureCliCredential()).create_agent(
106+
weather_agent = AzureOpenAIChatClient(credential=AzureCliCredential()).as_agent(
107107
name="WeatherAgent",
108108
description="An agent that answers questions about the weather.",
109109
instructions="You answer questions about the weather.",
@@ -114,7 +114,7 @@ weather_agent = AzureOpenAIChatClient(credential=AzureCliCredential()).create_ag
114114
Now, create a main agent and provide the `weather_agent` as a function tool by calling `.as_tool()` to convert `weather_agent` to a function tool.
115115

116116
```python
117-
main_agent = AzureOpenAIChatClient(credential=AzureCliCredential()).create_agent(
117+
main_agent = AzureOpenAIChatClient(credential=AzureCliCredential()).as_agent(
118118
instructions="You are a helpful assistant who responds in French.",
119119
tools=weather_agent.as_tool()
120120
)
@@ -138,7 +138,7 @@ weather_tool = weather_agent.as_tool(
138138
arg_description="The weather query or location"
139139
)
140140

141-
main_agent = AzureOpenAIChatClient(credential=AzureCliCredential()).create_agent(
141+
main_agent = AzureOpenAIChatClient(credential=AzureCliCredential()).as_agent(
142142
instructions="You are a helpful assistant who responds in French.",
143143
tools=weather_tool
144144
)

0 commit comments

Comments
 (0)