diff --git a/README.md b/README.md index b2d8aca8d2..3e335a2723 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Get Started with Microsoft Agent Framework +# Microsoft Agent Framework Highlights - Flexible Agent Framework: build, orchestrate, and deploy AI agents and multi-agent systems @@ -11,150 +11,21 @@ Highlights Below are the basics for each language implementation. For more details on python see [here](./python/README.md) and for .NET see [here](./dotnet/README.md). -## Python - Quick Install - -```bash -pip install agent-framework -# Optional: Add Azure integration -pip install agent-framework[azure] -# Optional: Add Foundry integration -pip install agent-framework[foundry] -# Optional: Both -pip install agent-framework[azure,foundry] -``` - -Supported Platforms: -- Python: 3.10+ -- OS: Windows, macOS, Linux - -## Python - 1. Setup API Keys - -Set as environment variables, or create a .env file at your project root: - -```bash -OPENAI_API_KEY=sk-... -OPENAI_CHAT_MODEL_ID=... -OPENAI_RESPONSES_MODEL_ID=... -... -AZURE_OPENAI_API_KEY=... -AZURE_OPENAI_ENDPOINT=... -AZURE_OPENAI_CHAT_DEPLOYMENT_NAME=... -... -FOUNDRY_PROJECT_ENDPOINT=... -FOUNDRY_MODEL_DEPLOYMENT_NAME=... -``` - -You can also override environment variables by explicitly passing configuration parameters to the chat client constructor: - -```python -from agent_framework.azure import AzureChatClient - -chat_client = AzureChatClient( - api_key=..., - endpoint=..., - deployment_name=..., - api_version=..., -) -``` - -See the following [setup guide](https://github.com/microsoft/agent-framework/tree/main/python/samples/getting_started) for more information. - -## Python - 2. Create a Simple Agent - -Create agents and invoke them directly: - -```python -import asyncio -from agent_framework import ChatClientAgent -from agent_framework.foundry import FoundryChatClient - -async def main(): - async with ChatClientAgent( - chat_client=FoundryChatClient(), - instructions="""These are the Three Laws of Robotics: - 1) A robot may not injure a human being... - 2) A robot must obey orders given it by human beings... - 3) A robot must protect its own existence... - - Respond concisely to the user's request. - """ - ): - result = await agent.run("Summarize the Three Laws of Robotics") - print(result.text) - """ - Output: - Protect humans, obey, self-preserve, prioritized. - """ - -if __name__ == "__main__": - asyncio.run(main()) -``` - -## Python - 3. Build an Agent with Tools - -Enhance your agent with custom tools and function calling: - -```python -import asyncio -from typing import Annotated -from random import randint -from pydantic import Field -from agent_framework import ChatClientAgent -from agent_framework.openai import OpenAIResponsesClient - - -def get_weather( - location: Annotated[str, Field(description="The location to get the weather for.")], -) -> str: - """Get the weather for a given location.""" - conditions = ["sunny", "cloudy", "rainy", "stormy"] - return f"The weather in {location} is {conditions[randint(0, 3)]} with a high of {randint(10, 30)}°C." - - -def get_menu_specials() -> str: - """Get today's menu specials.""" - return """ - Special Soup: Clam Chowder - Special Salad: Cobb Salad - Special Drink: Chai Tea - """ - - -async def main(): - agent = ChatClientAgent( - chat_client=OpenAIResponsesClient(), - instructions="You are a helpful assistant that can provide weather and restaurant information.", - tools=[get_weather, get_menu_specials] - ) - - response = await agent.run("What's the weather in Amsterdam and what are today's specials?") - print(response.text) - - """ - Output: - The weather in Amsterdam is sunny with a high of 22°C. Today's specials include - Clam Chowder soup, Cobb Salad, and Chai Tea as the special drink. - """ - -if __name__ == "__main__": - asyncio.run(main()) -``` - -You can explore additional agent samples [here](https://github.com/microsoft/agent-framework/tree/main/python/samples/getting_started/agents). - -**Note**: Advanced orchestration patterns like GroupChat, Sequential, and Concurrent orchestrations are coming soon. - ## More Examples & Samples -- [Getting Started with Agents](https://github.com/microsoft/agent-framework/tree/main/python/samples/getting_started/agents): Basic agent creation and tool usage -- [Chat Client Examples](https://github.com/microsoft/agent-framework/tree/main/python/samples/getting_started/chat_client): Direct chat client usage patterns -- [Azure Integration](https://github.com/microsoft/agent-framework/tree/main/python/packages/azure): Azure OpenAI and AI Foundry integration -- [.NET Orchestration Samples](https://github.com/microsoft/agent-framework/tree/main/dotnet/samples/GettingStarted/Orchestration): Advanced multi-agent patterns (.NET) +### Python +- [Getting Started with Agents](./python/samples/getting_started/agents): Basic agent creation and tool usage +- [Chat Client Examples](./python/samples/getting_started/chat_client): Direct chat client usage patterns +- [Azure Integration](./python/packages/azure): Azure OpenAI and AI Foundry integration + +### .Net +- [Getting Started with Agents](./dotnet/samples/GettingStarted/Steps): Basic agent creation and tool usage +- [Agent Provider Samples](./dotnet/samples/GettingStarted/Providers): Samples showing different agent providers +- [Orchestration Samples](./dotnet/samples/GettingStarted/Orchestration): Advanced multi-agent patterns ## Agent Framework Documentation - [Agent Framework Repository](https://github.com/microsoft/agent-framework) -- [Python Package Documentation](https://github.com/microsoft/agent-framework/tree/main/python) -- [.NET Package Documentation](https://github.com/microsoft/agent-framework/tree/main/dotnet) -- [Design Documents](https://github.com/microsoft/agent-framework/tree/main/docs/design) +- [Design Documents](./docs/design) +- [Architectural Decision Records](./docs/decisions) - Learn docs are coming soon. diff --git a/dotnet/README.md b/dotnet/README.md new file mode 100644 index 0000000000..4b068a5f33 --- /dev/null +++ b/dotnet/README.md @@ -0,0 +1,64 @@ +# Get Started with Microsoft Agent Framework for C# Developers + +## Run the Minimal Console demo + +The Minimal Console demo is a simple console application which shows how to create and run an agent. + +Supported Platforms: +- .Net: net9.0, net8.0, netstandard2.0, net472 +- OS: Windows, macOS, Linux + +If you want to use the latest published packages following the instructions [here](../docs/FAQS.md). + +### 1. Configure required environment variables + +This samples uses Azure OpenAI by default so you need to set the following environment variable + +``` powershell +$env:AZURE_OPENAI_ENDPOINT = "https://.openai.azure.com/" +``` + +If you want to use OpenAI + +1. Edit [Program.cs](./demos/MinimalConsole/Program.cs) and change the following lines: + ```csharp + AIAgent agent = new AzureOpenAIClient( + new Uri(Environment.GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT")!), + new AzureCliCredential()) + .GetChatClient("gpt-4o-mini") + .CreateAIAgent( + instructions: "You are a helpful assistant, you can help the user with weather information.", + tools: [AIFunctionFactory.Create(GetWeather)]); + ``` + To this: + ```csharp + AIAgent agent = new OpenAIClient(Environment.GetEnvironmentVariable("OPENAI_API_KEY")!) + .GetChatClient("gpt-4o-mini") + .CreateAIAgent( + instructions: "You are a helpful assistant, you can help the user with weather information.", + tools: [AIFunctionFactory.Create(GetWeather)]); + ``` +2. Create an environment variable with your OpenAI key + ``` powershell + $env:OPENAI_API_KEY = "sk-..." + ``` + +### 2. Build the project + +```powershell +cd demos\MinimalConsole +dotnet build +``` + +### 3. Run the demonstration + +``` powershell +dotnet run --framework net9.0 --no-build +``` + +Sample output: + +``` +The weather in Amsterdam is currently cloudy, with a high temperature of 15°C. +``` + diff --git a/python/README.md b/python/README.md index 26b4bbd5cc..4bce9c91f8 100644 --- a/python/README.md +++ b/python/README.md @@ -1,13 +1,4 @@ -# Get Started with Microsoft Agent Framework - -Highlights -- Flexible Agent Framework: build, orchestrate, and deploy AI agents and multi-agent systems -- Multi-Agent Orchestration: Group chat, sequential, concurrent, and handoff patterns -- Plugin Ecosystem: Extend with native functions, OpenAPI, Model Context Protocol (MCP), and more -- LLM Support: OpenAI, Azure OpenAI, Azure AI Foundry, and more -- Runtime Support: In-process and distributed agent execution -- Multimodal: Text, vision, and function calling -- Cross-Platform: .NET and Python implementations +# Get Started with Microsoft Agent Framework for Python Developers ## Quick Install