autogen/dotnet
Jack Gerrits bd5a24ba72
Start from just protos in core.grpc (#5243)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->

## Checks

- [ ] I've included any doc changes needed for
https://microsoft.github.io/autogen/. See
https://microsoft.github.io/autogen/docs/Contribute#documentation to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-01-28 17:44:50 -05: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 update debugType option 2025-01-28 09:24:16 -05:00
resource/images [.Net] Add Goolge gemini (#2868) 2024-06-10 17:31:45 +00:00
samples fix: Various fixes and cleanups to dotnet autogen core (#5242) 2025-01-28 17:13:36 -05:00
src Start from just protos in core.grpc (#5243) 2025-01-28 17:44:50 -05:00
test fix: Various fixes and cleanups to dotnet autogen core (#5242) 2025-01-28 17:13:36 -05:00
website fix: Various fixes and cleanups to dotnet autogen core (#5242) 2025-01-28 17:13:36 -05:00
.editorconfig Rysweet 5207 net runtime interface to match python add registration to interface and inmemoryruntime (#5215) 2025-01-27 09:44:39 -05: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 Start from just protos in core.grpc (#5243) 2025-01-28 17:44:50 -05: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 debugType option 2025-01-28 09:24:16 -05:00
Directory.Build.targets Add .editorconfig & use centralized package management 2024-06-19 16:53:37 -07:00
Directory.Packages.props rysweet-unsubscribe-and-agent-tests-4744 (#4920) 2025-01-24 19:24:00 -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 fix: Various fixes and cleanups to dotnet autogen core (#5242) 2025-01-28 17:13:36 -05: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