autogen/dotnet
Ryan Sweet 458d273fc4
Refactoring the services and implementing an in-memory runtime for .NET (#4005)
closes #3950 closes #3702

What this is doing:

I am refactoring the services on the .NET runtime and attempting to clarify the naming and organization.
I added this doc to help capture the naming and concepts.
AgentRuntime / Worker should work similar to the python version and enables running the whole agent system in one process. For remote the system uses the versions of the services in the grpc folder.
lots of other bug fixes/threading cleanup - passing cancellation token throughout
Services update clarifies the naming and roles:

Worker: Hosts the Agents and is a client to the Gateway
Gateway:
-- RPC gateway for the other services APIs
-- Provides an RPC bridge between the workers and the Event Bus
Registry: keeps track of the agents in the system and which events they can handle
AgentState: persistent state for agents
2024-11-12 11:04:59 -08:00
..
.config Bring Dotnet AutoGen (#924) 2024-04-26 16:21:46 +00:00
.tools [.Net] Add AOT compatible check for AutoGen.Core (#2858) 2024-06-04 15:01:11 +00:00
eng [.Net] Update OpenAI, semantic kernel to latest version (#3792) 2024-10-15 07:23:33 -07:00
nuget Merge branch 'main' into staging 2024-10-02 14:38:28 -04:00
resource/images [.Net] Add Goolge gemini (#2868) 2024-06-10 17:31:45 +00:00
samples Refactoring the services and implementing an in-memory runtime for .NET (#4005) 2024-11-12 11:04:59 -08:00
src Refactoring the services and implementing an in-memory runtime for .NET (#4005) 2024-11-12 11:04:59 -08:00
test Refactoring the services and implementing an in-memory runtime for .NET (#4005) 2024-11-12 11:04:59 -08:00
website [.NET] Create tools from M.E.A.I AIFunctionFactory (#4041) 2024-11-03 09:18:32 -08:00
.editorconfig [.Net] Add a generic `IHandle` interface so AgentRuntime doesn't need to deal with typed handler (#3985) 2024-10-30 11:53:37 -07:00
.gitattributes Merge project-oagents into agnext 2024-06-19 15:34:04 -07:00
.gitignore Do not exclude Properties or appsettings.json via .gitignore, commit missing files (#4057) 2024-11-04 20:48:46 +01:00
AutoGen.sln Refactoring the services and implementing an in-memory runtime for .NET (#4005) 2024-11-12 11:04:59 -08:00
Directory.Build.props [.NET] Update version of Microsoft.Extension.Ai & System.Text.Json (#4044) 2024-11-04 08:40:53 -05:00
Directory.Build.targets Add .editorconfig & use centralized package management 2024-06-19 16:53:37 -07:00
Directory.Packages.props Refactoring the services and implementing an in-memory runtime for .NET (#4005) 2024-11-12 11:04:59 -08:00
NuGet.config [.Net] Fix #2660 and add tests for AutoGen.DotnetInteractive (#2676) 2024-05-14 03:40:26 +00:00
README.md add documentation for dotnet AutoGen 0.4 HellowWorld sample (#3698) 2024-10-09 11:31:12 -07:00
global.json Merge dotnet conflict (#3) 2024-09-30 19:32:48 -04:00
spelling.dic Initial cross-language protocol for agents (#139) 2024-06-28 08:03:42 -07:00

README.md

AutoGen for .NET

Thre are two sets of packages here: Autogen.* the older packages derived from Autogen 0.2 for .NET - these will gradually be deprecated and ported into the new packages Microsoft.AutoGen.* the new packages for .NET that use the event-driven model - These APIs are not yet stable and are subject to change.

To get started with the new packages, please see the samples and in particular the Hello sample.

The remaining content is for the older Autogen.* packages.

dotnet-ci NuGet version

[!NOTE] Nightly build is available at:

Firstly, following the installation guide to install AutoGen packages.

Then you can start with the following code snippet to create a conversable agent and chat with it.

using AutoGen;
using AutoGen.OpenAI;

var openAIKey = Environment.GetEnvironmentVariable("OPENAI_API_KEY") ?? throw new Exception("Please set OPENAI_API_KEY environment variable.");
var gpt35Config = new OpenAIConfig(openAIKey, "gpt-3.5-turbo");

var assistantAgent = new AssistantAgent(
    name: "assistant",
    systemMessage: "You are an assistant that help user to do some tasks.",
    llmConfig: new ConversableAgentConfig
    {
        Temperature = 0,
        ConfigList = [gpt35Config],
    })
    .RegisterPrintMessage(); // register a hook to print message nicely to console

// set human input mode to ALWAYS so that user always provide input
var userProxyAgent = new UserProxyAgent(
    name: "user",
    humanInputMode: ConversableAgent.HumanInputMode.ALWAYS)
    .RegisterPrintMessage();

// start the conversation
await userProxyAgent.InitiateChatAsync(
    receiver: assistantAgent,
    message: "Hey assistant, please do me a favor.",
    maxRound: 10);

Samples

You can find more examples under the sample project.

Functionality

  • ConversableAgent

  • Agent communication

    • Two-agent chat
    • Group chat
  • Enhanced LLM Inferences

  • Exclusive for dotnet

    • Source generator for type-safe function definition generation