### Extension Installation Guide Source: https://github.com/magnificents/context7/blob/main/autogen.md Provides instructions on how to install extensions for the framework. This markdown file likely covers package management and setup procedures. ```markdown installation.md ``` -------------------------------- ### Install AutoGen Dependencies for Chess Example Source: https://github.com/magnificents/context7/blob/main/autogen.md Installs the necessary AutoGen extensions (for OpenAI and Azure), the chess library, and PyYAML for the chess game example. This is a prerequisite for running the example. ```bash pip install "autogen-ext[openai,azure]" "chess" "pyyaml" ``` -------------------------------- ### Getting Started Count Update (C#) Source: https://github.com/magnificents/context7/blob/main/autogen.md C# code for handling updates related to message counts in a 'Getting Started' guide. ```cs // GettingStarted/CountUpdate.cs // This C# file likely handles updates to message counts or status. ``` -------------------------------- ### Deployment Guide Types (deploy/types.tsx) Source: https://github.com/magnificents/context7/blob/main/autogen.md Defines TypeScript interfaces and default data for deployment guides. The `Guide` interface specifies guide properties, and `defaultGuides` provides initial setup options for Python and Docker. ```typescript export interface Guide { id: string; title: string; type: "python" | "docker" | "cloud"; } export const defaultGuides: Guide[] = [ { id: "python-setup", title: "Python", type: "python", }, { id: "docker-setup", title: "Docker", type: "docker", }, // { // id: "cloud-deploy", // title: "Cloud", // type: "cloud", // }, ]; ``` -------------------------------- ### startup.sh: Python Environment Setup with UV Source: https://github.com/magnificents/context7/blob/main/autogen.md A bash script to set up the Python development environment. It updates .NET workloads, trusts HTTPS certificates, installs and syncs Python dependencies using 'uv', and activates a virtual environment. ```bash #!/bin/bash # dotnet setup dotnet workload update dotnet dev-certs https --trust # python setup pushd python pip install uv uv sync source .venv/bin/activate echo "export PATH=$PATH" >> ~/.bashrc popd ``` -------------------------------- ### Local LLMs with Ollama and LiteLLM Source: https://github.com/magnificents/context7/blob/main/autogen.md A guide on integrating local LLM deployments using Ollama with LiteLLM for a unified API interface. The notebook likely contains setup and usage examples. ```python local-llms-ollama-litellm.ipynb ``` -------------------------------- ### Getting Started Count Message (C#) Source: https://github.com/magnificents/context7/blob/main/autogen.md C# code related to counting messages within a 'Getting Started' context. ```cs // GettingStarted/CountMessage.cs // This C# file might be involved in counting or tracking messages in a tutorial. ``` -------------------------------- ### Getting Started Checker (C#) Source: https://github.com/magnificents/context7/blob/main/autogen.md A C# component likely used for validation or checking in a 'Getting Started' guide. ```cs // GettingStarted/Checker.cs // This C# file likely contains logic for checking or validating steps in a getting started process. ``` -------------------------------- ### Async Human-in-the-Loop Installation and Usage Source: https://github.com/magnificents/context7/blob/main/autogen.md Instructions for installing dependencies and running an AutoGen sample demonstrating human-in-the-loop interaction, requiring OpenAI or Azure OpenAI. ```bash pip install "autogen-ext[openai,azure]" "pyyaml" python main.py ``` -------------------------------- ### agbench Setup Script Source: https://github.com/magnificents/context7/blob/main/autogen.md A minimal Python setup script using setuptools to define the package. ```python from setuptools import setup setup() ``` -------------------------------- ### Python Package Setup Script Source: https://github.com/magnificents/context7/blob/main/autogen.md A minimal setup script for a Python package using setuptools, indicating the package is ready for distribution or installation. ```Python from setuptools import setup setup() ``` -------------------------------- ### Gitty CLI Installation and Usage Source: https://github.com/magnificents/context7/blob/main/autogen.md Bash commands demonstrating how to install dependencies and run the Gitty CLI tool. It includes setting up the virtual environment and exporting the OpenAI API key, which is a prerequisite for the tool's operation. ```bash uv sync --all-extras source .venv/bin/activate export OPENAI_API_KEY=sk-.... ``` -------------------------------- ### Component Configuration Example Source: https://github.com/magnificents/context7/blob/main/autogen.md Shows how to configure different components within the framework. This notebook likely covers setting up agents, tools, and other modules. ```python component-config.ipynb ``` -------------------------------- ### Dockerfile: Base Ubuntu Image Setup Source: https://github.com/magnificents/context7/blob/main/autogen.md Defines the base Docker image for the development environment, using a Microsoft-provided Ubuntu image. It includes commented-out sections for installing additional OS packages. ```dockerfile FROM mcr.microsoft.com/devcontainers/base:ubuntu # [Optional] Uncomment this section to install additional OS packages. # RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ # && apt-get -y install --no-install-recommends ``` -------------------------------- ### Custom Extension Creation Guide Source: https://github.com/magnificents/context7/blob/main/autogen.md A guide on how to create custom extensions for the framework. This markdown file likely outlines the process, APIs, and best practices for developing new functionalities. ```markdown create-your-own.md ``` -------------------------------- ### Connect to OpenAI (v1 Preview) (C#) Source: https://github.com/magnificents/context7/blob/main/autogen.md Example of connecting to OpenAI services using the v1 preview API in C#. ```cs // AutoGen.OpenAI.Sample/Connect_To_OpenAI_o1_preview.cs // This C# file shows how to connect to OpenAI using their v1 API preview. ``` -------------------------------- ### Hello Agent (C#) Source: https://github.com/magnificents/context7/blob/main/autogen.md C# code for a 'HelloAgent', likely a foundational example. ```cs // Hello/HelloAgent/HelloAgent.cs // This C# file contains the implementation for a basic 'HelloAgent'. ``` -------------------------------- ### Azure OpenAI with AAD Authentication Example Source: https://github.com/magnificents/context7/blob/main/autogen.md Demonstrates how to authenticate with Azure OpenAI services using Azure Active Directory (AAD). This guide likely covers setup and code examples for secure access. ```markdown azure-openai-with-aad-auth.md ``` -------------------------------- ### Run Chess Game Example Source: https://github.com/magnificents/context7/blob/main/autogen.md Executes the main Python script for the chess game example. This script demonstrates tool use and reflection with two chess player agents. ```bash python main.py ``` -------------------------------- ### Distributed Agent Runtime Setup Source: https://github.com/magnificents/context7/blob/main/autogen.md Provides guidance on setting up a distributed agent runtime. This notebook likely covers deployment strategies for scaling agent applications across multiple nodes. ```python distributed-agent-runtime.ipynb ``` -------------------------------- ### Getting Started Modifier (C#) Source: https://github.com/magnificents/context7/blob/main/autogen.md A C# component possibly used for modifying data or state in a 'Getting Started' scenario. ```cs // GettingStarted/Modifier.cs // This C# file may contain logic for modifying agent states or messages. ``` -------------------------------- ### Connect to Azure OpenAI (C#) Source: https://github.com/magnificents/context7/blob/main/autogen.md Example of establishing a connection to Azure OpenAI services using C#. ```cs // AutoGen.OpenAI.Sample/Connect_To_Azure_OpenAI.cs // This C# file shows how to configure and connect to Azure OpenAI endpoints. ``` -------------------------------- ### GRPC Runtime Initialization and Dependency Check Source: https://github.com/magnificents/context7/blob/main/autogen.md Initializes the GRPC runtime for Autogen extensions. It checks for the presence of the 'grpc' library and raises an informative ImportError if it's not installed, guiding the user to install the necessary extras (`autogen-ext[grpc]`). ```python from ._worker_runtime import GrpcWorkerAgentRuntime from ._worker_runtime_host import GrpcWorkerAgentRuntimeHost from ._worker_runtime_host_servicer import GrpcWorkerAgentRuntimeHostServicer try: import grpc # type: ignore except ImportError as e: raise ImportError( "To use the GRPC runtime the grpc extra must be installed. Run `pip install autogen-ext[grpc]`" ) from e __all__ = [ "GrpcWorkerAgentRuntime", "GrpcWorkerAgentRuntimeHost", "GrpcWorkerAgentRuntimeHostServicer", ] ``` -------------------------------- ### Tool Call with Ollama and LiteLLM (C#) Source: https://github.com/magnificents/context7/blob/main/autogen.md Example of implementing tool calling with Ollama and LiteLLM for AI agent interactions in C#. ```cs // AutoGen.OpenAI.Sample/Tool_Call_With_Ollama_And_LiteLLM.cs // This C# file demonstrates tool calling capabilities using Ollama and LiteLLM. ``` -------------------------------- ### Run .NET Aspire App Host Source: https://github.com/magnificents/context7/blob/main/autogen.md Provides instructions to navigate to the .NET Aspire AppHost directory and execute the application using the `dotnet run` command. This starts the HelloAgent project and its backend services. ```shell cd Hello.AppHost dotnet run ``` -------------------------------- ### AGBench GAIA Benchmark Template Source: https://github.com/magnificents/context7/blob/main/autogen.md Configuration and template files for the GAIA benchmark within AGBench. Includes environment setup, task templates, and expected answers for evaluating AI agents. ```yaml packages/agbench/benchmarks/GAIA/ENV.yaml ``` ```yaml packages/agbench/benchmarks/GAIA/config.yaml ``` -------------------------------- ### Python Package Initialization and Path Setup Source: https://github.com/magnificents/context7/blob/main/autogen.md Initializes the Python package for agent-worker communication protos. It sets up the path to include the current directory, allowing imported modules to be found. ```Python """ The :mod:`autogen_core.worker.protos` module provides Google Protobuf classes for agent-worker communication """ import os import sys sys.path.insert(0, os.path.abspath(os.path.dirname(__file__))) ``` -------------------------------- ### Azure Foundry Agent Example Source: https://github.com/magnificents/context7/blob/main/autogen.md Details the integration and usage of an Azure Foundry Agent. This notebook likely covers specific functionalities and configurations for agents built on Azure Foundry. ```python azure-foundry-agent.ipynb ``` -------------------------------- ### Message and Communication Example Source: https://github.com/magnificents/context7/blob/main/autogen.md Illustrates how agents communicate with each other and the system. This notebook likely covers message formats, communication protocols, and event handling. ```python message-and-communication.ipynb ``` -------------------------------- ### C# Program Entry Point for Aspire AppHost Source: https://github.com/magnificents/context7/blob/main/autogen.md The main program file for a .NET Aspire AppHost. It initializes the application builder, adds a project reference, builds the application, and starts it, waiting for shutdown. ```C# // Copyright (c) Microsoft Corporation. All rights reserved. // Program.cs using Microsoft.Extensions.Hosting; var appHost = DistributedApplication.CreateBuilder(); appHost.AddProject("HelloAgentsDotNetInMemoryRuntime"); var app = appHost.Build(); await app.StartAsync(); await app.WaitForShutdownAsync(); ``` -------------------------------- ### OpenAI Agents Import with Optional Dependencies Source: https://github.com/magnificents/context7/blob/main/autogen.md Imports OpenAIAgent and OpenAIAssistantAgent classes, with error handling for missing 'openai' extra dependencies. It provides instructions for installation. ```python try: from ._openai_agent import OpenAIAgent from ._openai_assistant_agent import OpenAIAssistantAgent except ImportError as e: raise ImportError( "Dependencies for OpenAI agents not found. " 'Please install autogen-ext with the "openai" extra: ' 'pip install "autogen-ext[openai]"' ) from e __all__ = ["OpenAIAssistantAgent", "OpenAIAgent"] ``` -------------------------------- ### Structured Output Agent Example Source: https://github.com/magnificents/context7/blob/main/autogen.md Shows how to configure an AI agent to produce output in a structured format, such as JSON. This notebook likely involves prompt engineering and output parsing techniques. ```python structured-output-agent.ipynb ``` -------------------------------- ### Image Chat with Vertex Gemini (C#) Source: https://github.com/magnificents/context7/blob/main/autogen.md Provides an example of performing image-based chat interactions with Vertex AI Gemini using C#. ```cs // AutoGen.Gemini.Sample/Image_Chat_With_Vertex_Gemini.cs // This file contains C# code for multi-modal chat with Vertex AI Gemini, supporting image inputs. ``` -------------------------------- ### Use Bing Search with Semantic Kernel Agent (C#) Source: https://github.com/magnificents/context7/blob/main/autogen.md Example of integrating Bing Search functionality into a Semantic Kernel agent using C#. ```cs // AutoGen.SemanticKernel.Sample/Use_Bing_Search_With_Semantic_Kernel_Agent.cs // This C# file shows how to enable Bing Search for a Semantic Kernel agent. ``` -------------------------------- ### C# TestBase Runtime Initialization Source: https://github.com/magnificents/context7/blob/main/autogen.md Provides a base class for tests that initializes the GrpcAgentRuntimeFixture. It includes a workaround for potential parallel execution issues by starting the runtime asynchronously and handling exceptions. ```C# // Copyright (c) Microsoft Corporation. All rights reserved. // TestBase.cs namespace Microsoft.AutoGen.Core.Grpc.Tests; public class TestBase { public TestBase() { try { // For some reason the first call to StartAsync() throws when these tests // run in parallel, even though the port does not actually collide between // different instances of GrpcAgentRuntimeFixture. This is a workaround. _ = new GrpcAgentRuntimeFixture().StartAsync().Result; } catch (Exception e) { Console.WriteLine(e); } } } ``` -------------------------------- ### Directory Build Props Configuration (XML) Source: https://github.com/magnificents/context7/blob/main/autogen.md A common MSBuild props file used to define project-wide properties. This example sets assembly signing to false and leaves key file and public key properties empty. ```xml False ``` -------------------------------- ### Orleans Cluster Setup for AutoGen Tests Source: https://github.com/magnificents/context7/blob/main/autogen.md Provides C# code for setting up and managing an Orleans test cluster. Includes a fixture for cluster management and a collection definition to link the fixture to test collections. ```csharp // Copyright (c) Microsoft Corporation. All rights reserved. // ClusterFixture.cs using Orleans.TestingHost; namespace Microsoft.AutoGen.RuntimeGateway.Grpc.Tests.Helpers.Orleans; public sealed class ClusterFixture : IDisposable { public ClusterFixture() { var builder = new TestClusterBuilder(); builder.AddSiloBuilderConfigurator(); Cluster = builder.Build(); Cluster.Deploy(); } public TestCluster Cluster { get; } void IDisposable.Dispose() => Cluster.StopAllSilos(); } ``` ```csharp // ClusterCollection.cs namespace Microsoft.AutoGen.RuntimeGateway.Grpc.Tests.Helpers.Orleans; [CollectionDefinition(Name)] public sealed class ClusterCollection : ICollectionFixture { public const string Name = nameof(ClusterCollection); } ``` -------------------------------- ### LangGraph Agent Development Example Source: https://github.com/magnificents/context7/blob/main/autogen.md Illustrates building an AI agent using LangGraph, a framework for building stateful, multi-actor applications. This notebook likely contains code for defining agent states, transitions, and execution logic. ```python langgraph-agent.ipynb ``` -------------------------------- ### Tool Use with Intervention Example Source: https://github.com/magnificents/context7/blob/main/autogen.md Demonstrates how an AI agent can use external tools, with the ability for intervention during the tool-use process. This notebook likely covers tool definition, execution, and conditional logic. ```python tool-use-with-intervention.ipynb ``` -------------------------------- ### AgentHost Program Entry Point (C#) Source: https://github.com/magnificents/context7/blob/main/autogen.md The main program file for the AgentHost, responsible for starting the AutoGen runtime gateway. It configures the host to use gRPC and waits for the application to shut down. ```csharp // Copyright (c) Microsoft Corporation. All rights reserved. // Program.cs using Microsoft.Extensions.Hosting; var app = await Microsoft.AutoGen.RuntimeGateway.Grpc.Host.StartAsync(local: false, useGrpc: true).ConfigureAwait(false); await app.WaitForShutdownAsync(); ``` -------------------------------- ### Build and Serve .NET Documentation Website Source: https://github.com/magnificents/context7/blob/main/autogen.md Instructions for building and serving the project's documentation website using DocFX. It requires .NET 8.0 or later and involves restoring tools and running the DocFX serve command. ```bash dotnet tool restore dotnet tool run docfx ../docs/dotnet/docfx.json --serve ``` -------------------------------- ### Topic Subscription Scenarios Source: https://github.com/magnificents/context7/blob/main/autogen.md Explores various scenarios related to topic subscriptions in an application, likely involving message queues or event-driven architectures. This notebook may contain code examples for publishing and subscribing to topics. ```python topic-subscription-scenarios.ipynb ``` -------------------------------- ### Autogen Studio Dockerfile Source: https://github.com/magnificents/context7/blob/main/autogen.md Defines the Docker image for Autogen Studio. It sets up a Python 3.10 environment, installs dependencies including Autogen Studio and Gunicorn, creates a non-root user, and configures the application directory and command. ```dockerfile FROM python:3.10-slim WORKDIR /code RUN pip install -U gunicorn autogenstudio # Create a non-root user RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH \ AUTOGENSTUDIO_APPDIR=/home/user/app WORKDIR $HOME/app COPY --chown=user . $HOME/app CMD gunicorn -w $((2 * $(getconf _NPROCESSORS_ONLN) + 1)) --timeout 12600 -k uvicorn.workers.UvicornWorker autogenstudio.web.app:app --bind "0.0.0.0:8081" ``` -------------------------------- ### GettingStarted.csproj Project File Source: https://github.com/magnificents/context7/blob/main/autogen.md The .NET project file for the GettingStarted sample. It specifies the output type, target framework, root namespace, and includes project references. ```xml  Exe net8.0 getting_started enable enable ``` -------------------------------- ### Gitty CLI Tool README Source: https://github.com/magnificents/context7/blob/main/autogen.md README file for the Gitty CLI tool, an AutoGen-powered application for generating draft replies to GitHub issues and pull requests. It outlines the tool's purpose and provides installation and usage instructions. ```markdown # gitty (Warning: WIP) This is an AutoGen powered CLI that generates draft replies for issues and pull requests to reduce maintenance overhead for open source projects. Simple installation and CLI: ```bash gitty --repo microsoft/autogen issue 5212 ``` *Important*: Install the dependencies and set OpenAI API key: ```bash uv sync --all-extras source .venv/bin/activate export OPENAI_API_KEY=sk-.... ``` ``` -------------------------------- ### MagenticOneCoderAgent Import with Optional Dependencies Source: https://github.com/magnificents/context7/blob/main/autogen.md Imports the MagenticOneCoderAgent class, handling potential ImportError if the 'magentic-one' extra dependencies are not installed. It guides users on how to install them. ```python try: from ._magentic_one_coder_agent import MagenticOneCoderAgent except ImportError as e: raise ImportError( "Dependencies for MagenticOneCoderAgent not found. " 'Please install autogen-ext with the "magentic-one" extra: ' 'pip install "autogen-ext[magentic-one]"' ) from e __all__ = ["MagenticOneCoderAgent"] ``` -------------------------------- ### AzureAIAgent Import with Optional Dependencies Source: https://github.com/magnificents/context7/blob/main/autogen.md Imports the AzureAIAgent class from a private module. It includes error handling to guide users to install the necessary 'azure' extra if dependencies are missing. ```python try: from ._azure_ai_agent import AzureAIAgent except ImportError as e: raise ImportError( "Dependencies for AzureAIAgent not found. " 'Please install autogen-ext with the "azure" extra: ' 'pip install "autogen-ext[azure]"' ) from e __all__ = ["AzureAIAgent"] ``` -------------------------------- ### Azure Container Code Executor Source: https://github.com/magnificents/context7/blob/main/autogen.md A Jupyter Notebook demonstrating the use of an Azure Container Code Executor, likely for securely running code snippets within an agent framework. It may include setup and execution examples. ```python azure-container-code-executor.ipynb ``` -------------------------------- ### Build AutoGen Website Source: https://github.com/magnificents/context7/blob/main/autogen.md Command to restore .NET tools and run DocFX to serve the website documentation. Assumes the user is in the 'autogen/dotnet' directory. ```bash dotnet tool restore dotnet tool run docfx website/docfx.json --serve ``` -------------------------------- ### launchSettings.json for HelloAgentState Source: https://github.com/magnificents/context7/blob/main/autogen.md Configuration for launching the HelloAgentState project, including profile details, browser launch, environment variables, and application URLs. ```json { "profiles": { "HelloAgentState": { "commandName": "Project", "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" }, "applicationUrl": "https://localhost:53136;http://localhost:53137" } } } ``` -------------------------------- ### AutoGen C# Function Example (Top-Level Statement) Source: https://github.com/magnificents/context7/blob/main/autogen.md Demonstrates a C# class with a method decorated with the [Function] attribute, suitable for source generation. This example is structured for top-level statements. ```csharp // Copyright (c) Microsoft Corporation. All rights reserved. // TopLevelStatementFunctionExample.cs using AutoGen.Core; public partial class TopLevelStatementFunctionExample { [Function] public Task Add(int a, int b) { return Task.FromResult("{a + b}"); } } ``` -------------------------------- ### Run Semantic Kernel Integration Sample (C#) Source: https://github.com/magnificents/context7/blob/main/autogen.md Executes an asynchronous sample demonstrating the integration of Semantic Kernel functions with AutoGen agents. This snippet shows the entry point for the Semantic Kernel sample application. ```csharp // Copyright (c) Microsoft Corporation. All rights reserved. // Program.cs using AutoGen.SemanticKernel.Sample; await Use_Kernel_Functions_With_Other_Agent.RunAsync(); ``` -------------------------------- ### AutoGen C# Function Example (Filescope Namespace) Source: https://github.com/magnificents/context7/blob/main/autogen.md Demonstrates a C# class with a method decorated with the [Function] attribute, suitable for source generation. This example uses a filescope namespace. ```csharp // Copyright (c) Microsoft Corporation. All rights reserved. // FilescopeNamespaceFunctionExample.cs using AutoGen.Core; namespace AutoGen.SourceGenerator.Tests; public partial class FilescopeNamespaceFunctionExample { [Function] public Task Add(int a, int b) { return Task.FromResult("{a + b}"); } } ``` -------------------------------- ### Sample Project Dependencies Source: https://github.com/magnificents/context7/blob/main/autogen.md Lists the required Python packages for a specific AutoGen sample project, including core libraries and extensions. ```text autogen-agentchat autogen-ext pyyaml ``` -------------------------------- ### launchSettings.json for .NET AppHost Source: https://github.com/magnificents/context7/blob/main/autogen.md Configuration file for launching .NET applications, specifying profiles, command names, browser launch behavior, environment variables, and application URLs. ```JSON { "profiles": { "HelloAgent": { "commandName": "Project", "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" }, "applicationUrl": "https://localhost:53113;http://localhost:53114" } } } ``` -------------------------------- ### Python Package Requirements Source: https://github.com/magnificents/context7/blob/main/autogen.md Specifies the dependencies for the Python package, typically used with pip for installation. ```text . ``` -------------------------------- ### launchSettings.json for HelloAgent Source: https://github.com/magnificents/context7/blob/main/autogen.md Configuration for launching the HelloAgent project. It defines profile settings, browser launch, environment variables, and application URLs. ```json { "profiles": { "HelloAgent": { "commandName": "Project", "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" }, "applicationUrl": "https://localhost:53113;http://localhost:53114" } } } ``` -------------------------------- ### launchSettings.json for HelloAIAgents Source: https://github.com/magnificents/context7/blob/main/autogen.md Configuration for launching the HelloAIAgents project. It specifies profile settings, browser launch behavior, environment variables, and application URLs. ```json { "profiles": { "HelloAIAgents": { "commandName": "Project", "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" }, "applicationUrl": "https://localhost:53139;http://localhost:53140" } } } ``` -------------------------------- ### Python Version Specification Source: https://github.com/magnificents/context7/blob/main/autogen.md A file specifying the required Python version for the gitty project. This ensures compatibility and proper environment setup. ```text 3.11 ``` -------------------------------- ### Core xLang Hello Python Agent Sample Source: https://github.com/magnificents/context7/blob/main/autogen.md Sample demonstrating cross-language communication with a Python agent using gRPC and protobufs. ```python # samples/core_xlang_hello_python_agent/hello_python_agent.py import autogen from autogen import UserProxyAgent, AssistantAgent # LLM configuration (replace with your actual config) config_list = [ { "model": "gpt-4", "api_key": "YOUR_API_KEY" } ] llm_config = { "config_list": config_list, "temperature": 0.5, } # Define the Python agent python_agent = AssistantAgent( name="PythonAgent", llm_config=llm_config, system_message="You are a Python agent that responds to requests." ) # This agent would typically be part of a larger system that handles # gRPC communication and protobuf message serialization/deserialization. # Example of how it might be used: # user_proxy = UserProxyAgent(name="UserProxy") # user_proxy.initiate_chat(python_agent, message="Hello, Python ``` -------------------------------- ### AutoGen Core README Source: https://github.com/magnificents/context7/blob/main/autogen.md Provides an overview of AutoGen Core, highlighting its purpose in building AI agent systems using the Actor model and its scalability. ```markdown # AutoGen Core - [Documentation](https://microsoft.github.io/autogen/stable/user-guide/core-user-guide/index.html) AutoGen core offers an easy way to quickly build event-driven, distributed, scalable, resilient AI agent systems. Agents are developed by using the [Actor model](https://en.wikipedia.org/wiki/Actor_model). You can build and run your agent system locally and easily move to a distributed system in the cloud when you are ready. ``` -------------------------------- ### OpenAI Assistant Agent Implementation Source: https://github.com/magnificents/context7/blob/main/autogen.md Demonstrates how to build and use an AI agent powered by OpenAI's Assistant API. This notebook likely covers creating assistants, managing threads, and interacting with them. ```python openai-assistant-agent.ipynb ``` -------------------------------- ### Run Gemini Chat Sample (C#) Source: https://github.com/magnificents/context7/blob/main/autogen.md Executes an asynchronous sample demonstrating chat functionality with Vertex Gemini. This snippet shows the entry point for the Gemini sample application. ```csharp // Copyright (c) Microsoft Corporation. All rights reserved. // Program.cs using AutoGen.Gemini.Sample; Image_Chat_With_Vertex_Gemini.RunAsync().Wait(); ``` -------------------------------- ### Concurrent Agents Example Source: https://github.com/magnificents/context7/blob/main/autogen.md Illustrates how to manage and run multiple AI agents concurrently. This notebook likely contains code for parallel processing and agent orchestration. ```python concurrent-agents.ipynb ``` -------------------------------- ### Launch Settings for DevTeam.Backend Source: https://github.com/magnificents/context7/blob/main/autogen.md JSON configuration for launching the DevTeam.Backend project. It specifies running as a project, launching the browser, setting the ASPNETCORE_ENVIRONMENT to Development, and defines application URLs. ```json { "profiles": { "DevTeam.Backend": { "commandName": "Project", "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" }, "applicationUrl": "https://localhost:50672;http://localhost:50674" } } } ``` -------------------------------- ### Multi-Agent Debate Example Source: https://github.com/magnificents/context7/blob/main/autogen.md Demonstrates a multi-agent system designed for debate or discussion. This notebook likely contains code for agents presenting arguments, counter-arguments, and reaching conclusions. ```python multi-agent-debate.ipynb ``` -------------------------------- ### Run OpenAI Structural Output Sample (C#) Source: https://github.com/magnificents/context7/blob/main/autogen.md Executes an asynchronous sample demonstrating structural output capabilities with OpenAI agents. This snippet shows the entry point for the OpenAI sample application. ```csharp // Copyright (c) Microsoft Corporation. All rights reserved. // Program.cs using AutoGen.OpenAI.Sample; Structural_Output.RunAsync().Wait(); ``` -------------------------------- ### Example Asynchronous Test Function Source: https://github.com/magnificents/context7/blob/main/autogen.md A basic asynchronous test function written in Python. It serves as a placeholder and asserts a simple boolean condition, indicating a successful test execution. ```python async def test_example() -> None: assert True ``` -------------------------------- ### Run Ollama Chat Sample (C#) Source: https://github.com/magnificents/context7/blob/main/autogen.md Executes an asynchronous sample demonstrating chat functionality with Ollama. This snippet shows the entry point for the Ollama sample application. ```csharp // Copyright (c) Microsoft Corporation. All rights reserved. // Program.cs using AutoGen.Ollama.Sample; await Chat_With_LLaVA.RunAsync(); ``` -------------------------------- ### Hello World Program in C# Source: https://github.com/magnificents/context7/blob/main/autogen.md A simple C# program that prints "Hello, World!" to the console. This is a basic entry point for execution. ```csharp // Copyright (c) Microsoft Corporation. All rights reserved. // Program.cs Console.WriteLine("Hello, World!"); ``` -------------------------------- ### Autogenstudio Gallery Tools Initialization Source: https://github.com/magnificents/context7/blob/main/autogen.md Initializes the autogenstudio.gallery.tools submodule, exposing specific tool functions like bing_search_tool and calculator_tool. ```python from .bing_search import bing_search_tool from .calculator import calculator_tool ``` -------------------------------- ### AutoGen Package Creation Task Source: https://github.com/magnificents/context7/blob/main/autogen.md Presents a task asking if a new Autogen package can be created for a copilot extension agent. The expected answer guides on best practices for contributing extensions. ```yaml # Test where human advice is needed. task_description: As a contribution to autogen, can I create a new autogen package for a copilot extension agent that I built on autogen? expected_answer: It's best to have your agent in its own repo, then add the autogen-extension topic to that repo. ``` -------------------------------- ### Python Protobuf Initialization Source: https://github.com/magnificents/context7/blob/main/autogen.md The __init__.py file for the protos directory in the core_xlang_hello_python_agent sample. It includes a docstring explaining the module's purpose and sets up the Python path to include the current directory for protobuf imports. ```python """ The :mod:`autogen_core.worker.protos` module provides Google Protobuf classes for agent-worker communication """ import os import sys sys.path.insert(0, os.path.abspath(os.path.dirname(__file__))) ``` -------------------------------- ### Lab Data Model and Defaults Source: https://github.com/magnificents/context7/blob/main/autogen.md Defines the structure for a 'Lab' object, including its ID, title, and type (python, docker, or cloud). It also provides an example array of default labs. ```typescript export interface Lab { id: string; title: string; type: "python" | "docker" | "cloud"; } export const defaultLabs: Lab[] = [ // { // id: "component-builder", // title: "Component Builder", // type: "python", // }, { id: "tool-maker", title: "Tool Maker", type: "python", }, ]; ``` -------------------------------- ### Reflection Design Pattern Example Source: https://github.com/magnificents/context7/blob/main/autogen.md Explains and demonstrates the 'Reflection' design pattern, where an agent analyzes its own thought process or output to improve. This notebook likely contains code for self-correction mechanisms. ```python reflection.ipynb ``` -------------------------------- ### Discovering Extensions Source: https://github.com/magnificents/context7/blob/main/autogen.md Explains how to discover and utilize available extensions within the framework. This markdown file likely covers extension management and integration. ```markdown discover.md ``` -------------------------------- ### Group Chat Design Pattern Source: https://github.com/magnificents/context7/blob/main/autogen.md Details the 'Group Chat' design pattern for multi-agent systems. This notebook likely provides code examples for setting up and managing group conversations between agents. ```python group-chat.ipynb ``` -------------------------------- ### Autogenstudio Gallery Package Initialization Source: https://github.com/magnificents/context7/blob/main/autogen.md Initializes the autogenstudio.gallery package, making the GalleryBuilder and its creation function available for use. ```python from .builder import GalleryBuilder, create_default_gallery __all__ = ["GalleryBuilder", "create_default_gallery"] ``` -------------------------------- ### Development App Settings for Hello.AppHost Source: https://github.com/magnificents/context7/blob/main/autogen.md JSON configuration file for development environment settings, specifically defining logging levels for various categories. ```json { "Logging": { "LogLevel": { "Default": "Information", "Microsoft.AspNetCore": "Warning", "Aspire.Hosting.ApplicationModel.ResourceNotificationService": "Debug" } } } ``` -------------------------------- ### Hello AIAgent (C#) Source: https://github.com/magnificents/context7/blob/main/autogen.md C# code for a 'HelloAIAgent' demonstrating basic AI agent interaction. ```cs // Hello/HelloAIAgents/HelloAIAgent.cs // This C# file defines a simple AI agent for a 'Hello' scenario. ``` -------------------------------- ### Base API Class (baseapi.ts) Source: https://github.com/magnificents/context7/blob/main/autogen.md An abstract TypeScript class providing common API functionalities. It includes methods to get the base URL and construct request headers with authentication tokens. ```typescript import { getServerUrl } from "./utils"; // baseApi.ts export abstract class BaseAPI { protected getBaseUrl(): string { return getServerUrl(); } protected getHeaders(): HeadersInit { // Get auth token from localStorage const token = localStorage.getItem("auth_token"); const headers: HeadersInit = { "Content-Type": "application/json", }; // Add authorization header if token exists if (token) { headers["Authorization"] = `Bearer ${token}`; } return headers; } // Other common methods } ``` -------------------------------- ### AutoGen Studio Web Auth Package Initialization Source: https://github.com/magnificents/context7/blob/main/autogen.md Initializes the web authentication module, exporting various authentication-related components and routers. ```python from .authroutes import router from .dependencies import get_current_user, require_admin, require_authenticated, require_roles from .exceptions import AuthException from .manager import AuthManager from .middleware import AuthMiddleware from .models import AuthConfig, User from .wsauth import WebSocketAuthHandler __all__ = [ "AuthManager", "AuthMiddleware", "AuthConfig", "User", "AuthException", "router", "get_current_user", "require_authenticated", "require_roles", "require_admin", "WebSocketAuthHandler", ] ``` -------------------------------- ### agbench Linter Initialization Source: https://github.com/magnificents/context7/blob/main/autogen.md The __init__.py file for the agbench linter module, importing base classes for qualitative coding. ```python # __init__.py from ._base import BaseQualitativeCoder, Code, CodedDocument, Document ``` -------------------------------- ### .NET Tools Configuration Source: https://github.com/magnificents/context7/blob/main/autogen.md Specifies the .NET global tools to be installed and used within the project, including their versions and commands. This file manages development environment tools like dotnet-repl and docfx. ```JSON { "version": 1, "isRoot": true, "tools": { "dotnet-repl": { "version": "0.1.205", "commands": [ "dotnet-repl" ], "rollForward": true }, "docfx": { "version": "2.67.5", "commands": [ "docfx" ], "rollForward": true } } } ``` -------------------------------- ### Autogenstudio Package Initialization Source: https://github.com/magnificents/context7/blob/main/autogen.md Initializes the main autogenstudio package by importing key components like DatabaseManager, Team, and TeamManager. It also exposes the package version. ```python from .database.db_manager import DatabaseManager from .datamodel import Team from .teammanager import TeamManager from .version import __version__ __all__ = ["DatabaseManager", "Team", "TeamManager", "__version__"] ``` -------------------------------- ### Handoffs Design Pattern Example Source: https://github.com/magnificents/context7/blob/main/autogen.md Explains and demonstrates the 'Handoffs' design pattern, where control or tasks are passed between different agents. This notebook likely contains code for managing agent communication and task delegation. ```python handoffs.ipynb ``` -------------------------------- ### Code Execution Group Chat Example Source: https://github.com/magnificents/context7/blob/main/autogen.md A Jupyter Notebook demonstrating a group chat scenario where AI agents can execute code. This likely involves setting up a multi-agent environment with code execution capabilities. ```python code-execution-groupchat.ipynb ``` -------------------------------- ### VideoSurfer Agent Initialization Source: https://github.com/magnificents/context7/blob/main/autogen.md Defines the main VideoSurfer agent class for use within the autogen-ext package. It serves as the entry point for video-related agent functionalities. ```python from ._video_surfer import VideoSurfer __all__ = ["VideoSurfer"] ``` -------------------------------- ### Tutorial Table of Contents (YAML) Source: https://github.com/magnificents/context7/blob/main/autogen.md A YAML file specifying the navigation for the tutorial section of the AutoGen website. It lists various tutorial topics, such as chatting with agents, image chat, and using tools. ```yaml - name: Chat with an agent href: Chat-with-an-agent.md - name: Image chat with agent href: Image-chat-with-agent.md - name: Create agent with tools href: Create-agent-with-tools.md - name: Use AutoGen.Net agent as model in AG Studio href: Use-AutoGen.Net-agent-as-model-in-AG-Studio.md ``` -------------------------------- ### Core Streaming Handoffs FastAPI Sample Source: https://github.com/magnificents/context7/blob/main/autogen.md Sample demonstrating streaming responses and agent handoffs in a FastAPI application using AutoGen. ```python # samples/core_streaming_handoffs_fastapi/app.py from fastapi import FastAPI, Request, HTTPException from fastapi.responses import StreamingResponse import uvicorn import autogen app = FastAPI() # LLM configuration (replace with your actual config) config_list = [ { "model": "gpt-4", "api_key": "YOUR_API_KEY" } ] llm_config = { "config_list": config_list, "temperature": 0.5, } # Initialize agents user_proxy = autogen.UserProxyAgent( name="UserProxy", human_input_mode="NEVER", code_execution_config=False, system_message="A helpful assistant." ) assistant = autogen.AssistantAgent( name="Assistant", llm_config=llm_config, system_message="You are a helpful AI assistant that generates responses." ) # Function to handle chat and stream responses def chat_generator(message): # Initiate chat and yield responses as they come # This requires a more advanced setup to capture streaming chunks # For simplicity, we'll simulate a response response = user_proxy.initiate_chat(assistant, message=message) if response and response['chat_history']: yield response['chat_history'][-1]['content'] else: yield "No response received." @app.post("/chat_stream") async def chat_stream_endpoint(request: Request): data = await request.json() message = data.get("message") if not message: raise HTTPException(status_code=400, detail="No message provided") # Use a generator to stream the response return StreamingResponse(chat_generator(message), media_type="text/plain") if __name__ == "__main__": uvicorn.run(app, host="0.0.0.0", port=8000) ``` -------------------------------- ### Dockerfile for Seed Memory Service Source: https://github.com/magnificents/context7/blob/main/autogen.md Dockerfile for building and running the seed-memory .NET application. It uses multi-stage builds, starting from a .NET SDK image for building and then copying the published artifacts to a runtime image. ```dockerfile FROM mcr.microsoft.com/dotnet/runtime:7.0 AS base WORKDIR /app FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build WORKDIR /src COPY ["util/seed-memory/seed-memory.csproj", "util/seed-memory/"] RUN dotnet restore "util/seed-memory/seed-memory.csproj" COPY . . WORKDIR "/src/util/seed-memory" RUN dotnet build "seed-memory.csproj" -c Release -o /app/build FROM build AS publish RUN dotnet publish "seed-memory.csproj" -c Release -o /app/publish /p:UseAppHost=false FROM base AS final WORKDIR /app COPY --from=publish /app/publish . ENTRYPOINT ["dotnet", "seed-memory.dll"] ``` -------------------------------- ### Create AssistantAgent with OpenAI Source: https://github.com/magnificents/context7/blob/main/autogen.md Demonstrates how to create an AssistantAgent using the OpenAI model in C#. This agent acts as an AI assistant and supports function calls if the LLM model allows. ```csharp [!code-csharp>(../../samples/AgentChat/Autogen.Basic.Sample/CodeSnippet/CreateAnAgent.cs?name=code_snippet_1)] ``` -------------------------------- ### Qdrant Options Configuration in C# Source: https://github.com/magnificents/context7/blob/main/autogen.md Defines a C# class `QdrantOptions` for configuring Qdrant vector database connection. It includes required properties for `Endpoint` and `VectorSize`, and an optional `ApiKey`. ```csharp // Copyright (c) Microsoft Corporation. All rights reserved. // QdrantOptions.cs using System.ComponentModel.DataAnnotations; namespace Microsoft.AutoGen.Extensions.SemanticKernel; public class QdrantOptions { [Required] public required string Endpoint { get; set; } [Required] public required int VectorSize { get; set; } public string ApiKey { get; set; } = ""; } ``` -------------------------------- ### Cache Store Package Index Source: https://github.com/magnificents/context7/blob/main/autogen.md This file serves as the main entry point for the cache_store package. It typically exports key components for managing caching mechanisms within autogen-ext. ```python # No code provided in the input for this file. ``` -------------------------------- ### Termination with Intervention Example Source: https://github.com/magnificents/context7/blob/main/autogen.md Illustrates a scenario where an AI agent's execution can be terminated or modified based on specific intervention conditions. This notebook likely explores control flow and conditional logic in agent applications. ```python termination-with-intervention.ipynb ```