Skip to content

Commit 84115cb

Browse files
authored
Merge branch 'main' into rysweet-4744-bring-over-the-tests-from-pr-4405
2 parents 6ae6067 + 6cb7d64 commit 84115cb

File tree

56 files changed

+1715
-234
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1715
-234
lines changed

.azure/pipelines/templates/build.yaml

+39-20
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,20 @@ jobs:
8484
inputs:
8585
useGlobalJson: true
8686
workingDirectory: $(Build.SourcesDirectory)/dotnet
87+
- task: PowerShell@2
88+
displayName: 'Install uv'
89+
inputs:
90+
targetType: 'inline'
91+
script: |
92+
irm https://astral.sh/uv/install.ps1 | iex
93+
$env:Path = "C:\Users\cloudtest\.local\bin;$env:Path"
94+
uv --version
8795
- task: Bash@3
8896
displayName: Install .NET Aspire workload
8997
inputs:
9098
targetType: 'inline'
9199
script: |
92-
dotnet nuget locals all --clear
100+
dotnet nuget locals all --clear
93101
dotnet workload install aspire
94102
- ${{ if eq(variables.runCodeQL3000, 'true') }}:
95103
- task: CodeQL3000Init@0
@@ -106,6 +114,7 @@ jobs:
106114
arguments: '$(build_flags) /bl:${{parameters.build_configuration}}-Build.binlog /p:Configuration=${{parameters.build_configuration}} $(solution)'
107115
workingDirectory: $(Build.SourcesDirectory)/dotnet
108116
env:
117+
PATH: "C:\\Users\\cloudtest\\.local\\bin;$(PATH)"
109118
${{ if and(eq(parameters.include_suffix, true), eq(parameters.publish_nuget, false)) }}:
110119
VersionSuffix: ${{parameters.version_suffix}}
111120
OfficialBuild: $(official_build)
@@ -125,16 +134,21 @@ jobs:
125134
inputs:
126135
SourceFolder: '$(build.sourcesdirectory)'
127136
Contents: |
128-
src/**/bin/${{parameters.build_configuration}}/**/AutoGen*.dll
129-
src/**/bin/${{parameters.build_configuration}}/**/Microsoft.AutoGen.*.dll
137+
**/bin/**/AutoGen*.dll
138+
**/bin/**/Microsoft.AutoGen.*.dll
130139
TargetFolder: '$(build.artifactstagingdirectory)\codesign'
131140
CleanTargetFolder: true
132-
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
133-
displayName: 'Codesign: ESRP CodeSigning'
141+
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@5
142+
displayName: 'Codesign: ESRP CodeSigning (dlls)'
134143
inputs:
135-
ConnectedServiceName: 'CodeSign Service (NuGet)'
144+
ConnectedServiceName: 'AI Frontiers ESRP'
145+
AppRegistrationClientId: 'c1e7a5c0-ee6b-4cec-9e11-4dc3f4670042'
146+
AppRegistrationTenantId: '975f013f-7f24-47e8-a7d3-abc4752bf346'
147+
AuthAKVName: 'aif-autogen-esrp-kv'
148+
AuthCertName: 'AIF-PME-InfrastructureAuth'
149+
AuthSignCertName: 'AutoGenPublishESRPPKI' # this variable is only needed for codesign
136150
FolderPath: '$(build.artifactstagingdirectory)\codesign'
137-
Pattern: '*'
151+
Pattern: '*.dll'
138152
signConfigType: inlineSignParams
139153
inlineOperation: |
140154
[
@@ -163,15 +177,15 @@ jobs:
163177
"parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
164178
}
165179
],
166-
"toolName": "sign",
167-
"toolVersion": "1.0"
168-
},
169-
{
170-
"keyCode": "CP-230012",
171-
"operationSetCode": "SigntoolVerify",
172-
"parameters": [ ],
173-
"toolName": "sign",
174-
"toolVersion": "1.0"
180+
"toolName": "sign",
181+
"toolVersion": "1.0"
182+
},
183+
{
184+
"keyCode": "CP-230012",
185+
"operationSetCode": "SigntoolVerify",
186+
"parameters": [ ],
187+
"toolName": "sign",
188+
"toolVersion": "1.0"
175189
}
176190
]
177191
SessionTimeout: 180
@@ -200,11 +214,16 @@ jobs:
200214
inputs:
201215
packageType: runtime
202216
version: $(codesign_runtime)
203-
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
217+
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@5
204218
displayName: 'Codesign: ESRP CodeSigning (nuget)'
205219
inputs:
206-
ConnectedServiceName: 'CodeSign Service (NuGet)'
207-
FolderPath: '$(build.sourcesdirectory)/Artifacts/${{parameters.build_configuration}}'
220+
ConnectedServiceName: 'AI Frontiers ESRP'
221+
AppRegistrationClientId: 'c1e7a5c0-ee6b-4cec-9e11-4dc3f4670042'
222+
AppRegistrationTenantId: '975f013f-7f24-47e8-a7d3-abc4752bf346'
223+
AuthAKVName: 'aif-autogen-esrp-kv'
224+
AuthCertName: 'AIF-PME-InfrastructureAuth'
225+
AuthSignCertName: 'AutoGenPublishESRPPKI' # this variable is only needed for codesign
226+
FolderPath: '$(build.sourcesdirectory)/dotnet/artifacts/package/${{parameters.build_configuration}}'
208227
Pattern: '*.nupkg'
209228
signConfigType: inlineSignParams
210229
inlineOperation: |
@@ -225,4 +244,4 @@ jobs:
225244
}
226245
]
227246
SessionTimeout: 180
228-
VerboseLogin: true
247+
VerboseLogin: true

.github/workflows/checks.yml

+25-23
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ jobs:
132132
- name: Run uv sync
133133
run: |
134134
uv sync --locked --all-extras
135+
echo "PKG_NAME=$(basename '${{ matrix.package }}')" >> $GITHUB_ENV
135136
136137
working-directory: ./python
137138
- name: Run task
@@ -140,8 +141,20 @@ jobs:
140141
poe --directory ${{ matrix.package }} test
141142
working-directory: ./python
142143

144+
- name: Move coverage file
145+
run: |
146+
mv ${{ matrix.package }}/coverage.xml coverage_${{ env.PKG_NAME }}.xml
147+
working-directory: ./python
148+
149+
- name: Upload coverage artifact
150+
uses: actions/upload-artifact@v4
151+
with:
152+
name: coverage-${{ env.PKG_NAME }}
153+
path: ./python/coverage_${{ env.PKG_NAME }}.xml
154+
143155
codecov:
144156
runs-on: ubuntu-latest
157+
needs: [test]
145158
strategy:
146159
matrix:
147160
package:
@@ -153,31 +166,20 @@ jobs:
153166
]
154167
steps:
155168
- uses: actions/checkout@v4
156-
- uses: astral-sh/setup-uv@v5
157-
with:
158-
enable-cache: true
159-
version: "0.5.18"
160-
- uses: actions/setup-python@v5
161-
with:
162-
python-version: "3.11"
163-
- name: Run uv sync
169+
- name: Set up environment
164170
run: |
165-
uv sync --locked --all-extras
166-
167-
working-directory: ./python
168-
- name: Run task
169-
run: |
170-
source ${{ github.workspace }}/python/.venv/bin/activate
171-
poe --directory ${{ matrix.package }} coverage
172-
working-directory: ./python
173-
- name: Upload coverage
174-
uses: codecov/codecov-action@v5
171+
echo "PKG_NAME=$(basename '${{ matrix.package }}')" >> $GITHUB_ENV
172+
- uses: actions/checkout@v4
173+
- uses: actions/download-artifact@v4
174+
with:
175+
name: coverage-${{ env.PKG_NAME }}
176+
path: ./
177+
- uses: codecov/codecov-action@v5
175178
with:
176-
fail_ci_if_error: true # optional (default = false)
177-
files: ${{ matrix.package }}/coverage.xml # optional
178-
flags: unittests # optional
179-
name: codecov-umbrella # optional
180-
verbose: true # optional (default = false)
179+
files: coverage_${{ env.PKG_NAME }}.xml
180+
flags: unittests
181+
name: codecov-umbrella
182+
fail_ci_if_error: true
181183
token: ${{ secrets.CODECOV_TOKEN }}
182184

183185
docs:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Defining Message Types
2+
3+
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:
4+
5+
```xml
6+
<PackageReference Include="Grpc.Tools" PrivateAssets="All" />
7+
```
8+
9+
Then create an include a `.proto` file in the project:
10+
11+
```xml
12+
<ItemGroup>
13+
<Protobuf Include="messages.proto" GrpcServices="Client;Server" Link="messages.proto" />
14+
</ItemGroup>
15+
```
16+
17+
Then define your messages as specified in the [Protocol Buffers Language Guide](https://protobuf.dev/programming-guides/proto3/)
18+
19+
```proto
20+
syntax = "proto3";
21+
22+
package HelloAgents;
23+
24+
option csharp_namespace = "AgentsProtocol";
25+
26+
message TextMessage {
27+
string Source = 1;
28+
string Content = 2;
29+
}
30+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Differences from Python
2+
3+
## Agents Self-Interact
4+
5+
When an agent sends a message of a type to which it also listens:
6+
7+
```csharp
8+
[TopicSubscription("default")]
9+
public class MyAgent(
10+
IAgentWorker worker,
11+
[FromKeyedServices("EventTypes")] EventTypes typeRegistry
12+
) :
13+
Agent(worker, typeRegistry),
14+
IHandle<Message>
15+
{
16+
async Task SomeInternalFunctionAsync()
17+
{
18+
Message m;
19+
20+
// ...
21+
22+
await this.PublishMessageAsync(m);
23+
}
24+
25+
public async Task Handle(Message message)
26+
{
27+
// will receive messages sent by SomeInternalFunctionAsync()
28+
}
29+
}
30+
```
31+
32+
Tracked by [#4998](https://github.com/microsoft/autogen/issues/4998)
33+
34+
## 'Local' Runtime is Multithreaded
35+
36+
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.
37+
38+
## No equivalent to 'stop_when_idle()'
39+
40+
Agents need to request termination explicitly, as there is no meaningful 'idle' state.
41+
42+
## All message types need to be Protocol Buffers
43+
44+
See (linkto: defining-message-types.md) for instructions on defining messages
45+
46+
Tracked by [#4695](https://github.com/microsoft/autogen/issues/4695)

0 commit comments

Comments
 (0)