Skip to content

Commit 3213c72

Browse files
authored
Merge pull request #709 from dmytrostruk/more-doc-updates
More doc updates
2 parents 56e0d11 + 0d2085d commit 3213c72

9 files changed

Lines changed: 215 additions & 72 deletions

File tree

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
title: Exposing an agent as an MCP tool
33
description: Learn how to expose an agent as a tool over the MCP protocol
4-
zone_pivot_groups: programming-languages
54
author: westey-m
65
ms.topic: tutorial
76
ms.author: westey
@@ -11,8 +10,6 @@ ms.service: semantic-kernel
1110

1211
# Exposing an agent as an MCP tool
1312

14-
::: zone pivot="programming-language-csharp"
15-
1613
This tutorial shows you how to expose an agent as a tool over the Model Context Protocol (MCP), so it can be used by other systems that support MCP tools.
1714

1815
## Prerequisites
@@ -81,13 +78,6 @@ await builder.Build().RunAsync();
8178

8279
This will start an MCP server that exposes the agent as a tool over the MCP protocol.
8380

84-
::: zone-end
85-
::: zone pivot="programming-language-python"
86-
87-
Tutorial coming soon.
88-
89-
::: zone-end
90-
9181
## Next steps
9282

9383
> [!div class="nextstepaction"]

agent-framework/tutorials/agents/function-tools-approvals.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
title: Using function tools with human in the loop approvals
33
description: Learn how to use function tools with human in the loop approvals
4-
zone_pivot_groups: programming-languages
54
author: westey-m
65
ms.topic: tutorial
76
ms.author: westey
@@ -11,7 +10,6 @@ ms.service: semantic-kernel
1110

1211
# Using function tools with human in the loop approvals
1312

14-
::: zone pivot="programming-language-csharp"
1513

1614
This tutorial step shows you how to use function tools that require human approval with an agent, where the agent is built on the Azure OpenAI Chat Completion service.
1715

@@ -97,13 +95,6 @@ Console.WriteLine(await agent.RunAsync(approvalMessage, thread));
9795

9896
Whenever you are using function tools with human in the loop approvals, remember to check for `FunctionApprovalRequestContent` instances in the response, after each agent run, until all function calls have been approved or rejected.
9997

100-
::: zone-end
101-
::: zone pivot="programming-language-python"
102-
103-
Tutorial coming soon.
104-
105-
::: zone-end
106-
10798
## Next steps
10899

109100
> [!div class="nextstepaction"]

agent-framework/tutorials/workflows/visualization.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
title: Workflow Visualization
33
description: Learn how to visualize workflows using the Agent Framework.
4-
zone_pivot_groups: programming-languages
54
author: TaoChenOSU
65
ms.topic: tutorial
76
ms.author: taochen
@@ -11,13 +10,6 @@ ms.service: semantic-kernel
1110

1211
# Visualizing Workflows
1312

14-
::: zone pivot="programming-language-csharp"
15-
16-
Tutorial coming soon.
17-
18-
::: zone-end
19-
20-
::: zone pivot="programming-language-python"
2113

2214
## Overview
2315

@@ -312,5 +304,3 @@ if os.getenv("CI"):
312304
### Running the Example
313305

314306
For the complete working implementation with visualization, see the [Concurrent with Visualization sample](https://github.com/microsoft/agent-framework/blob/main/python/samples/getting_started/workflows/visualization/concurrent_with_visualization.py).
315-
316-
::: zone-end

agent-framework/user-guide/model-context-protocol/using-mcp-tools.md

Lines changed: 116 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,122 @@ The full source code and instructions to run this sample is available [here](htt
129129
::: zone-end
130130
::: zone pivot="programming-language-python"
131131

132-
Coming soon.
132+
The Python Agent Framework provides comprehensive support for integrating with Model Context Protocol (MCP) servers through multiple connection types. This allows your agents to access external tools and services seamlessly.
133+
134+
## MCP Tool Types
135+
136+
The Agent Framework supports three types of MCP connections:
137+
138+
### MCPStdioTool - Local MCP Servers
139+
140+
Use `MCPStdioTool` to connect to MCP servers that run as local processes using standard input/output:
141+
142+
```python
143+
import asyncio
144+
from agent_framework import ChatAgent, MCPStdioTool
145+
from agent_framework.openai import OpenAIChatClient
146+
147+
async def local_mcp_example():
148+
"""Example using a local MCP server via stdio."""
149+
async with (
150+
MCPStdioTool(
151+
name="calculator",
152+
command="uvx",
153+
args=["mcp-server-calculator"]
154+
) as mcp_server,
155+
ChatAgent(
156+
chat_client=OpenAIChatClient(),
157+
name="MathAgent",
158+
instructions="You are a helpful math assistant that can solve calculations.",
159+
) as agent,
160+
):
161+
result = await agent.run(
162+
"What is 15 * 23 + 45?",
163+
tools=mcp_server
164+
)
165+
print(result)
166+
167+
if __name__ == "__main__":
168+
asyncio.run(local_mcp_example())
169+
```
170+
171+
### MCPStreamableHTTPTool - HTTP/SSE MCP Servers
172+
173+
Use `MCPStreamableHTTPTool` to connect to MCP servers over HTTP with Server-Sent Events:
174+
175+
```python
176+
import asyncio
177+
from agent_framework import ChatAgent, MCPStreamableHTTPTool
178+
from agent_framework.azure import AzureAIAgentClient
179+
from azure.identity.aio import AzureCliCredential
180+
181+
async def http_mcp_example():
182+
"""Example using an HTTP-based MCP server."""
183+
async with (
184+
AzureCliCredential() as credential,
185+
MCPStreamableHTTPTool(
186+
name="Microsoft Learn MCP",
187+
url="https://learn.microsoft.com/api/mcp",
188+
headers={"Authorization": "Bearer your-token"},
189+
) as mcp_server,
190+
ChatAgent(
191+
chat_client=AzureAIAgentClient(async_credential=credential),
192+
name="DocsAgent",
193+
instructions="You help with Microsoft documentation questions.",
194+
) as agent,
195+
):
196+
result = await agent.run(
197+
"How to create an Azure storage account using az cli?",
198+
tools=mcp_server
199+
)
200+
print(result)
201+
202+
if __name__ == "__main__":
203+
asyncio.run(http_mcp_example())
204+
```
205+
206+
### MCPWebsocketTool - WebSocket MCP Servers
207+
208+
Use `MCPWebsocketTool` to connect to MCP servers over WebSocket connections:
209+
210+
```python
211+
import asyncio
212+
from agent_framework import ChatAgent, MCPWebsocketTool
213+
from agent_framework.openai import OpenAIChatClient
214+
215+
async def websocket_mcp_example():
216+
"""Example using a WebSocket-based MCP server."""
217+
async with (
218+
MCPWebsocketTool(
219+
name="realtime-data",
220+
url="wss://api.example.com/mcp",
221+
) as mcp_server,
222+
ChatAgent(
223+
chat_client=OpenAIChatClient(),
224+
name="DataAgent",
225+
instructions="You provide real-time data insights.",
226+
) as agent,
227+
):
228+
result = await agent.run(
229+
"What is the current market status?",
230+
tools=mcp_server
231+
)
232+
print(result)
233+
234+
if __name__ == "__main__":
235+
asyncio.run(websocket_mcp_example())
236+
```
237+
238+
## Popular MCP Servers
239+
240+
Common MCP servers you can use with Python Agent Framework:
241+
242+
- **Calculator**: `uvx mcp-server-calculator` - Mathematical computations
243+
- **Filesystem**: `uvx mcp-server-filesystem` - File system operations
244+
- **GitHub**: `npx @modelcontextprotocol/server-github` - GitHub repository access
245+
- **SQLite**: `uvx mcp-server-sqlite` - Database operations
246+
247+
Each server provides different tools and capabilities that extend your agent's functionality while maintaining the security and standardization benefits of the Model Context Protocol.
133248

134249
::: zone-end
135250

agent-framework/user-guide/model-context-protocol/using-mcp-with-foundry-agents.md

Lines changed: 99 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,107 @@ await persistentAgentsClient.Administration.DeleteAgentAsync(agent.Id);
144144
::: zone-end
145145
::: zone pivot="programming-language-python"
146146

147-
Coming soon.
147+
## Python Azure AI Foundry MCP Integration
148148

149-
::: zone-end
149+
Azure AI Foundry provides seamless integration with Model Context Protocol (MCP) servers through the Python Agent Framework. The service manages the MCP server hosting and execution, eliminating infrastructure management while providing secure, controlled access to external tools.
150+
151+
### Environment Setup
152+
153+
Configure your Azure AI Foundry project credentials through environment variables:
154+
155+
```python
156+
import os
157+
from azure.identity.aio import AzureCliCredential
158+
from agent_framework.azure import AzureAIAgentClient
159+
160+
# Required environment variables
161+
os.environ["AZURE_AI_PROJECT_ENDPOINT"] = "https://<your-project>.services.ai.azure.com/api/projects/<project-id>"
162+
os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"] = "gpt-4o-mini" # Optional, defaults to this
163+
```
150164

151-
To learn more refer to the [Azure AI Foundry Model Context Protocol documentation](/azure/ai-foundry/agents/how-to/tools/model-context-protocol).
165+
### Basic MCP Integration
166+
167+
Create an Azure AI Foundry agent with hosted MCP tools:
168+
169+
```python
170+
import asyncio
171+
from agent_framework import HostedMCPTool
172+
from agent_framework.azure import AzureAIAgentClient
173+
from azure.identity.aio import AzureCliCredential
174+
175+
async def basic_foundry_mcp_example():
176+
"""Basic example of Azure AI Foundry agent with hosted MCP tools."""
177+
async with (
178+
AzureCliCredential() as credential,
179+
AzureAIAgentClient(async_credential=credential) as chat_client,
180+
):
181+
# Enable Azure AI observability (optional but recommended)
182+
await chat_client.setup_azure_ai_observability()
183+
184+
# Create agent with hosted MCP tool
185+
agent = chat_client.create_agent(
186+
name="MicrosoftLearnAgent",
187+
instructions="You answer questions by searching Microsoft Learn content only.",
188+
tools=HostedMCPTool(
189+
name="Microsoft Learn MCP",
190+
url="https://learn.microsoft.com/api/mcp",
191+
),
192+
)
193+
194+
# Simple query without approval workflow
195+
result = await agent.run(
196+
"Please summarize the Azure AI Agent documentation related to MCP tool calling?"
197+
)
198+
print(result)
199+
200+
if __name__ == "__main__":
201+
asyncio.run(basic_foundry_mcp_example())
202+
```
203+
204+
### Multi-Tool MCP Configuration
205+
206+
Use multiple hosted MCP tools with a single agent:
207+
208+
```python
209+
async def multi_tool_mcp_example():
210+
"""Example using multiple hosted MCP tools."""
211+
async with (
212+
AzureCliCredential() as credential,
213+
AzureAIAgentClient(async_credential=credential) as chat_client,
214+
):
215+
await chat_client.setup_azure_ai_observability()
216+
217+
# Create agent with multiple MCP tools
218+
agent = chat_client.create_agent(
219+
name="MultiToolAgent",
220+
instructions="You can search documentation and access GitHub repositories.",
221+
tools=[
222+
HostedMCPTool(
223+
name="Microsoft Learn MCP",
224+
url="https://learn.microsoft.com/api/mcp",
225+
approval_mode="never_require", # Auto-approve documentation searches
226+
),
227+
HostedMCPTool(
228+
name="GitHub MCP",
229+
url="https://api.github.com/mcp",
230+
approval_mode="always_require", # Require approval for GitHub operations
231+
headers={"Authorization": "Bearer github-token"},
232+
),
233+
],
234+
)
235+
236+
result = await agent.run(
237+
"Find Azure documentation and also check the latest commits in microsoft/semantic-kernel"
238+
)
239+
print(result)
240+
241+
if __name__ == "__main__":
242+
asyncio.run(multi_tool_mcp_example())
243+
```
244+
245+
The Python Agent Framework provides seamless integration with Azure AI Foundry's hosted MCP capabilities, enabling secure and scalable access to external tools while maintaining the flexibility and control needed for production applications.
246+
247+
::: zone-end
152248

153249
## Next steps
154250

agent-framework/user-guide/workflows/checkpoints.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -221,12 +221,6 @@ protected override async ValueTask OnCheckpointRestoredAsync(IWorkflowContext co
221221

222222
::: zone-end
223223

224-
::: zone pivot="programming-language-python"
225-
226-
Coming soon...
227-
228-
::: zone-end
229-
230224
## Next Steps
231225

232226
- [Learn how to use agents in workflows](./using-agents.md) to build intelligent workflows.

agent-framework/user-guide/workflows/observability.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
title: Microsoft Agent Framework Workflows - Observability
33
description: In-depth look at Observability in Microsoft Agent Framework Workflows.
4-
zone_pivot_groups: programming-languages
54
author: TaoChenOSU
65
ms.topic: tutorial
76
ms.author: taochen
@@ -15,14 +14,6 @@ Observability provides insights into the internal state and behavior of workflow
1514

1615
Aside from the standard [GenAI telemetry](https://opentelemetry.io/docs/specs/semconv/gen-ai/), Agent Framework Workflows emits additional spans, logs, and metrics to provide deeper insights into workflow execution. These observability features help developers understand the flow of messages, the performance of executors, and any errors that may occur.
1716

18-
::: zone pivot="programming-language-csharp"
19-
20-
Coming soon...
21-
22-
::: zone-end
23-
24-
::: zone pivot="programming-language-python"
25-
2617
## Enable Observability
2718

2819
Observability is enabled framework-wide by setting the `ENABLE_OTEL=true` environment variable or calling `setup_observability()` at the beginning of your application.
@@ -58,8 +49,6 @@ For example:
5849

5950
![Span Relationships](./resources/images/workflow-trace.png)
6051

61-
::: zone-end
62-
6352
## Next Steps
6453

6554
- [Learn how to use agents in workflows](./using-agents.md) to build intelligent workflows.

0 commit comments

Comments
 (0)