Skip to content

Commit 8304c02

Browse files
fix quick start for python (#786)
* fix quick start for python * improved language * fix typo * fixed other pip installs * updated author and ms.topic * fix reference * different link
1 parent 4e355b2 commit 8304c02

26 files changed

Lines changed: 123 additions & 118 deletions

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -387,13 +387,13 @@ The AG-UI server hosts your AI agent and exposes it via HTTP endpoints using Fas
387387
Install the necessary packages for the server:
388388

389389
```bash
390-
pip install agent-framework-ag-ui
390+
pip install agent-framework-ag-ui --pre
391391
```
392392

393393
Or using uv:
394394

395395
```bash
396-
uv pip install agent-framework-ag-ui
396+
uv pip install agent-framework-ag-ui --prerelease=allow
397397
```
398398

399399
This will automatically install `agent-framework-core`, `fastapi`, and `uvicorn` as dependencies.
@@ -425,7 +425,7 @@ if not deployment_name:
425425
chat_client = AzureOpenAIChatClient(
426426
credential=AzureCliCredential(),
427427
endpoint=endpoint,
428-
deployment_name=deployment_name,
428+
deployment_name=deployment_name,
429429
)
430430

431431
# Create the AI agent
@@ -488,7 +488,7 @@ The AG-UI package is already installed, which includes the `AGUIChatClient`:
488488

489489
```bash
490490
# Already installed with agent-framework-ag-ui
491-
pip install agent-framework-ag-ui
491+
pip install agent-framework-ag-ui --pre
492492
```
493493

494494
### Client Code
@@ -513,7 +513,7 @@ async def main():
513513

514514
# Create AG-UI chat client
515515
chat_client = AGUIChatClient(server_url=server_url)
516-
516+
517517
# Create agent with the chat client
518518
agent = ChatAgent(
519519
name="ClientAgent",

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ The Agent Framework AG-UI integration supports all 7 AG-UI protocol features:
4848

4949
## Build agent UIs with CopilotKit
5050

51-
[CopilotKit](https://copilotkit.ai/) provides rich UI components for building agent user interfaces based on the standard AG-UI protocol. CopilotKit supports streaming chat interfaces, frontend & backend tool calling, human-in-the-loop interactions, generative UI, shared state, and much more. You can see a examples of the various agent UI scenarios that CopilotKit supports in the [AG-UI Dojo](https://dojo.ag-ui.com/microsoft-agent-framework-dotnet) sample application.
51+
[CopilotKit](https://copilotkit.ai/) provides rich UI components for building agent user interfaces based on the standard AG-UI protocol. CopilotKit supports streaming chat interfaces, frontend & backend tool calling, human-in-the-loop interactions, generative UI, shared state, and much more. You can see a examples of the various agent UI scenarios that CopilotKit supports in the [AG-UI Dojo](https://dojo.ag-ui.com/microsoft-agent-framework-dotnet) sample application.
5252

5353
CopilotKit helps you focus on your agent’s capabilities while delivering a polished user experience without reinventing the wheel.
5454
To learn more about getting started with Microsoft Agent Framework and CopilotKit, see the [Microsoft Agent Framework integration for CopilotKit](https://docs.copilotkit.ai/microsoft-agent-framework) documentation.
@@ -233,7 +233,7 @@ Understanding how Agent Framework concepts map to AG-UI helps you build effectiv
233233
Install the AG-UI integration package:
234234

235235
```bash
236-
pip install agent-framework-ag-ui
236+
pip install agent-framework-ag-ui --pre
237237
```
238238

239239
This installs both the core agent framework and AG-UI integration components.

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ agent = ChatAgent(
488488
chat_client=AzureOpenAIChatClient(
489489
credential=AzureCliCredential(),
490490
endpoint=endpoint,
491-
deployment_name=deployment_name,
491+
deployment_name=deployment_name,
492492
),
493493
tools=[update_recipe],
494494
)
@@ -614,7 +614,7 @@ async def main():
614614

615615
# Create AG-UI chat client
616616
chat_client = AGUIChatClient(server_url=server_url)
617-
617+
618618
# Wrap with ChatAgent for convenient API
619619
agent = ChatAgent(
620620
name="ClientAgent",
@@ -624,7 +624,7 @@ async def main():
624624

625625
# Get a thread for conversation continuity
626626
thread = agent.get_new_thread()
627-
627+
628628
# Track state locally
629629
state: dict[str, Any] = {}
630630

@@ -647,7 +647,7 @@ async def main():
647647
# Handle text content
648648
if update.text:
649649
print(update.text, end="", flush=True)
650-
650+
651651
# Handle state updates
652652
for content in update.contents:
653653
# STATE_SNAPSHOT events come as DataContent with application/json
@@ -656,7 +656,7 @@ async def main():
656656
state_data = json.loads(content.data.decode() if isinstance(content.data, bytes) else content.data)
657657
state = state_data
658658
print("\n[State Snapshot Received]")
659-
659+
660660
# STATE_DELTA events are handled similarly
661661
# Apply JSON Patch deltas to maintain state
662662
if hasattr(content, 'delta') and content.delta:
@@ -672,7 +672,7 @@ async def main():
672672

673673

674674
if __name__ == "__main__":
675-
# Install dependencies: pip install agent-framework-ag-ui jsonpatch
675+
# Install dependencies: pip install agent-framework-ag-ui jsonpatch --pre
676676
asyncio.run(main())
677677
```
678678

@@ -913,7 +913,7 @@ Always write the complete state, not just deltas:
913913
def update_recipe(recipe: Recipe) -> str:
914914
"""
915915
You MUST write the complete recipe with ALL fields.
916-
When modifying a recipe, include ALL existing ingredients and
916+
When modifying a recipe, include ALL existing ingredients and
917917
instructions plus your changes. NEVER delete existing data.
918918
"""
919919
return "Recipe updated."

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ from semantic_kernel.agents import ChatCompletionAgent
321321
### Agent Framework
322322

323323
Agent Framework package is installed as `agent-framework` and imported as `agent_framework`.
324-
Agent Framework is built up differently, it has a core package `agent-framework-core` that contains the core functionality, and then there are multiple packages that rely on that core package, such as `agent-framework-azure-ai`, `agent-framework-mem0`, `agent-framework-copilotstudio`, etc. When you run `pip install agent-framework` it will install the core package and *all* packages, so that you can get started with all the features quickly. When you are ready to reduce the number of packages because you know what you need, you can install only the packages you need, so for instance if you only plan to use Azure AI Foundry and Mem0 you can install only those two packages: `pip install agent-framework-azure-ai agent-framework-mem0`, `agent-framework-core` is a dependency to those two, so will automatically be installed.
324+
Agent Framework is built up differently, it has a core package `agent-framework-core` that contains the core functionality, and then there are multiple packages that rely on that core package, such as `agent-framework-azure-ai`, `agent-framework-mem0`, `agent-framework-copilotstudio`, etc. When you run `pip install agent-framework --pre` it will install the core package and *all* packages, so that you can get started with all the features quickly. When you are ready to reduce the number of packages because you know what you need, you can install only the packages you need, so for instance if you only plan to use Azure AI Foundry and Mem0 you can install only those two packages: `pip install agent-framework-azure-ai agent-framework-mem0 --pre`, `agent-framework-core` is a dependency to those two, so will automatically be installed.
325325

326326
Even though the packages are split up, the imports are all from `agent_framework`, or it's modules. So for instance to import the client for Azure AI Foundry you would do:
327327

agent-framework/overview/agent-framework-overview.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
22
title: Introduction to Microsoft Agent Framework
33
description: Learn about Microsoft Agent Framework
4-
author: ekzhu
4+
author: markwallace-microsoft
55
ms.topic: reference
6-
ms.author: ekzhu
6+
ms.author: markwallace
77
ms.date: 10/01/2025
88
ms.service: agent-framework
99
---
@@ -57,7 +57,7 @@ and the same is expected for Agent Framework. Microsoft Agent Framework welcomes
5757
Python:
5858

5959
```bash
60-
pip install agent-framework
60+
pip install agent-framework --pre
6161
```
6262

6363
.NET:

agent-framework/support/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Support for Agent Framework
33
description: Support for Agent Framework
44
author: TaoChenOSU
5-
ms.topic: conceptual
5+
ms.topic: article
66
ms.author: taochen
77
ms.date: 10/30/2025
88
ms.service: agent-framework
@@ -13,7 +13,7 @@ ms.service: agent-framework
1313

1414
| Your preference | What's available |
1515
|---|---|
16-
| Read the docs | [This learning site](/agent-framework/overview) is the home of the latest information for developers |
16+
| Read the docs | [This learning site](/agent-framework/) is the home of the latest information for developers |
1717
| Visit the repo | Our open-source [GitHub repository](https://github.com/microsoft/agent-framework) is available for perusal and suggestions |
1818
| Connect with the Agent Framework Team | Visit our [GitHub Discussions](https://github.com/microsoft/agent-framework/discussions) to get supported quickly with our [CoC](https://github.com/microsoft/agent-framework/blob/main/CODE_OF_CONDUCT.md) actively enforced |
19-
| Office Hours | We will be hosting regular office hours; the calendar invites and cadence are located here: [Community.MD](https://github.com/microsoft/agent-framework/blob/main/COMMUNITY.md) |
19+
| Office Hours | We will be hosting regular office hours; the calendar invites and cadence are located here: [Community.MD](https://github.com/microsoft/agent-framework/blob/main/COMMUNITY.md) |

agent-framework/tutorials/agents/enable-observability.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ For prerequisites, see the [Create and run a simple agent](./run-agent.md) step
143143
To use Agent Framework with Azure OpenAI, you need to install the following packages. Agent Framework automatically includes all necessary OpenTelemetry dependencies:
144144

145145
```bash
146-
pip install agent-framework
146+
pip install agent-framework --pre
147147
```
148148

149149
The following OpenTelemetry packages are included by default:

agent-framework/tutorials/agents/run-agent.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ Before you begin, ensure you have the following prerequisites:
186186
To use Microsoft Agent Framework with Azure OpenAI, you need to install the following Python packages:
187187

188188
```bash
189-
pip install agent-framework
189+
pip install agent-framework --pre
190190
```
191191

192192
## Create the agent

agent-framework/tutorials/plugins/use-purview-with-agent-framework-sdk.md

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Use Microsoft Purview SDK with Agent Framework
33
description: Learn how to integrate Microsoft Purview SDK for data security and governance in your Agent Framework project
44
zone_pivot_groups: programming-languages
55
author: reezaali149
6-
ms.topic: conceptual
6+
ms.topic: article
77
ms.author: v-reezaali
88
ms.date: 10/28/2025
99
ms.service: purview
@@ -27,7 +27,7 @@ Before you begin, ensure you have:
2727
- Microsoft 365 subscription with an E5 license and pay-as-you-go billing setup.
2828
- For testing, you can use a Microsoft 365 Developer Program tenant. For more information, see [Join the Microsoft 365 Developer Program](https://developer.microsoft.com/en-us/microsoft-365/dev-program).
2929
- Agent Framework SDK: To install the Agent Framework SDK:
30-
- Python: Run `pip install agent-framework`.
30+
- Python: Run `pip install agent-framework --pre`.
3131
- .NET: Install from NuGet.
3232

3333
## How to integrate Microsoft Purview into your agent
@@ -40,34 +40,34 @@ The following code sample demonstrates how to add the Microsoft Purview policy m
4040

4141
```csharp
4242

43-
using Azure.AI.OpenAI;
44-
using Azure.Core;
45-
using Azure.Identity;
46-
using Microsoft.Agents.AI;
47-
using Microsoft.Agents.AI.Purview;
48-
using Microsoft.Extensions.AI;
49-
using OpenAI;
43+
using Azure.AI.OpenAI;
44+
using Azure.Core;
45+
using Azure.Identity;
46+
using Microsoft.Agents.AI;
47+
using Microsoft.Agents.AI.Purview;
48+
using Microsoft.Extensions.AI;
49+
using OpenAI;
5050

51-
string endpoint = Environment.GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT") ?? throw new InvalidOperationException("AZURE_OPENAI_ENDPOINT is not set.");
52-
string deploymentName = Environment.GetEnvironmentVariable("AZURE_OPENAI_DEPLOYMENT_NAME") ?? "gpt-4o-mini";
53-
string purviewClientAppId = Environment.GetEnvironmentVariable("PURVIEW_CLIENT_APP_ID") ?? throw new InvalidOperationException("PURVIEW_CLIENT_APP_ID is not set.");
51+
string endpoint = Environment.GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT") ?? throw new InvalidOperationException("AZURE_OPENAI_ENDPOINT is not set.");
52+
string deploymentName = Environment.GetEnvironmentVariable("AZURE_OPENAI_DEPLOYMENT_NAME") ?? "gpt-4o-mini";
53+
string purviewClientAppId = Environment.GetEnvironmentVariable("PURVIEW_CLIENT_APP_ID") ?? throw new InvalidOperationException("PURVIEW_CLIENT_APP_ID is not set.");
5454

55-
TokenCredential browserCredential = new InteractiveBrowserCredential(
56-
new InteractiveBrowserCredentialOptions
57-
{
58-
ClientId = purviewClientAppId
59-
});
55+
TokenCredential browserCredential = new InteractiveBrowserCredential(
56+
new InteractiveBrowserCredentialOptions
57+
{
58+
ClientId = purviewClientAppId
59+
});
6060

6161
AIAgent agent = new AzureOpenAIClient(
62-
new Uri(endpoint),
63-
new AzureCliCredential())
64-
.GetChatClient(deploymentName)
65-
.CreateAIAgent("You are a secure assistant.")
66-
.AsBuilder()
67-
.WithPurview(browserCredential, new PurviewSettings("My Secure Agent"))
68-
.Build();
69-
70-
AgentRunResponse response = await agent.RunAsync("Summarize zero trust in one sentence.").ConfigureAwait(false);
62+
new Uri(endpoint),
63+
new AzureCliCredential())
64+
.GetChatClient(deploymentName)
65+
.CreateAIAgent("You are a secure assistant.")
66+
.AsBuilder()
67+
.WithPurview(browserCredential, new PurviewSettings("My Secure Agent"))
68+
.Build();
69+
70+
AgentRunResponse response = await agent.RunAsync("Summarize zero trust in one sentence.").ConfigureAwait(false);
7171
Console.WriteLine(response);
7272

7373
```
@@ -76,34 +76,34 @@ Console.WriteLine(response);
7676
::: zone pivot="programming-language-python"
7777

7878
```python
79-
import asyncio
80-
import os
81-
from agent_framework import ChatAgent, ChatMessage, Role
79+
import asyncio
80+
import os
81+
from agent_framework import ChatAgent, ChatMessage, Role
8282
from agent_framework.azure import AzureOpenAIChatClient
83-
from agent_framework.microsoft import PurviewPolicyMiddleware, PurviewSettings
84-
from azure.identity import AzureCliCredential, InteractiveBrowserCredential
85-
86-
# Set default environment variables if not already set
87-
os.environ.setdefault("AZURE_OPENAI_ENDPOINT", "<azureOpenAIEndpoint>")
88-
os.environ.setdefault("AZURE_OPENAI_CHAT_DEPLOYMENT_NAME", "<azureOpenAIChatDeploymentName>")
89-
90-
async def main():
91-
chat_client = AzureOpenAIChatClient(credential=AzureCliCredential())
92-
purview_middleware = PurviewPolicyMiddleware(
93-
credential=InteractiveBrowserCredential(
94-
client_id="<clientId>",
95-
),
83+
from agent_framework.microsoft import PurviewPolicyMiddleware, PurviewSettings
84+
from azure.identity import AzureCliCredential, InteractiveBrowserCredential
85+
86+
# Set default environment variables if not already set
87+
os.environ.setdefault("AZURE_OPENAI_ENDPOINT", "<azureOpenAIEndpoint>")
88+
os.environ.setdefault("AZURE_OPENAI_CHAT_DEPLOYMENT_NAME", "<azureOpenAIChatDeploymentName>")
89+
90+
async def main():
91+
chat_client = AzureOpenAIChatClient(credential=AzureCliCredential())
92+
purview_middleware = PurviewPolicyMiddleware(
93+
credential=InteractiveBrowserCredential(
94+
client_id="<clientId>",
95+
),
9696
settings=PurviewSettings(app_name="My Secure Agent")
97-
)
98-
agent = ChatAgent(
99-
chat_client=chat_client,
100-
instructions="You are a secure assistant.",
101-
middleware=[purview_middleware]
102-
)
103-
response = await agent.run(ChatMessage(role=Role.USER, text="Summarize zero trust in one sentence."))
104-
print(response)
105-
106-
if __name__ == "__main__":
97+
)
98+
agent = ChatAgent(
99+
chat_client=chat_client,
100+
instructions="You are a secure assistant.",
101+
middleware=[purview_middleware]
102+
)
103+
response = await agent.run(ChatMessage(role=Role.USER, text="Summarize zero trust in one sentence."))
104+
print(response)
105+
106+
if __name__ == "__main__":
107107
asyncio.run(main())
108108
```
109109

agent-framework/tutorials/quick-start.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,19 @@ Before you begin, ensure you have the following:
144144
- [Python 3.10 or later](https://www.python.org/downloads/)
145145
- An [Azure AI](/azure/ai-foundry/) project with a deployed model (for example, `gpt-4o-mini`)
146146
- [Azure CLI](/cli/azure/install-azure-cli) installed and authenticated (`az login`)
147+
- Install the Agent Framework Package:
148+
149+
```bash
150+
pip install -U agent-framework --pre
151+
```
147152

148153
> [!NOTE]
149-
> This demo uses Azure CLI credentials for authentication. Make sure you're logged in with `az login` and have access to the Azure AI project. For more information, see the [Azure CLI documentation](/cli/azure/authenticate-azure-cli-interactively).
154+
> Installing `agent-framework` will install `agent-framework-core` and all other official packages. If you want to install only the Azure AI package, you can run: `pip install agent-framework-azure-ai --pre`
155+
> All of the official packages, including `agent-framework-azure-ai` have a dependency on `agent-framework-core`, so in most cases, you wouldn't have to specify that.
156+
> The full list of official packages can be found in the [Agent Framework GitHub repository](https://github.com/microsoft/agent-framework/blob/main/python/pyproject.toml#L80).
157+
158+
> [!NOTE]
159+
> This sample uses Azure CLI credentials for authentication. Make sure you're logged in with `az login` and have access to the Azure AI project. For more information, see the [Azure CLI documentation](/cli/azure/authenticate-azure-cli-interactively).
150160
151161
## Running a Basic Agent Sample
152162

@@ -156,20 +166,17 @@ Make sure to set the following environment variables:
156166
- `AZURE_AI_PROJECT_ENDPOINT`: Your Azure AI project endpoint
157167
- `AZURE_AI_MODEL_DEPLOYMENT_NAME`: The name of your model deployment
158168

159-
160169
### Sample Code
161170

162171
```python
163172
import asyncio
164-
from agent_framework import ChatAgent
165-
from agent_framework.azure import AzureAIAgentClient
173+
from agent_framework.azure import AzureAIClient
166174
from azure.identity.aio import AzureCliCredential
167175

168176
async def main():
169177
async with (
170178
AzureCliCredential() as credential,
171-
ChatAgent(
172-
chat_client=AzureAIAgentClient(async_credential=credential),
179+
AzureAIClient(async_credential=credential).create_agent(
173180
instructions="You are good at telling jokes."
174181
) as agent,
175182
):
@@ -182,7 +189,7 @@ if __name__ == "__main__":
182189

183190
## More Examples
184191

185-
For more detailed examples and advanced scenarios, see the [Azure AI Agent Examples](https://github.com/microsoft/agent-framework/blob/main/python/samples/getting_started/agents/azure_ai/README.md).
192+
For more detailed examples and advanced scenarios, see the [Azure AI Examples](https://github.com/microsoft/agent-framework/blob/main/python/samples/getting_started/agents/azure_ai/README.md).
186193

187194

188195
::: zone-end

0 commit comments

Comments
 (0)