Skip to content

Commit

Permalink
Merge branch 'refs/heads/main' into agentic_memory
Browse files Browse the repository at this point in the history
# Conflicts:
#	python/uv.lock
  • Loading branch information
rickyloynd-microsoft committed Feb 3, 2025
2 parents 2eb817e + e8f49ef commit 95b1276
Show file tree
Hide file tree
Showing 289 changed files with 6,233 additions and 16,666 deletions.
8 changes: 0 additions & 8 deletions .azure/pipelines/build.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
trigger:
branches:
include:
- main
paths:
include:
- dotnet

schedules:
- cron: "0 0 * * *"
displayName: 'Daily midnight build (including CodeQL)'
Expand Down
5 changes: 3 additions & 2 deletions .azure/pipelines/templates/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ jobs:
allowPackageConflicts: true
steps:
- checkout: self
lfs: true
- task: UseDotNet@2
displayName: 'Use .NET Core sdk'
inputs:
Expand Down Expand Up @@ -111,7 +112,7 @@ jobs:
displayName: Build
inputs:
command: build
arguments: '$(build_flags) /bl:${{parameters.build_configuration}}-Build.binlog /p:Configuration=${{parameters.build_configuration}} $(solution)'
arguments: '$(build_flags) /bl:${{parameters.build_configuration}}-Build.binlog /p:Configuration=${{parameters.build_configuration}} /p:ContinuousIntegrationBuild=true $(solution)'
workingDirectory: $(Build.SourcesDirectory)/dotnet
env:
PATH: "C:\\Users\\cloudtest\\.local\\bin;$(PATH)"
Expand Down Expand Up @@ -201,7 +202,7 @@ jobs:
- task: CmdLine@2
displayName: Pack
inputs:
script: 'dotnet pack --no-build --no-restore $(build_flags) /bl:${{parameters.build_configuration}}-Pack.binlog /p:Configuration=${{parameters.build_configuration}} $(solution)'
script: 'dotnet pack --no-build --no-restore $(build_flags) /bl:${{parameters.build_configuration}}-Pack.binlog /p:Configuration=${{parameters.build_configuration}} /p:ContinuousIntegrationBuild=true $(solution)'
workingDirectory: $(Build.SourcesDirectory)/dotnet
env:
${{ if and(eq(parameters.include_suffix, true), eq(parameters.publish_nuget, false)) }}:
Expand Down
3 changes: 0 additions & 3 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,7 @@ makefile text eol=lf
*.png filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text
*.jpeg filter=lfs diff=lfs merge=lfs -text
python/packages/autogen-magentic-one/imgs/autogen-magentic-one-example.png filter=lfs diff=lfs merge=lfs -text
python/packages/autogen-magentic-one/imgs/autogen-magentic-one-agents.png filter=lfs diff=lfs merge=lfs -text

python/packages/autogen-magentic-one/tests/browser_utils/test_files/test_blog.html linguist-vendored
python/packages/autogen-ext/src/autogen_ext/runtimes/grpc/protos/*.py linguist-generated
python/packages/autogen-ext/src/autogen_ext/runtimes/grpc/protos/*.pyi linguist-generated
python/packages/autogen-ext/tests/protos/*.py linguist-generated
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ jobs:
package:
[
"./packages/autogen-core",
"./packages/autogen-magentic-one",
"./packages/agbench",
"./packages/autogen-ext",
"./packages/autogen-agentchat",
Expand Down Expand Up @@ -86,7 +85,6 @@ jobs:
package:
[
"./packages/autogen-core",
"./packages/autogen-magentic-one",
"./packages/agbench",
"./packages/autogen-ext",
"./packages/autogen-agentchat",
Expand Down Expand Up @@ -116,7 +114,6 @@ jobs:
package:
[
"./packages/autogen-core",
"./packages/autogen-magentic-one",
"./packages/autogen-ext",
"./packages/autogen-agentchat",
]
Expand Down Expand Up @@ -160,7 +157,6 @@ jobs:
package:
[
"./packages/autogen-core",
"./packages/autogen-magentic-one",
"./packages/autogen-ext",
"./packages/autogen-agentchat",
]
Expand Down
56 changes: 54 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
[
# For main use the workflow target
{ ref: "${{github.ref}}", dest-dir: dev, uv-version: "0.5.13", sphinx-release-override: "dev" },
{ ref: "v0.4.4", dest-dir: stable, uv-version: "0.5.13", sphinx-release-override: "stable" },
{ ref: "python-v0.4.5", dest-dir: stable, uv-version: "0.5.13", sphinx-release-override: "stable" },
{ ref: "v0.4.0.dev0", dest-dir: "0.4.0.dev0", uv-version: "0.5.11", sphinx-release-override: "" },
{ ref: "v0.4.0.dev1", dest-dir: "0.4.0.dev1", uv-version: "0.5.11", sphinx-release-override: "" },
{ ref: "v0.4.0.dev2", dest-dir: "0.4.0.dev2", uv-version: "0.5.11", sphinx-release-override: "" },
Expand All @@ -53,6 +53,7 @@ jobs:
{ ref: "v0.4.2", dest-dir: "0.4.2", uv-version: "0.5.13", sphinx-release-override: "" },
{ ref: "v0.4.3", dest-dir: "0.4.3", uv-version: "0.5.13", sphinx-release-override: "" },
{ ref: "v0.4.4", dest-dir: "0.4.4", uv-version: "0.5.13", sphinx-release-override: "" },
{ ref: "python-v0.4.5", dest-dir: "0.4.5", uv-version: "0.5.13", sphinx-release-override: "" },
]
steps:
- name: Checkout
Expand Down Expand Up @@ -185,12 +186,63 @@ jobs:
path: "website/artifact"
name: "02-docs"

build-04-dotnet:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
lfs: true
- name: Setup .NET 8.0
uses: actions/setup-dotnet@v4
with:
global-json-file: dotnet/global.json
- run: dotnet tool update -g docfx
- run: |
docfx docs/dotnet/docfx.json
mkdir -p build/dotnet/
mv docs/dotnet/_site build/dotnet/dev
- name: insert clarity snippet to *.html
working-directory: build/dotnet/dev/
shell: python
run: |
import os
clarity_script = """
<script type="text/javascript">
(function(c,l,a,r,i,t,y){
c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
})(window, document, "clarity", "script", "lnxpe6skj1");
</script>
"""
site_folder = '.'
for root, dirs, files in os.walk(site_folder):
for file in files:
if file.endswith('.html'):
html_path = os.path.join(root, file)
# insert the script into the html's head section
with open(html_path, 'r') as file:
html = file.read()
html = html.replace('</head>', clarity_script + '</head>')
with open(html_path, 'w') as file:
file.write(html)
print(f'Clarity script inserted into {html_path}')
- uses: actions/upload-artifact@v4
with:
path: "build/"
name: "dotnet-dev-docs"

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: [build-02, build-04, gen-redirects, gen-component-schema]
needs: [build-02, build-04, build-04-dotnet, gen-redirects, gen-component-schema]
if: ${{ needs.build-02.result == 'success' && needs.build-04.result == 'success' && needs.gen-redirects.result == 'success' && github.ref == 'refs/heads/main' }}
steps:
- uses: actions/download-artifact@v4
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/dotnet-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,10 @@ jobs:
run: |
echo "Build AutoGen"
dotnet build --no-restore --configuration Release -bl /p:SignAssembly=true
- name: Unit Test
run: dotnet test --no-build -bl --configuration Release --filter type=!integration
- name: Unit Test V1
run: dotnet test --no-build -bl --configuration Release --filter "Category=UnitV1"
- name: Unit Test V2
run: dotnet test --no-build -bl --configuration Release --filter "Category=UnitV2"

integration-test:
strategy:
Expand Down Expand Up @@ -155,7 +157,7 @@ jobs:
echo "Build AutoGen"
dotnet build --no-restore --configuration Release -bl /p:SignAssembly=true
- name: Integration Test
run: dotnet --version && dotnet test --no-build -bl --configuration Release --filter type=integration
run: dotnet --version && dotnet test --no-build -bl --configuration Release --filter "Category=Integration"
- name: Restore the global.json
run: rm global.json && git checkout -- global.json

Expand Down
1 change: 0 additions & 1 deletion .github/workflows/single-python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ on:
- autogen-core
- autogen-ext
- agbench
- autogen-magentic-one
- autogen-studio
- magentic-one-cli
ref:
Expand Down
12 changes: 12 additions & 0 deletions docs/dotnet/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
###############
# folder #
###############
/**/DROP/
/**/TEMP/
/**/packages/
/**/bin/
/**/obj/

# build artifacts for web
_site/
api/
13 changes: 13 additions & 0 deletions docs/dotnet/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## How to build and run the website

### Prerequisites
- dotnet 7.0 or later

### Build
Firstly, go to autogen/dotnet folder and run the following command to build the website:
```bash
dotnet tool restore
dotnet tool run docfx website/docfx.json --serve
```

After the command is executed, you can open your browser and navigate to `http://localhost:8080` to view the website.
8 changes: 8 additions & 0 deletions docs/dotnet/core/differences-from-python.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Differences from Python

## Publishing to a topic that an agent is also subscribed to

> [!NOTE]
> TLDR; Default behavior is identical.
When an agent publishes a message to a topic to which it also listens, the message will not be received by the agent that sent it. This is also the behavior in the Python runtime. However to support previous usage, in @Microsoft.AutoGen.Core.InProcessRuntime, you can set the @Microsoft.AutoGen.Core.InProcessRuntime.DeliverToSelf property to true in the TopicSubscription attribute to allow an agent to receive messages it sends.
7 changes: 7 additions & 0 deletions docs/dotnet/core/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# AutoGen Core

AutoGen Core for .NET follows the same concepts and conventions of its Python counterpart. In fact, in order to understand the concepts in the .NET version, we recommend reading the Python documentation first. Unless otherwise stated, the concepts in the Python version map to .NET.

Any important differences between the language versions are documented in the [Differences from Python](./differences-from-python.md) section. For things that only affect a given language, such as dependency injection or host builder patterns, these will not be specified in the differences document.

For .NET we are starting with the core functionality and will be expanding support progressively. So far the core abstractions of Agent and Runtime are available. The InProcessRuntime is the only runtime available at this time. We will be expanding to cross language support in upcoming releases.
22 changes: 22 additions & 0 deletions docs/dotnet/core/installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Installation

Install via `.NET cli`

```sh
dotnet add package Microsoft.AutoGen.Contracts --version 0.4.0-dev.1
dotnet add package Microsoft.AutoGen.Core --version 0.4.0-dev.1
```

Or, install via `Package Manager`

```pwsh
PM> NuGet\Install-Package Microsoft.AutoGen.Contracts -Version 0.4.0-dev.1
PM> NuGet\Install-Package Microsoft.AutoGen.Core -Version 0.4.0-dev.1
```

Or, add via `<PackageReference>`

```xml
<PackageReference Include="Microsoft.AutoGen.Contracts" Version="0.4.0-dev.1" />
<PackageReference Include="Microsoft.AutoGen.Core" Version="0.4.0-dev.1" />
```
58 changes: 58 additions & 0 deletions docs/dotnet/core/protobuf-message-types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Using Protocol Buffers to Define Message Types

For a message to be sent using a runtime other than the @Microsoft.AutoGen.Core.InProcessRuntime, it must be defined as a Protocol Buffers message. This is because the message is serialized and deserialized using Protocol Buffers. This requirement may be relaxed in future by allowing for converters, custom serialization, or other mechanisms.

## How to include Protocol Buffers in a .NET project

The .proto file which defines the message types must be included in the project, which will automatically generate the C# classes for the messages.

1. Include `Grpc.Tools` package in your `.csproj` file:

```xml
<PackageReference Include="Grpc.Tools" PrivateAssets="All" />
```

2. Create an include a `.proto` file in the project:

```xml
<ItemGroup>
<Protobuf Include="messages.proto" GrpcServices="Client;Server" Link="messages.proto" />
</ItemGroup>
```

3. define your messages as specified in the [Protocol Buffers Language Guide](https://protobuf.dev/programming-guides/proto3/)

```proto
syntax = "proto3";
package HelloAgents;
option csharp_namespace = "MyAgentsProtocol";
message TextMessage {
string Source = 1;
string Content = 2;
}
```

4. Code against the generated class for handling, sending and publishing messages:

```csharp
using Microsoft.AutoGen.Contracts;
using Microsoft.AutoGen.Core;
using MyAgentsProtocol;

[TypeSubscription("default")]
public class Checker(
AgentId id,
IAgentRuntime runtime,
) :
BaseAgent(id, runtime, "MyAgent", null),
IHandle<TextMessage>
{
public async ValueTask HandleAsync(TextMessage item, MessageContext messageContext)
{
Console.WriteLine($"Received message from {item.Source}: {item.Content}");
}
}
```
10 changes: 10 additions & 0 deletions docs/dotnet/core/toc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
- name: Overview
href: index.md
- name: Installation
href: installation.md
- name: Tutorial
href: tutorial.md
- name: Differences from Python
href: differences-from-python.md
- name: Protobuf message types
href: protobuf-message-types.md
Loading

0 comments on commit 95b1276

Please sign in to comment.