### Run the example server with AG-UI features Source: https://github.com/microsoft/agent-framework/blob/main/python/packages/ag-ui/agent_framework_ag_ui_examples/README.md Start the example server demonstrating all 7 AG-UI features. Optionally enable debug logging with ENABLE_DEBUG_LOGGING environment variable. ```bash # Install the package pip install agent-framework-ag-ui # Run the example server python -m agent_framework_ag_ui_examples # Or with debug logging ENABLE_DEBUG_LOGGING=1 python -m agent_framework_ag_ui_examples ``` -------------------------------- ### Run Step 01 Getting Started Source: https://github.com/microsoft/agent-framework/blob/main/dotnet/samples/02-agents/AGUI/README.md Launch the basic AG-UI server and interactive console client to explore foundational concepts. ```bash cd Step01_GettingStarted/Server dotnet run --urls http://localhost:8888 ``` ```bash cd Step01_GettingStarted/Client dotnet run ``` -------------------------------- ### Install dependencies and start local services Source: https://github.com/microsoft/agent-framework/blob/main/python/samples/04-hosting/azure_functions/09_workflow_shared_state/README.md Commands to install Python requirements, start the Azurite storage emulator, and launch the Azure Functions host. ```bash pip install -r requirements.txt ``` ```bash azurite --silent ``` ```bash func start ``` -------------------------------- ### LocalShellTool Quick Start Source: https://github.com/microsoft/agent-framework/blob/main/python/packages/tools/README.md A quick start example demonstrating how to use LocalShellTool with an Agent to run shell commands. It initializes an OpenAI client, sets up the agent with instructions and the shell tool, and executes a command to print the current working directory. ```python import asyncio from agent_framework import Agent from agent_framework.openai import OpenAIChatClient from agent_framework_tools.shell import LocalShellTool async def main() -> None: client = OpenAIChatClient(model="gpt-5.4-nano") async with LocalShellTool() as shell: agent = Agent( client=client, instructions="You are a helpful assistant that can run shell commands.", tools=[client.get_shell_tool(func=shell.as_function())], ) result = await agent.run("Print the current current working directory.") print(result.text) asyncio.run(main()) ``` -------------------------------- ### Install Dependencies and Start Services Source: https://github.com/microsoft/agent-framework/blob/main/python/samples/04-hosting/azure_functions/10_workflow_no_shared_state/README.md Sets up the development environment by installing Python dependencies and starting Azurite for local Azure Storage emulation, required before running the function app. ```bash pip install -r requirements.txt azurite --silent func start ``` -------------------------------- ### Run DevUI with Directory-Based Discovery Source: https://github.com/microsoft/agent-framework/blob/main/python/packages/devui/dev.md Start the DevUI to discover and load all example agents and workflows from the directory. ```bash cd samples/02-agents/devui devui ``` -------------------------------- ### Install and Start Azure Storage Emulator Standalone Source: https://github.com/microsoft/agent-framework/blob/main/dotnet/samples/04-hosting/DurableAgents/AzureFunctions/README.md Install Azurite globally via npm and run it as a standalone process on your local machine. ```bash npm install -g azurite azurite ``` -------------------------------- ### Install Agent Framework Mem0 Package via pip Source: https://github.com/microsoft/agent-framework/blob/main/python/packages/mem0/README.md Install the agent-framework-mem0 package using pip with the pre-release flag. This is the initial setup step required before using Mem0 context provider functionality. ```bash pip install agent-framework-mem0 --pre ``` -------------------------------- ### Install Agent Framework A2A Package Source: https://github.com/microsoft/agent-framework/blob/main/python/packages/a2a/README.md Use pip to install the agent-framework-a2a package, including pre-release versions, to get started with A2A agent integration. ```bash pip install agent-framework-a2a --pre ``` -------------------------------- ### Run the .NET Agent Harness Sample Source: https://github.com/microsoft/agent-framework/blob/main/dotnet/samples/02-agents/Harness/BuildYourOwnClaw/Claw_Step01_MeetYourClaw/README.md Navigate to the sample directory and execute the .NET project to start the agent harness. ```bash cd dotnet dotnet run --project samples/02-agents/Harness/BuildYourOwnClaw/Claw_Step01_MeetYourClaw ``` -------------------------------- ### Install agent-framework-claude Package via pip Source: https://github.com/microsoft/agent-framework/blob/main/python/packages/claude/README.md Install the agent-framework-claude pre-release package using pip package manager. This command downloads and installs the package and its dependencies for Claude Agent SDK integration with Microsoft Agent Framework. ```bash pip install agent-framework-claude --pre ``` -------------------------------- ### Install Agent Framework Copilot Studio Package Source: https://github.com/microsoft/agent-framework/blob/main/python/packages/copilotstudio/README.md Install the agent-framework-copilotstudio package via pip with pre-release flag. This is the first step required to use the Copilot Studio agent functionality. ```bash pip install agent-framework-copilotstudio --pre ``` -------------------------------- ### Run the Dependency Injection Sample Source: https://github.com/microsoft/agent-framework/blob/main/dotnet/samples/02-agents/AgentProviders/foundry/Agent_Step08_DependencyInjection/README.md Navigate to the sample directory and execute the .NET project to run the demonstration. ```bash cd dotnet/samples/02-agents/AgentProviders/foundry dotnet run --project .\Agent_Step08_DependencyInjection ``` -------------------------------- ### Run the Sample Source: https://github.com/microsoft/agent-framework/blob/main/dotnet/samples/02-agents/AgentProviders/foundry/Agent_Step12_Middleware/README.md Navigate to the sample directory and execute the .NET project. ```powershell cd dotnet/samples/02-agents/AgentProviders/foundry dotnet run --project .\Agent_Step12_Middleware ``` -------------------------------- ### Install agent-framework-bedrock Package Source: https://github.com/microsoft/agent-framework/blob/main/python/packages/bedrock/README.md Install the Microsoft Agent Framework Bedrock provider package using pip with pre-release flag. This package enables integration between Microsoft Agent Framework and Amazon Bedrock models. ```bash pip install agent-framework-bedrock --pre ``` -------------------------------- ### Set Up Python Environment Source: https://github.com/microsoft/agent-framework/blob/main/python/packages/devui/dev.md Navigate to the Python directory, install project dependencies using uv, and activate the virtual environment. ```bash cd python uv sync --dev source .venv/bin/activate ``` -------------------------------- ### Install Agent Framework Azure Functions Package Source: https://github.com/microsoft/agent-framework/blob/main/python/packages/azurefunctions/README.md Install the agent-framework-azurefunctions package using pip. This package enables hosting Microsoft Agent Framework agents on Azure Durable Functions with state persistence and failure recovery capabilities. ```bash pip install agent-framework-azurefunctions --pre ``` -------------------------------- ### Install Microsoft Agent Framework GitHub Copilot package via pip Source: https://github.com/microsoft/agent-framework/blob/main/python/packages/github_copilot/README.md This command installs the `agent-framework-github-copilot` package using pip, enabling access to the GitHub Copilot agent within the Microsoft Agent Framework. The `--pre` flag allows installation of pre-release versions, which might be necessary for the latest features. ```bash pip install agent-framework-github-copilot --pre ``` -------------------------------- ### Running the SessionFilesClient Sample Source: https://github.com/microsoft/agent-framework/blob/main/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Using-Samples/SessionFilesClient/README.md Navigate to the sample directory, set the required environment variables, and execute the .NET application. ```bash cd dotnet/samples/04-hosting/FoundryHostedAgents/responses/Using-Samples/SessionFilesClient $env:FOUNDRY_PROJECT_ENDPOINT = "http://localhost:8088/api/projects/local" $env:AZURE_AI_AGENT_NAME = "hosted-files" dotnet run ``` -------------------------------- ### Build and Run Agent Samples Source: https://github.com/microsoft/agent-framework/blob/main/dotnet/samples/AGENTS.md Instructions for navigating to the sample directory and running the agent samples using the .NET CLI. ```bash cd dotnet/samples/01-get-started/01_hello_agent dotnet run ``` -------------------------------- ### Initialize Copilot Studio Agent with Environment Variables (Python) Source: https://github.com/microsoft/agent-framework/blob/main/python/samples/02-agents/providers/copilotstudio/README.md This example demonstrates how to initialize the `CopilotStudioAgent` by relying on environment variables for configuration. It showcases a basic agent setup and execution of a simple query, printing the result. This method is ideal for quick starts where environment variables are pre-configured. ```python import asyncio from agent_framework.microsoft import CopilotStudioAgent # Uses environment variables for configuration async def main(): # Create agent using environment variables agent = CopilotStudioAgent() # Run a simple query result = await agent.run("What is the capital of France?") print(result) asyncio.run(main()) ``` -------------------------------- ### Install dependencies for agent-framework samples Source: https://github.com/microsoft/agent-framework/blob/main/python/samples/04-hosting/durabletask/README.md Navigate to the sample directory and install required packages from requirements.txt using pip or uv. ```bash cd samples/04-hosting/durabletask/01_single_agent pip install -r requirements.txt ``` ```bash uv pip install -r requirements.txt ``` -------------------------------- ### Build the Sample Source: https://github.com/microsoft/agent-framework/blob/main/dotnet/samples/02-agents/AgentProviders/anthropic/README.md Build the sample project using the .NET CLI. ```powershell dotnet build ``` -------------------------------- ### Quick Start with SecureAgentConfig Source: https://github.com/microsoft/agent-framework/blob/main/python/samples/02-agents/security/FIDES_DEVELOPER_GUIDE.md Shows the beginning of a quick start setup using `SecureAgentConfig`. ```python from agent_framework.security import SecureAgentConfig ``` -------------------------------- ### Run the Agent Function Tools Sample Source: https://github.com/microsoft/agent-framework/blob/main/dotnet/samples/02-agents/AgentProviders/foundry/Agent_Step03_UsingFunctionTools/README.md Navigate to the sample directory and execute the .NET run command to start the agent with function tools. ```bash cd dotnet/samples/02-agents/AgentProviders/foundry dotnet run --project .\Agent_Step03_UsingFunctionTools ``` -------------------------------- ### Run Poe Setup Task Source: https://github.com/microsoft/agent-framework/blob/main/python/DEV_SETUP.md Execute the 'setup' task using Poe to configure the development environment. This includes setting up a virtual environment, installing dependencies, and installing prek hooks. You can specify a Python version. ```bash uv run poe setup ``` ```bash uv run poe setup -P 3.12 ``` -------------------------------- ### Install agent-framework-durabletask via pip Source: https://github.com/microsoft/agent-framework/blob/main/python/packages/durabletask/README.md Install the package with the --pre flag to get pre-release versions. ```bash pip install agent-framework-durabletask --pre ``` -------------------------------- ### Initialize Local Settings File Source: https://github.com/microsoft/agent-framework/blob/main/python/samples/04-hosting/azure_functions/12_workflow_hitl/README.md Copy the sample settings file to create a local configuration for the project. ```bash cp local.settings.json.sample local.settings.json ``` -------------------------------- ### Running A2A Client Samples Source: https://github.com/microsoft/agent-framework/blob/main/python/samples/02-agents/a2a/README.md Demonstrates how to set up the environment and run the A2A client samples. Ensure an A2A server is running in a separate terminal. ```bash cd python/samples/02-agents/a2a # Start an A2A server in another terminal first: # cd python/samples/04-hosting/a2a && uv run python a2a_server.py export A2A_AGENT_HOST="http://localhost:5001/" uv run python agent_with_a2a.py ``` -------------------------------- ### Install DevUI via pip Source: https://github.com/microsoft/agent-framework/blob/main/python/packages/devui/README.md Install the agent-framework-devui package with pre-release flag to get the latest development version. ```bash pip install agent-framework-devui --pre ``` -------------------------------- ### Run Step 03 Frontend Tools Source: https://github.com/microsoft/agent-framework/blob/main/dotnet/samples/02-agents/AGUI/README.md Run the sample demonstrating client-defined tools executed on the server. ```bash cd Step03_FrontendTools/Server dotnet run --urls http://localhost:8888 ``` ```bash cd Step03_FrontendTools/Client dotnet run ``` -------------------------------- ### Install DevUI and Required Packages Source: https://github.com/microsoft/agent-framework/blob/main/dotnet/src/Microsoft.Agents.AI.DevUI/README.md Install the DevUI package along with hosting and OpenAI dependencies required for agent setup. ```bash dotnet add package Microsoft.Agents.AI.DevUI dotnet add package Microsoft.Agents.AI.Hosting dotnet add package Microsoft.Agents.AI.Hosting.OpenAI ``` -------------------------------- ### Run the Harness Agent Sample Source: https://github.com/microsoft/agent-framework/blob/main/dotnet/samples/02-agents/Harness/Harness_Step01_Research/README.md Navigate to the sample directory and execute the .NET project to start the interactive research agent. ```bash cd dotnet dotnet run --project samples/02-agents/Harness/Harness_Step01_Research ``` -------------------------------- ### Bedrock Chat Client Basic Usage Source: https://github.com/microsoft/agent-framework/blob/main/python/packages/bedrock/README.md Demonstrates how to instantiate BedrockChatClient, load AWS credentials from environment variables, and send a conversation turn to Amazon Bedrock models. This example shows the fundamental pattern for integrating Bedrock with Microsoft Agent Framework applications. ```python # Load credentials from BEDROCK_* environment variables # Instantiate BedrockChatClient # Send a simple conversation turn and print the response ``` -------------------------------- ### Install dependencies with uv Source: https://github.com/microsoft/agent-framework/blob/main/python/samples/04-hosting/foundry-hosted-agents/responses/11_monty_codeact/README.md Set up the local virtual environment using uv sync before running the agent. ```bash uv sync ``` -------------------------------- ### Run an Agent Framework sample Source: https://github.com/microsoft/agent-framework/blob/main/python/samples/01-get-started/README.md Execute any of the provided Python samples from the command line. ```bash python 01_hello_agent.py ``` -------------------------------- ### Build the Sample Project Source: https://github.com/microsoft/agent-framework/blob/main/dotnet/samples/02-agents/ModelContextProtocol/README.md Compile the sample project using the .NET CLI. This command prepares the project for execution. ```powershell dotnet build ``` -------------------------------- ### File-based skill setup and agent configuration Source: https://github.com/microsoft/agent-framework/blob/main/docs/decisions/0021-agent-skills-design.md Example of creating an AgentFileSkillsSource from a skills directory and configuring an AIAgent with the skills provider. ```csharp var source = new AgentFileSkillsSource(skillPaths: ["./skills"], scriptRunner: SubprocessScriptRunner.RunAsync); var provider = new AgentSkillsProvider(source); AIAgent agent = chatClient.AsAIAgent(new ChatClientAgentOptions { AIContextProviders = [provider], }); ``` -------------------------------- ### Run the Redis basics example Source: https://github.com/microsoft/agent-framework/blob/main/python/samples/02-agents/context_providers/redis/README.md Execute the basic Redis example script to demonstrate standalone usage and agent integration. ```bash python redis_basics.py ``` -------------------------------- ### Run Observability Sample Source: https://github.com/microsoft/agent-framework/blob/main/dotnet/samples/02-agents/AgentProviders/foundry/Agent_Step07_Observability/README.md Navigate to the sample directory and execute the agent sample using the .NET CLI. Ensure prerequisites are met and environment variables are set. ```bash cd dotnet/samples/02-agents/AgentProviders/foundry dotnet run --project .\Agent_Step07_Observability ``` -------------------------------- ### Run the Agent as Function Tool Sample Source: https://github.com/microsoft/agent-framework/blob/main/dotnet/samples/02-agents/AgentProviders/foundry/Agent_Step11_AsFunctionTool/README.md Navigate to the sample directory and execute the .NET project to run the agent composition sample. ```bash cd dotnet/samples/02-agents/AgentProviders/foundry dotnet run --project .\Agent_Step11_AsFunctionTool ``` -------------------------------- ### Run MCP Inspector with .NET Agent Source: https://github.com/microsoft/agent-framework/blob/main/dotnet/samples/02-agents/Agents/Agent_Step07_AsMcpTool/README.md This command starts the MCP Inspector and runs the .NET agent sample. Ensure Node.js and npm are installed. ```bash npx @modelcontextprotocol/inspector dotnet run --framework net10.0 ``` -------------------------------- ### Run the .NET Sample Source: https://github.com/microsoft/agent-framework/blob/main/dotnet/samples/02-agents/Agents/Agent_Step19_InFunctionLoopCheckpointing/README.md Navigate to the sample directory and execute the .NET application. This command starts the agent sample demonstrating in-function-loop checkpointing. ```powershell cd dotnet/samples/02-agents/Agents/Agent_Step19_InFunctionLoopCheckpointing dotnet run ``` -------------------------------- ### Run the DevUI Integration sample Source: https://github.com/microsoft/agent-framework/blob/main/dotnet/samples/05-end-to-end/DevUIAspireIntegration/README.md Execute the Aspire CLI command to start all services and access the DevUI web interface for testing both agents. ```bash cd dotnet/samples/05-end-to-end/DevUIAspireIntegration aspire run ``` -------------------------------- ### Run Ollama Docker Container (CPU) Source: https://github.com/microsoft/agent-framework/blob/main/dotnet/samples/02-agents/AgentProviders/ollama/Agent_With_Ollama/README.md Use this command to start an Ollama Docker container for CPU usage. Ensure Docker is installed and running. ```powershell docker run -d -v "c:\temp\ollama:/root/.ollama" -p 11434:11434 --name ollama ollama/ollama ``` -------------------------------- ### Host a Workflow with AG-UI Source: https://github.com/microsoft/agent-framework/blob/main/python/packages/ag-ui/README.md Configure a FastAPI server to host a workflow using the AG-UI endpoint. This example defines a simple workflow with a 'start' executor. ```python from fastapi import FastAPI from agent_framework import WorkflowBuilder, WorkflowContext, executor from agent_framework.ag_ui import add_agent_framework_fastapi_endpoint @executor(id="start") async def start(message: str, ctx: WorkflowContext) -> None: await ctx.yield_output(f"Workflow received: {message}") workflow = WorkflowBuilder(start_executor=start).build() app = FastAPI() add_agent_framework_fastapi_endpoint(app, workflow, "/") ``` -------------------------------- ### Run the Compaction Pipeline Sample Source: https://github.com/microsoft/agent-framework/blob/main/dotnet/samples/02-agents/Agents/Agent_Step18_CompactionPipeline/README.md Navigate to the sample directory and execute the .NET application to run the Compaction Pipeline demonstration. ```powershell cd dotnet/samples/02-agents/Agents/Agent_Step18_CompactionPipeline dotnet run ``` -------------------------------- ### Run Ollama Docker Container (GPU) Source: https://github.com/microsoft/agent-framework/blob/main/dotnet/samples/02-agents/AgentProviders/ollama/Agent_With_Ollama/README.md Use this command to start an Ollama Docker container with GPU support. Ensure Docker and NVIDIA drivers are installed. ```powershell docker run -d --gpus=all -v "c:\temp\ollama:/root/.ollama" -p 11434:11434 --name ollama ollama/ollama ``` -------------------------------- ### Example JSON Response for Starting Orchestration Source: https://github.com/microsoft/agent-framework/blob/main/python/samples/04-hosting/azure_functions/05_multi_agent_orchestration_concurrency/README.md This JSON object represents the expected response when successfully starting the multi-agent orchestration. It provides a confirmation message, the original prompt, a unique instance ID, and a URI to query the status of the ongoing process. ```json { "message": "Multi-agent concurrent orchestration started.", "prompt": "What is temperature?", "instanceId": "94d56266f0a04e5a8f9f3a1f77a4c597", "statusQueryGetUri": "http://localhost:7071/api/multiagent/status/94d56266f0a04e5a8f9f3a1f77a4c597" } ``` -------------------------------- ### Start the AG-UI Server Source: https://github.com/microsoft/agent-framework/blob/main/dotnet/samples/05-end-to-end/AGUIClientServer/README.md Build and run the ASP.NET Core server on a specific local URL. ```bash cd AGUIServer dotnet build dotnet run --urls "http://localhost:5100" ``` -------------------------------- ### Create a basic agent with explicit placeholder values Source: https://github.com/microsoft/agent-framework/blob/main/python/samples/SAMPLE_GUIDELINES.md Use placeholder values for non-sensitive parameters in getting started samples to ensure the code is immediately readable and self-documenting. ```python # Copyright (c) Microsoft. All rights reserved. import asyncio from agent_framework import Agent from agent_framework.foundry import FoundryChatClient from azure.identity import AzureCliCredential """ Sample docstring explaining what the sample does. """ async def main() -> None: client = FoundryChatClient( project_endpoint="https://your-project.services.ai.azure.com", model="gpt-4o", credential=AzureCliCredential(), ) agent = Agent(client=client, name="MyAgent", instructions="You are helpful.") result = await agent.run("Hello!") print(result) ``` -------------------------------- ### Run the Structured Output Sample Source: https://github.com/microsoft/agent-framework/blob/main/dotnet/samples/02-agents/AgentProviders/foundry/Agent_Step05_StructuredOutput/README.md Navigate to the sample directory and execute the agent sample using the .NET CLI. ```bash cd dotnet/samples/02-agents/AgentProviders/foundry dotnet run --project .\Agent_Step05_StructuredOutput ``` -------------------------------- ### Configure Observability with Environment Variables Source: https://github.com/microsoft/agent-framework/blob/main/python/samples/02-agents/observability/README.md Use this approach to automatically configure OpenTelemetry exporters by setting standard OTEL environment variables. This is the recommended method for getting started. ```python from agent_framework.observability import configure_otel_providers # Reads OTEL_EXPORTER_OTLP_* environment variables automatically configure_otel_providers() ``` -------------------------------- ### Running the LoopAgent Sample Source: https://github.com/microsoft/agent-framework/blob/main/dotnet/samples/02-agents/Harness/Harness_Step05_Loop/README.md Navigate to the sample directory and execute the .NET sample using the 'dotnet run' command. ```bash cd dotnet dotnet run --project samples/02-agents/Harness/Harness_Step05_Loop ``` -------------------------------- ### Run Demo with Automated PowerShell Script Source: https://github.com/microsoft/agent-framework/blob/main/dotnet/samples/02-agents/AgentOpenTelemetry/README.md Execute this script for an automated setup and launch of the demo, including prerequisites check, build, dashboard start, and console application launch. ```powershell .\start-demo.ps1 ``` -------------------------------- ### Set Up DevUI Frontend Development Environment Source: https://github.com/microsoft/agent-framework/blob/main/python/packages/devui/dev.md Install necessary dependencies for the DevUI frontend development. ```bash cd python/packages/devui/frontend yarn install ``` -------------------------------- ### Start Qdrant Vector Store with Docker Source: https://github.com/microsoft/agent-framework/blob/main/dotnet/samples/02-agents/AgentWithRAG/AgentWithRAG_Step02_CustomVectorStoreRAG/README.md Launch a local instance of the Qdrant vector store using Docker. This setup uses default port mappings for communication with the .NET application. ```powershell docker run -d --name qdrant -p 6333:6333 -p 6334:6334 qdrant/qdrant:latest ``` -------------------------------- ### Agent Framework Local Package Installation Requirements Source: https://github.com/microsoft/agent-framework/blob/main/python/samples/04-hosting/durabletask/01_single_agent/requirements.txt Requirements file for local development setup of Agent Framework packages. Uses editable installations (-e flag) to reference local package sources instead of PyPI, with explicit entries to ensure pip resolves dependencies from workspace sources. Includes Azure authentication dependency. ```text # Agent Framework packages # To use the deployed version, uncomment the lines below and comment out the local installation lines # agent-framework-foundry # agent-framework-durabletask # Local installation (for development and testing) # Each package must be listed explicitly because pip doesn't resolve uv workspace sources. # Without explicit entries, pip would fetch transitive dependencies from PyPI instead of local source. -e ../../../../packages/core # Core framework - base dependency for all packages -e ../../../../packages/foundry # Foundry support - dependency for hosted chat/agent samples -e ../../../../packages/durabletask # Durable Task support - the main package for this sample # Azure authentication azure-identity ```