Skip to content

Commit

Permalink
Merge branch 'main' into rysweet-4744-bring-over-the-tests-from-pr-4405
Browse files Browse the repository at this point in the history
  • Loading branch information
rysweet authored Jan 17, 2025
2 parents 6ae6067 + 6cb7d64 commit 84115cb
Show file tree
Hide file tree
Showing 56 changed files with 1,715 additions and 234 deletions.
59 changes: 39 additions & 20 deletions .azure/pipelines/templates/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,20 @@ jobs:
inputs:
useGlobalJson: true
workingDirectory: $(Build.SourcesDirectory)/dotnet
- task: PowerShell@2
displayName: 'Install uv'
inputs:
targetType: 'inline'
script: |
irm https://astral.sh/uv/install.ps1 | iex
$env:Path = "C:\Users\cloudtest\.local\bin;$env:Path"
uv --version
- task: Bash@3
displayName: Install .NET Aspire workload
inputs:
targetType: 'inline'
script: |
dotnet nuget locals all --clear
dotnet nuget locals all --clear
dotnet workload install aspire
- ${{ if eq(variables.runCodeQL3000, 'true') }}:
- task: CodeQL3000Init@0
Expand All @@ -106,6 +114,7 @@ jobs:
arguments: '$(build_flags) /bl:${{parameters.build_configuration}}-Build.binlog /p:Configuration=${{parameters.build_configuration}} $(solution)'
workingDirectory: $(Build.SourcesDirectory)/dotnet
env:
PATH: "C:\\Users\\cloudtest\\.local\\bin;$(PATH)"
${{ if and(eq(parameters.include_suffix, true), eq(parameters.publish_nuget, false)) }}:
VersionSuffix: ${{parameters.version_suffix}}
OfficialBuild: $(official_build)
Expand All @@ -125,16 +134,21 @@ jobs:
inputs:
SourceFolder: '$(build.sourcesdirectory)'
Contents: |
src/**/bin/${{parameters.build_configuration}}/**/AutoGen*.dll
src/**/bin/${{parameters.build_configuration}}/**/Microsoft.AutoGen.*.dll
**/bin/**/AutoGen*.dll
**/bin/**/Microsoft.AutoGen.*.dll
TargetFolder: '$(build.artifactstagingdirectory)\codesign'
CleanTargetFolder: true
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
displayName: 'Codesign: ESRP CodeSigning'
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@5
displayName: 'Codesign: ESRP CodeSigning (dlls)'
inputs:
ConnectedServiceName: 'CodeSign Service (NuGet)'
ConnectedServiceName: 'AI Frontiers ESRP'
AppRegistrationClientId: 'c1e7a5c0-ee6b-4cec-9e11-4dc3f4670042'
AppRegistrationTenantId: '975f013f-7f24-47e8-a7d3-abc4752bf346'
AuthAKVName: 'aif-autogen-esrp-kv'
AuthCertName: 'AIF-PME-InfrastructureAuth'
AuthSignCertName: 'AutoGenPublishESRPPKI' # this variable is only needed for codesign
FolderPath: '$(build.artifactstagingdirectory)\codesign'
Pattern: '*'
Pattern: '*.dll'
signConfigType: inlineSignParams
inlineOperation: |
[
Expand Down Expand Up @@ -163,15 +177,15 @@ jobs:
"parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
}
],
"toolName": "sign",
"toolVersion": "1.0"
},
{
"keyCode": "CP-230012",
"operationSetCode": "SigntoolVerify",
"parameters": [ ],
"toolName": "sign",
"toolVersion": "1.0"
"toolName": "sign",
"toolVersion": "1.0"
},
{
"keyCode": "CP-230012",
"operationSetCode": "SigntoolVerify",
"parameters": [ ],
"toolName": "sign",
"toolVersion": "1.0"
}
]
SessionTimeout: 180
Expand Down Expand Up @@ -200,11 +214,16 @@ jobs:
inputs:
packageType: runtime
version: $(codesign_runtime)
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@5
displayName: 'Codesign: ESRP CodeSigning (nuget)'
inputs:
ConnectedServiceName: 'CodeSign Service (NuGet)'
FolderPath: '$(build.sourcesdirectory)/Artifacts/${{parameters.build_configuration}}'
ConnectedServiceName: 'AI Frontiers ESRP'
AppRegistrationClientId: 'c1e7a5c0-ee6b-4cec-9e11-4dc3f4670042'
AppRegistrationTenantId: '975f013f-7f24-47e8-a7d3-abc4752bf346'
AuthAKVName: 'aif-autogen-esrp-kv'
AuthCertName: 'AIF-PME-InfrastructureAuth'
AuthSignCertName: 'AutoGenPublishESRPPKI' # this variable is only needed for codesign
FolderPath: '$(build.sourcesdirectory)/dotnet/artifacts/package/${{parameters.build_configuration}}'
Pattern: '*.nupkg'
signConfigType: inlineSignParams
inlineOperation: |
Expand All @@ -225,4 +244,4 @@ jobs:
}
]
SessionTimeout: 180
VerboseLogin: true
VerboseLogin: true
48 changes: 25 additions & 23 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ jobs:
- name: Run uv sync
run: |
uv sync --locked --all-extras
echo "PKG_NAME=$(basename '${{ matrix.package }}')" >> $GITHUB_ENV
working-directory: ./python
- name: Run task
Expand All @@ -140,8 +141,20 @@ jobs:
poe --directory ${{ matrix.package }} test
working-directory: ./python

- name: Move coverage file
run: |
mv ${{ matrix.package }}/coverage.xml coverage_${{ env.PKG_NAME }}.xml
working-directory: ./python

- name: Upload coverage artifact
uses: actions/upload-artifact@v4
with:
name: coverage-${{ env.PKG_NAME }}
path: ./python/coverage_${{ env.PKG_NAME }}.xml

codecov:
runs-on: ubuntu-latest
needs: [test]
strategy:
matrix:
package:
Expand All @@ -153,31 +166,20 @@ jobs:
]
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
with:
enable-cache: true
version: "0.5.18"
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Run uv sync
- name: Set up environment
run: |
uv sync --locked --all-extras
working-directory: ./python
- name: Run task
run: |
source ${{ github.workspace }}/python/.venv/bin/activate
poe --directory ${{ matrix.package }} coverage
working-directory: ./python
- name: Upload coverage
uses: codecov/codecov-action@v5
echo "PKG_NAME=$(basename '${{ matrix.package }}')" >> $GITHUB_ENV
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: coverage-${{ env.PKG_NAME }}
path: ./
- uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true # optional (default = false)
files: ${{ matrix.package }}/coverage.xml # optional
flags: unittests # optional
name: codecov-umbrella # optional
verbose: true # optional (default = false)
files: coverage_${{ env.PKG_NAME }}.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}

docs:
Expand Down
30 changes: 30 additions & 0 deletions docs/dotnet/user-guide/core-user-guide/defining-message-types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Defining Message Types

Messages are currently required to be Protocol Buffers. To define them, it is necessary to include the Protocol Buffers compiler, through the `Grpc.Tools` package. In your `.csproj` file, add/edit:

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

Then create an include a `.proto` file in the project:

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

Then 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 = "AgentsProtocol";
message TextMessage {
string Source = 1;
string Content = 2;
}
```
46 changes: 46 additions & 0 deletions docs/dotnet/user-guide/core-user-guide/differences-python.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Differences from Python

## Agents Self-Interact

When an agent sends a message of a type to which it also listens:

```csharp
[TopicSubscription("default")]
public class MyAgent(
IAgentWorker worker,
[FromKeyedServices("EventTypes")] EventTypes typeRegistry
) :
Agent(worker, typeRegistry),
IHandle<Message>
{
async Task SomeInternalFunctionAsync()
{
Message m;

// ...
await this.PublishMessageAsync(m);
}

public async Task Handle(Message message)
{
// will receive messages sent by SomeInternalFunctionAsync()
}
}
```

Tracked by [#4998](https://github.com/microsoft/autogen/issues/4998)

## 'Local' Runtime is Multithreaded

Unlike the `single_threaded_runtime`, the InProcess (`local: true`) runtime for .NET is multi-threaded, so messages will process in arbitrary order across agents. This means that an agent may process messages sent after the termination request has been made unless checking for termination using the `IHostApplicationLifecycle` service.

## No equivalent to 'stop_when_idle()'

Agents need to request termination explicitly, as there is no meaningful 'idle' state.

## All message types need to be Protocol Buffers

See (linkto: defining-message-types.md) for instructions on defining messages

Tracked by [#4695](https://github.com/microsoft/autogen/issues/4695)
Loading

0 comments on commit 84115cb

Please sign in to comment.