autogen/dotnet
Ryan Sweet b94abb2a6c
add default subscriptions for the agent type - Implicitly created sub… (#4324)
* add default subscriptions for the agent type - Implicitly created subscription for agent RPC #4321

* add default sub for agenttype+id

* fix subscription implementation for in memory runtime
---------

Co-authored-by: XiaoYun Zhang <xiaoyuz@microsoft.com>
2024-11-25 16:29:51 -08:00
..
.config Bring Dotnet AutoGen (#924) 2024-04-26 16:21:46 +00:00
.tools .NET enable artifact layout (#4271) 2024-11-19 13:54:57 -08:00
eng update (#4288) 2024-11-20 11:50:28 -08:00
nuget .NET add document on packaging && disable uploading artifacts folder to pipeline by default (#4299) 2024-11-21 09:53:23 -08:00
resource/images [.Net] Add Goolge gemini (#2868) 2024-06-10 17:31:45 +00:00
samples 4153 try to decouple abstractions package from orleans (#4355) 2024-11-25 13:37:35 -08:00
src add default subscriptions for the agent type - Implicitly created sub… (#4324) 2024-11-25 16:29:51 -08:00
test add default subscriptions for the agent type - Implicitly created sub… (#4324) 2024-11-25 16:29:51 -08:00
website Remove discord link (#4293) 2024-11-20 18:51:53 -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 add appsettings.Development.json to gitignore (#4303) 2024-11-21 19:31:13 -05:00
AutoGen.sln .NET renaming Microsoft.AutoGen.* package (#4286) 2024-11-20 11:15:21 -08:00
AutoGen.v3.ncrunchsolution ensure that cancellation token is passed in InvokeWithActivityAsync (#4329) 2024-11-25 00:32:56 +00:00
Directory.Build.props update (#4288) 2024-11-20 11:50:28 -08:00
Directory.Build.targets Add .editorconfig & use centralized package management 2024-06-19 16:53:37 -07:00
Directory.Packages.props first attempt (#4362) 2024-11-25 14:38:50 -08:00
NuGet.config [.Net] Fix #2660 and add tests for AutoGen.DotnetInteractive (#2676) 2024-05-14 03:40:26 +00:00
PACKAGING.md .NET add document on packaging && disable uploading artifacts folder to pipeline by default (#4299) 2024-11-21 09:53:23 -08:00
README.md .NET update nightly build feed to use AGPublic (#4284) 2024-11-20 17:08:46 -08:00
global.json .net changes to re-enable xlang support, add subscription apis (#4159) 2024-11-19 11:00:48 -08: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.

You can install both new and old packages from the following feeds:

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