autogen/dotnet
Xiaoyun Zhang 7abbdc8a6d
.NET update autogen 0.2.2 -> autogen 0.2.3 (#6257)
<!-- 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://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> 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-04-09 17:42:46 +00:00
..
.config pack agenthost as tool (#5647) 2025-02-24 14:23:45 -08:00
.tools .NET update global.json to use 9.0.100 (#5517) 2025-02-13 00:02:37 +00:00
eng .NET update autogen 0.2.2 -> autogen 0.2.3 (#6257) 2025-04-09 17:42:46 +00:00
nuget feat: Release pre-requisites for Microsoft.AutoGen.Core NuGet (#5270) 2025-01-30 17:08:39 -05:00
resource/images [.Net] Add Goolge gemini (#2868) 2024-06-10 17:31:45 +00:00
samples Dotnet: Add modelServiceId support to SemanticKernelAgent (#5422) 2025-02-25 20:39:45 +00:00
src .NET update oai and aoai package version (#6239) 2025-04-07 14:51:56 -07:00
test .NET update oai and aoai package version (#6239) 2025-04-07 14:51:56 -07: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 Improve e2e integration tests and isolate tests from other things; includes patch to Serializer (#5497) 2025-02-13 16:43:57 -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 feat: Release pre-requisites for Microsoft.AutoGen.Core NuGet (#5270) 2025-01-30 17:08:39 -05:00
Directory.Build.targets Add .editorconfig & use centralized package management 2024-06-19 16:53:37 -07:00
Directory.Packages.props .NET update oai and aoai package version (#6239) 2025-04-07 14:51:56 -07: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 update global.json to use 9.0.100 (#5517) 2025-02-13 00:02:37 +00: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