Skip to content

A programming framework for agentic AI

add Use AutoGen.Net agent as model in AG Studio (#3182)

Olaoluwa Ademola Salamiadf438abfa32
diff --git a/dotnet/website/images/articles/UseAutoGenAsModelinAGStudio/FinalStepsA.png b/dotnet/website/images/articles/UseAutoGenAsModelinAGStudio/FinalStepsA.png
new file mode 100644
index 000000000..0403a8cf9
--- /dev/null
+++ b/dotnet/website/images/articles/UseAutoGenAsModelinAGStudio/FinalStepsA.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:491f8f538c55ce8768179cabfd3789c71c4a07b7d809f85deba9b8f4b759c00e
+size 42329
diff --git a/dotnet/website/images/articles/UseAutoGenAsModelinAGStudio/FinalStepsB.png b/dotnet/website/images/articles/UseAutoGenAsModelinAGStudio/FinalStepsB.png
new file mode 100644
index 000000000..03a68735c
--- /dev/null
+++ b/dotnet/website/images/articles/UseAutoGenAsModelinAGStudio/FinalStepsB.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:e319fad11682c46c3dc511e2fc63e033f3f99efb06d4530e7f72d1f4af23848f
+size 31528
diff --git a/dotnet/website/images/articles/UseAutoGenAsModelinAGStudio/FinalStepsC.png b/dotnet/website/images/articles/UseAutoGenAsModelinAGStudio/FinalStepsC.png
new file mode 100644
index 000000000..7326ad14d
--- /dev/null
+++ b/dotnet/website/images/articles/UseAutoGenAsModelinAGStudio/FinalStepsC.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:a8024b5336615e8c2c3497df7a5890a331bd5bdc7b15dd06abd7ec528ffe0932
+size 70169
diff --git a/dotnet/website/images/articles/UseAutoGenAsModelinAGStudio/Step5.2OpenAIModel.png b/dotnet/website/images/articles/UseAutoGenAsModelinAGStudio/Step5.2OpenAIModel.png
new file mode 100644
index 000000000..b2b7481bb
--- /dev/null
+++ b/dotnet/website/images/articles/UseAutoGenAsModelinAGStudio/Step5.2OpenAIModel.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:911f2f7c1ab4f9403386298d9769243c0aa8cc22c6f119342cc107a654d1463a
+size 44041
diff --git a/dotnet/website/images/articles/UseAutoGenAsModelinAGStudio/Step5.3ModelNameAndURL.png b/dotnet/website/images/articles/UseAutoGenAsModelinAGStudio/Step5.3ModelNameAndURL.png
new file mode 100644
index 000000000..d1c19f300
--- /dev/null
+++ b/dotnet/website/images/articles/UseAutoGenAsModelinAGStudio/Step5.3ModelNameAndURL.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:ec10a48ed3f0a6d8448e0ce425658f3857c2cf89e2badef8a8d3a8c3744fc3bf
+size 51944
diff --git a/dotnet/website/images/articles/UseAutoGenAsModelinAGStudio/Step6.png b/dotnet/website/images/articles/UseAutoGenAsModelinAGStudio/Step6.png
new file mode 100644
index 000000000..67c734454
--- /dev/null
+++ b/dotnet/website/images/articles/UseAutoGenAsModelinAGStudio/Step6.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:f016faea51f64af3970fde41ac95249c4e0423b02573f058c36dc1e6ba15562d
+size 50669
diff --git a/dotnet/website/images/articles/UseAutoGenAsModelinAGStudio/Step6b.png b/dotnet/website/images/articles/UseAutoGenAsModelinAGStudio/Step6b.png
new file mode 100644
index 000000000..ebd19bff0
--- /dev/null
+++ b/dotnet/website/images/articles/UseAutoGenAsModelinAGStudio/Step6b.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:4a23cbbf5d3d24eaf1da9370e0914f186815f2ecbf46131d2fd6eb5ff3264d96
+size 22569
diff --git a/dotnet/website/images/articles/UseAutoGenAsModelinAGStudio/Terminal.png b/dotnet/website/images/articles/UseAutoGenAsModelinAGStudio/Terminal.png
new file mode 100644
index 000000000..9edefc3ae
--- /dev/null
+++ b/dotnet/website/images/articles/UseAutoGenAsModelinAGStudio/Terminal.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:97328776c25fd0a61c76065db379406d8d3c96bd8773490c34c168cd7c69a855
+size 58527
diff --git a/dotnet/website/images/articles/UseAutoGenAsModelinAGStudio/TheModelTab.png b/dotnet/website/images/articles/UseAutoGenAsModelinAGStudio/TheModelTab.png
new file mode 100644
index 000000000..55e7bd862
--- /dev/null
+++ b/dotnet/website/images/articles/UseAutoGenAsModelinAGStudio/TheModelTab.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:1d7f4f3a772278e6de320a3601a76f8a9862cab4a9c0da03fad3058b86fcfaf7
+size 45260
diff --git a/dotnet/website/tutorial/Use-AutoGen.Net-agent-as-model-in-AG-Studio.md b/dotnet/website/tutorial/Use-AutoGen.Net-agent-as-model-in-AG-Studio.md
new file mode 100644
index 000000000..a47cb01f6
--- /dev/null
+++ b/dotnet/website/tutorial/Use-AutoGen.Net-agent-as-model-in-AG-Studio.md
@@ -0,0 +1,84 @@
+This tutorial shows how to use AutoGen.Net agent as model in AG Studio
+
+## Step 1. Create Dotnet empty web app and install AutoGen and AutoGen.WebAPI package
+
+```bash
+dotnet new web
+dotnet add package AutoGen
+dotnet add package AutoGen.WebAPI
+```
+
+## Step 2. Replace the Program.cs with following code
+
+```bash
+using AutoGen.Core;
+using AutoGen.Service;
+
+var builder = WebApplication.CreateBuilder(args);
+var app = builder.Build();
+
+var helloWorldAgent = new HelloWorldAgent();
+app.UseAgentAsOpenAIChatCompletionEndpoint(helloWorldAgent);
+
+app.Run();
+
+class HelloWorldAgent : IAgent
+{
+ public string Name => "HelloWorld";
+
+ public Task<IMessage> GenerateReplyAsync(IEnumerable<IMessage> messages, GenerateReplyOptions? options = null, CancellationToken cancellationToken = default)
+ {
+ return Task.FromResult<IMessage>(new TextMessage(Role.Assistant, "Hello World!", from: this.Name));
+ }
+}
+```
+
+## Step 3: Start the web app
+
+Run the following command to start web api
+
+```bash
+dotnet RUN
+```
+
+The web api will listen at `http://localhost:5264/v1/chat/completion
+
+![terminal](../images/articles/UseAutoGenAsModelinAGStudio/Terminal.png)
+
+## Step 4: In another terminal, start autogen-studio
+
+```bash
+autogenstudio ui
+```
+
+## Step 5: Navigate to AutoGen Studio UI and add hello world agent as openai Model
+
+### Step 5.1: Go to model tab
+
+![The Model Tab](../images/articles/UseAutoGenAsModelinAGStudio/TheModelTab.png)
+
+### Step 5.2: Select "OpenAI model" card
+
+![Open AI model Card](../images/articles/UseAutoGenAsModelinAGStudio/Step5.2OpenAIModel.png)
+
+### Step 5.3: Fill the model name and url
+
+The model name needs to be same with agent name
+
+![Fill the model name and url](../images/articles/UseAutoGenAsModelinAGStudio/Step5.3ModelNameAndURL.png)
+
+## Step 6: Create a hello world agent that uses the hello world model
+
+![Create a hello world agent that uses the hello world model](../images/articles/UseAutoGenAsModelinAGStudio/Step6.png)
+
+![Agent Configuration](../images/articles/UseAutoGenAsModelinAGStudio/Step6b.png)
+
+## Final Step: Use the hello world agent in workflow
+
+![Use the hello world agent in workflow](../images/articles/UseAutoGenAsModelinAGStudio/FinalStepsA.png)
+
+![Use the hello world agent in workflow](../images/articles/UseAutoGenAsModelinAGStudio/FinalStepsA.png)
+
+![Use the hello world agent in workflow](../images/articles/UseAutoGenAsModelinAGStudio/FinalStepsB.png)
+
+![Use the hello world agent in workflow](../images/articles/UseAutoGenAsModelinAGStudio/FinalStepsC.png)
diff --git a/dotnet/website/tutorial/toc.yml b/dotnet/website/tutorial/toc.yml
index f624ec4af..167baa70e 100644
--- a/dotnet/website/tutorial/toc.yml
+++ b/dotnet/website/tutorial/toc.yml
@@ -5,4 +5,7 @@
href: Image-chat-with-agent.md
- name: Create agent with tools
- href: Create-agent-with-tools.md
\ No newline at end of file
+ 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
\ No newline at end of file