Skip to content

Commit

Permalink
Merge branch 'main' into component_config_imp_vd
Browse files Browse the repository at this point in the history
  • Loading branch information
victordibia authored Jan 27, 2025
2 parents 173b2b2 + 8428462 commit 44cbaf2
Show file tree
Hide file tree
Showing 41 changed files with 2,211 additions and 885 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -195,4 +195,7 @@ samples/apps/autogen-studio/autogenstudio/models/test/
notebook/coding

# dotnet artifacts
artifacts
artifacts

# project data
registry.json
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ AutoGen requires **Python 3.10 or later**.
pip install -U "autogen-agentchat" "autogen-ext[openai]"
```

The current stable version is v0.4. If you are upgrading from AutoGen v0.2, please refer to the [Migration Guide](https://microsoft.github.io/autogen/dev/user-guide/agentchat-user-guide/migration-guide.html) for detailed instructions on how to update your code and configurations.
The current stable version is v0.4. If you are upgrading from AutoGen v0.2, please refer to the [Migration Guide](https://microsoft.github.io/autogen/stable/user-guide/agentchat-user-guide/migration-guide.html) for detailed instructions on how to update your code and configurations.

```bash
# Install AutoGen Studio for no-code GUI
Expand All @@ -34,7 +34,7 @@ pip install -U "autogenstudio"

### Hello World

Create an assistant agent using OpenAI's GPT-4o model.
Create an assistant agent using OpenAI's GPT-4o model. See [other supported models](https://microsoft.github.io/autogen/stable/user-guide/agentchat-user-guide/tutorial/models.html).

```python
import asyncio
Expand Down Expand Up @@ -118,10 +118,10 @@ With AutoGen you get to join and contribute to a thriving ecosystem. We host wee

| | [![Python](https://img.shields.io/badge/AutoGen-Python-blue?logo=python&logoColor=white)](./python) | [![.NET](https://img.shields.io/badge/AutoGen-.NET-green?logo=.net&logoColor=white)](./dotnet) | [![Studio](https://img.shields.io/badge/AutoGen-Studio-purple?logo=visual-studio&logoColor=white)](./python/packages/autogen-studio) |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Installation | [![Installation](https://img.shields.io/badge/Install-blue)](https://microsoft.github.io/autogen/dev/user-guide/agentchat-user-guide/installation.html) | \* | [![Install](https://img.shields.io/badge/Install-purple)](https://microsoft.github.io/autogen/dev/user-guide/autogenstudio-user-guide/installation.html) |
| Quickstart | [![Quickstart](https://img.shields.io/badge/Quickstart-blue)](https://microsoft.github.io/autogen/dev/user-guide/agentchat-user-guide/quickstart.html#) | \* | [![Usage](https://img.shields.io/badge/Quickstart-blue)](https://microsoft.github.io/autogen/dev/user-guide/autogenstudio-user-guide/usage.html#) |
| Tutorial | [![Tutorial](https://img.shields.io/badge/Tutorial-blue)](https://microsoft.github.io/autogen/dev/user-guide/agentchat-user-guide/tutorial/models.html) | \* | [![Usage](https://img.shields.io/badge/Quickstart-blue)](https://microsoft.github.io/autogen/dev/user-guide/autogenstudio-user-guide/usage.html#) |
| API Reference | [![API](https://img.shields.io/badge/Docs-blue)](https://microsoft.github.io/autogen/dev/reference/index.html#) | \* | [![API](https://img.shields.io/badge/Docs-purple)](https://microsoft.github.io/autogen/dev/user-guide/autogenstudio-user-guide/usage.html) |
| Installation | [![Installation](https://img.shields.io/badge/Install-blue)](https://microsoft.github.io/autogen/stable/user-guide/agentchat-user-guide/installation.html) | \* | [![Install](https://img.shields.io/badge/Install-purple)](https://microsoft.github.io/autogen/stable/user-guide/autogenstudio-user-guide/installation.html) |
| Quickstart | [![Quickstart](https://img.shields.io/badge/Quickstart-blue)](https://microsoft.github.io/autogen/stable/user-guide/agentchat-user-guide/quickstart.html#) | \* | [![Usage](https://img.shields.io/badge/Quickstart-blue)](https://microsoft.github.io/autogen/stable/user-guide/autogenstudio-user-guide/usage.html#) |
| Tutorial | [![Tutorial](https://img.shields.io/badge/Tutorial-blue)](https://microsoft.github.io/autogen/stable/user-guide/agentchat-user-guide/tutorial/index.html) | \* | [![Usage](https://img.shields.io/badge/Quickstart-blue)](https://microsoft.github.io/autogen/stable/user-guide/autogenstudio-user-guide/usage.html#) |
| API Reference | [![API](https://img.shields.io/badge/Docs-blue)](https://microsoft.github.io/autogen/stable/reference/index.html#) | \* | [![API](https://img.shields.io/badge/Docs-purple)](https://microsoft.github.io/autogen/stable/user-guide/autogenstudio-user-guide/usage.html) |
| Packages | [![PyPi autogen-core](https://img.shields.io/badge/PyPi-autogen--core-blue?logo=pypi)](https://pypi.org/project/autogen-core/) <br> [![PyPi autogen-agentchat](https://img.shields.io/badge/PyPi-autogen--agentchat-blue?logo=pypi)](https://pypi.org/project/autogen-agentchat/) <br> [![PyPi autogen-ext](https://img.shields.io/badge/PyPi-autogen--ext-blue?logo=pypi)](https://pypi.org/project/autogen-ext/) | \* | [![PyPi autogenstudio](https://img.shields.io/badge/PyPi-autogenstudio-purple?logo=pypi)](https://pypi.org/project/autogenstudio/) |

</div>
Expand Down
4 changes: 4 additions & 0 deletions dotnet/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -701,3 +701,7 @@ generated_code = true

# IDE1591 Missing XML comment for publicly visible type or member
dotnet_diagnostic.CS1591.severity = none

[I*.cs]
# dont warn on missing accessibility modifiers for interfaces
dotnet_diagnostic.IDE0040.severity = none
2 changes: 1 addition & 1 deletion dotnet/samples/dev-team/DevTeam.Backend/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
.AddAgent<ProductManager>(nameof(ProductManager))
.AddAgent<DeveloperLead>(nameof(DeveloperLead));

builder.Services.AddSingleton<AgentWorker>();
builder.Services.AddSingleton<AgentRuntime>();
builder.Services.AddSingleton<WebhookEventProcessor, GithubWebHookProcessor>();
builder.Services.AddSingleton<GithubAuthService>();
builder.Services.AddSingleton<IManageAzure, AzureService>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public abstract class WebAPIAgent : IOAgent,
private readonly string _url = "/agents/webio";

public WebAPIAgent(
IAgentWorker worker,
IAgentRuntime worker,
[FromKeyedServices("AgentsMetadata")] AgentsMetadata typeRegistry,
ILogger<WebAPIAgent> logger,
string url = "/agents/webio") : base(
Expand Down
15 changes: 15 additions & 0 deletions dotnet/src/Microsoft.AutoGen/Contracts/AgentsRegistryState.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// AgentsRegistryState.cs
using System.Collections.Concurrent;

namespace Microsoft.AutoGen.Contracts;
public class AgentsRegistryState
{
public ConcurrentDictionary<string, HashSet<string>> AgentsToEventsMap { get; set; } = new ConcurrentDictionary<string, HashSet<string>>();
public ConcurrentDictionary<string, HashSet<string>> AgentsToTopicsMap { get; set; } = [];
public ConcurrentDictionary<string, HashSet<string>> TopicToAgentTypesMap { get; set; } = [];
public ConcurrentDictionary<string, HashSet<string>> EventsToAgentTypesMap { get; set; } = [];
public ConcurrentDictionary<string, HashSet<Subscription>> GuidSubscriptionsMap { get; set; } = [];
public ConcurrentDictionary<string, AgentId> AgentTypes { get; set; } = [];
public string Etag { get; set; } = Guid.NewGuid().ToString();
}
24 changes: 24 additions & 0 deletions dotnet/src/Microsoft.AutoGen/Contracts/IAgent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// IAgent.cs

using Google.Protobuf;

namespace Microsoft.AutoGen.Contracts;

public interface IAgent
{
AgentId AgentId { get; }
IAgentRuntime Worker { get; }
ValueTask<List<Subscription>> GetSubscriptionsAsync();
ValueTask<AddSubscriptionResponse> SubscribeAsync(string topic);
ValueTask<RemoveSubscriptionResponse> UnsubscribeAsync(Guid id);
ValueTask<RemoveSubscriptionResponse> UnsubscribeAsync(string topic);
Task StoreAsync(AgentState state, CancellationToken cancellationToken = default);
Task<T> ReadAsync<T>(AgentId agentId, CancellationToken cancellationToken = default) where T : IMessage, new();
ValueTask PublishMessageAsync(IMessage message, string topic, string source, string key, CancellationToken token = default);
ValueTask PublishMessageAsync<T>(T message, string topic, string source, CancellationToken token = default) where T : IMessage;
ValueTask PublishMessageAsync<T>(T message, string topic, CancellationToken token = default) where T : IMessage;
ValueTask PublishMessageAsync<T>(T message, CancellationToken token = default) where T : IMessage;
Task<RpcResponse> HandleRequestAsync(RpcRequest request);
Task HandleObjectAsync(object item, CancellationToken cancellationToken = default);
}
103 changes: 103 additions & 0 deletions dotnet/src/Microsoft.AutoGen/Contracts/IAgentRuntime.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// IAgentRuntime.cs

using Google.Protobuf;
namespace Microsoft.AutoGen.Contracts;

/// <summary>
/// Defines the common surface for agent runtime implementations.
/// </summary>
public interface IAgentRuntime
{
/// <summary>
/// Gets the dependency injection service provider for the runtime.
/// </summary>
IServiceProvider RuntimeServiceProvider { get; }

/// <summary>
/// Registers a new agent type asynchronously.
/// </summary>
/// <param name="request">The request containing the agent type details.</param>
/// <param name="cancellationToken">A token to cancel the operation.</param>
/// <returns>A task that represents the asynchronous operation.</returns>
ValueTask RegisterAgentTypeAsync(RegisterAgentTypeRequest request, CancellationToken cancellationToken = default);

/// <summary>
/// to be removed in favor of send_message
/// Sends a request to and agent.
/// </summary>
/// <param name="agent">The agent sending the request.</param>
/// <param name="request">The request to be sent.</param>
/// <param name="cancellationToken">A token to cancel the operation.</param>
/// <returns>A task that represents the asynchronous operation.</returns>
ValueTask RuntimeSendRequestAsync(IAgent agent, RpcRequest request, CancellationToken cancellationToken = default);

/// <summary>
/// Sends a response to the above request.
/// /// to be removed in favor of send_message
/// </summary>
/// <param name="response">The response to be sent.</param>
/// <param name="cancellationToken">A token to cancel the operation.</param>
/// <returns>A task that represents the asynchronous operation.</returns>
ValueTask RuntimeSendResponseAsync(RpcResponse response, CancellationToken cancellationToken = default);

/// <summary>
/// Sends a message directly to another agent.
/// </summary>
/// <param name="message">The message to be sent.</param>
/// <param name="recipient">The recipient of the message.</param>
/// <param name="sender">The agent sending the message.</param>
/// <param name="cancellationToken">A token to cancel the operation.</param>
/// <returns>A task that represents the response to th message.</returns>
ValueTask<RpcResponse> SendMessageAsync(IMessage message, AgentId recipient, AgentId? sender, CancellationToken? cancellationToken = default);

/// <summary>
/// Publishes a message to a topic.
/// </summary>
/// <param name="message">The message to be published.</param>
/// <param name="topic">The topic to publish the message to.</param>
/// <param name="sender">The agent sending the message.</param>
/// <param name="cancellationToken">A token to cancel the operation.</param>
/// <returns>A task that represents the asynchronous operation.</returns>
ValueTask PublishMessageAsync(IMessage message, TopicId topic, IAgent? sender, CancellationToken? cancellationToken = default);

/// <summary>
/// Saves the state of an agent asynchronously.
/// </summary>
/// <param name="value">The state to be saved.</param>
/// <param name="cancellationToken">A token to cancel the operation.</param>
/// <returns>A task that represents the asynchronous operation.</returns>
ValueTask SaveStateAsync(AgentState value, CancellationToken cancellationToken = default);

/// <summary>
/// Loads the state of an agent asynchronously.
/// </summary>
/// <param name="agentId">The ID of the agent whose state is to be loaded.</param>
/// <param name="cancellationToken">A token to cancel the operation.</param>
/// <returns>A task that represents the asynchronous operation, containing the agent state.</returns>
ValueTask<AgentState> LoadStateAsync(AgentId agentId, CancellationToken cancellationToken = default);

/// <summary>
/// Adds a subscription to a topic.
/// </summary>
/// <param name="request">The request containing the subscription types.</param>
/// <param name="cancellationToken">A token to cancel the operation.</param>
/// <returns>A task that represents the asynchronous operation, containing the response.</returns>
ValueTask<AddSubscriptionResponse> AddSubscriptionAsync(AddSubscriptionRequest request, CancellationToken cancellationToken = default);

/// <summary>
/// Removes a subscription.
/// </summary>
/// <param name="request">The request containing the subscription id.</param>
/// <param name="cancellationToken">A token to cancel the operation.</param>
/// <returns>A task that represents the asynchronous operation, containing the response.</returns>
ValueTask<RemoveSubscriptionResponse> RemoveSubscriptionAsync(RemoveSubscriptionRequest request, CancellationToken cancellationToken = default);

/// <summary>
/// Gets the list of subscriptions.
/// </summary>
/// <param name="request">The request containing the subscription query details.</param>
/// <param name="cancellationToken">A token to cancel the operation.</param>
/// <returns>A task that represents the asynchronous operation, containing the list of subscriptions.</returns>
ValueTask<List<Subscription>> GetSubscriptionsAsync(GetSubscriptionsRequest request, CancellationToken cancellationToken = default);
}
Loading

0 comments on commit 44cbaf2

Please sign in to comment.