118 Commits

Author SHA1 Message Date
Xiaoyun Zhang
2230161447
.NET update oai and aoai package version (#6239)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->

## Checks

- [ ] I've included any doc changes needed for
<https://microsoft.github.io/autogen/>. See
<https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-04-07 14:51:56 -07:00
Jacob Alber
a2ab0e36d6
ci: Remove --locked from uv sync in Integration test project (#5993)
For some reason --locked is causing the CI to fall over in the codesign
pipeline.

Unclear why it is not happening on the GitHub Actions side - though it
may be an artifact of the way we have the uv cache set up (and the uv
install version does not match between the two). Getting to a building
state, then will investigate further.
2025-03-18 16:34:44 -04:00
Jacob Alber
41e7e85c40
fix: Improve PublishMessageAsync resilience (#5923)
During the recent fix to SendMessageAsync's recurrence, we added code to ensure blocking on Publish. This adds additional resilience to the Publish delivery, ensuring that every subscribed agent receives the message, regardless of errors in the middle.
2025-03-13 16:53:21 -04:00
Jacob Alber
52346fdb78
ci: Add missing Code Coverage assemblies to M.AG.* tests (#5925)
* Also adds --locked to the `uv sync` call in the Integration Tests project; this will hopefully reduce how much the uv.lock file is mangled during .NET development
2025-03-13 15:56:41 -04:00
Jacob Alber
cf1365763c
feat: Implement AgentChat.NET Termination Conditions (#5839)
Closes #5801
2025-03-13 12:41:13 -04:00
Griffin Bassman
8199a2c0a1
feat: [dotnet] open control channel for grpc save/load (#5489)
Co-authored-by: Ryan Sweet <rysweet@microsoft.com>
2025-03-12 15:18:32 -04:00
Jacob Alber
0a988b6393
fix: Recurrent SendMessageAsync deadlock in message handler (#5916)
In the .NET InProcessRuntime we tried to minimize the amount of tasks
created. Unfortunately, this results in a deadlock when a send message
handler is attempting to SendMessage during the handling of the incoming
message.

The fix is to create a new task for delivering the message in the
message processing loop, which creates a new logical stack to run the
delivery, freeing the loop to process the next delivery request.

* Also fixes passing exceptions and cancellations back to the waiting
task.
* Also fixes a build slowdown on Windows due to uv and llama-cpp

Closes #5915
2025-03-12 14:58:07 -04:00
Jacob Alber
b4c1e5841f
feat: Save/Load for AgentChat.NET (#5841)
Partially addresses #5800, others pending the Agents PR #5837 and GroupChats PR #5838 coming in to have the classes to attach save/load logic to.
2025-03-11 12:35:03 -04:00
Jacob Alber
05b14f197a
feat: Enable Reset in AgentChat.NET (#5855)
Factors out RunContext management into separate classes:
* Defines a LifecycleObject abstraction to manage initialization /
deinitialization
* Defines RunContextStack to enable a stack of init/deinit layers
* Defines a RunManager to own ensuring proper semantics for performing a
"single execution at a time" call while enabling a polymorphic base.

Implements Reset

Closes #5799
Unblocks #5800 (needs RunContext refactor too)
2025-03-06 16:32:29 -08:00
cedricmendelin
b37c192424
Dotnet: Add modelServiceId support to SemanticKernelAgent (#5422)
The `SemanticKernelAgent` class has been updated to include an optional
`modelServiceId` parameter, allowing the specification of a service ID
for the model.

## Why are these changes needed?

Currently, `SemanticKernelAgent` uses the parameterless method for
resolving `IChatCompletionSerivce`. This will fail, when multiple models
are registered in the Kernel.

To support different models registered in the Kernel, I adopted the
resolving of the `IChatCompletionSerivce` within the
`SemanticKernelAgent` with an optional parameter. When it is not set, I
resolve the default instance, otherwise, I use the optional parameter as
a servide id for resolving the `IChatCompletionSerivce` service.

## Related issue number



## Checks

- [x] I've included any doc changes needed for
https://microsoft.github.io/autogen/. See
https://microsoft.github.io/autogen/docs/Contribute#documentation to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.

---------

Co-authored-by: Ryan Sweet <rysweet@microsoft.com>
Co-authored-by: Xiaoyun Zhang <bigmiao.zhang@gmail.com>
2025-02-25 20:39:45 +00:00
Jack Gerrits
181925c95d
[dotnet] Add mixin for easier state save/load apis (#5438)
Co-authored-by: Ryan Sweet <rysweet@microsoft.com>
2025-02-24 16:24:30 +00:00
Ryan Sweet
3a239c5336
message registry buffer size limit #5582 (#5603) 2025-02-21 09:23:21 -08:00
Ryan Sweet
acd7e86430
add a buffer to message delivery so that clients wh subscribe within a window can receive (#5543)
sometimes a client will subscribe but the message it was hoping for is
already published and delivered to one of its peers but it missed it.
this adds a five second (default) buffer and will deliver buffered
messages to new subscribers. messages are removed from the buffer after
5 seconds

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-02-14 07:42:18 -08:00
Ryan Sweet
ff7f863e73
Improve e2e integration tests and isolate tests from other things; includes patch to Serializer (#5497)
* integration tests used to use the samples - now they are separate
* patch dictionary problem in serializer
* add Message Registry with dead letter queue that gets checked on new
subs.
2025-02-13 16:43:57 -08:00
Ryan Sweet
eb80286adf
remove noisy logging (#5446)
the uv sync logging in the test build was really noisy - no longer
needed
## Why are these changes needed?


## Related issue number


## Checks

- [ ] I've included any doc changes needed for
https://microsoft.github.io/autogen/. See
https://microsoft.github.io/autogen/docs/Contribute#documentation to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-02-13 00:57:03 +00:00
Xiaoyun Zhang
7f0acd78a8
.NET update global.json to use 9.0.100 (#5517)
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->

## Checks

- [ ] I've included any doc changes needed for
https://microsoft.github.io/autogen/. See
https://microsoft.github.io/autogen/docs/Contribute#documentation to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-02-13 00:02:37 +00:00
Jacob Alber
392aa14491
fix: Add deferral to RegisterAgentType and (Add/Remove)Subscription (#5494)
Unlike with the InProcessRuntime, there is a two-phase initialization,
first when AgentsApp is built (when initial agents are registered) and
when it StartAsync()s and connects to the Gateway. Unfortunately, it is
possible to attempt to send direct RPC calls to the Gateway before the
message channel is opened; in this case, the Gateway has no connected
client corresponding to the RPC's clientId, and falls over.

The fix is to defer registering agents and subscriptions with the
gateway until after the connection is established after .StartAsync() is
called.
2025-02-11 16:03:02 -05:00
Ryan Sweet
edbd20167b
bring back grpc service (#5377)
Restoring the grpc + Orleans server into the project

## Why are these changes needed?

This is the distributed agent runtime for .NET that can manage routing
messages amongst a fleet of grpc agent runtimes.

## Related issue number

## Checks

- [ ] I've included any doc changes needed for
https://microsoft.github.io/autogen/. See
https://microsoft.github.io/autogen/docs/Contribute#documentation to
build and test documentation locally.
- [x] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.

---------

Co-authored-by: Jack Gerrits <jack@jackgerrits.com>
Co-authored-by: Jacob Alber <jaalber@microsoft.com>
2025-02-07 19:28:55 -05:00
Jacob Alber
9f1c4c924f
.NET AgentChat Part 1: Abstractions, Base Classes, RoundRobin (#5434)
Stands up an initial implementation of the AgentChat project, including abstractions, base classes, and the `RoundRobinGroupChat` implementation.
2025-02-07 17:57:08 -05:00
Jack Gerrits
362d6a4e6b
Use a root json element instead of dict (#5430) 2025-02-07 11:52:37 -05:00
Griffin Bassman
c8e4ad8242
feat: save/load test for dotnet agents (#5284) 2025-02-06 17:09:26 -05:00
Jack Gerrits
25f26a338b
Updates to proto for state apis (#5407) 2025-02-06 16:54:21 -05:00
Griffin Bassman
da6f918708
feat: add dotnet code coverage (#5403) 2025-02-06 14:30:15 -05:00
Griffin Bassman
442df18397
feat: dotnet runtime tests (#5342) 2025-02-05 13:02:43 -05:00
Jack Gerrits
08f9830bf7
Dotnet Grpc worker implementation (#5245)
Co-authored-by: Jacob Alber <jaalber@microsoft.com>
Co-authored-by: Ryan Sweet <rysweet@microsoft.com>
2025-02-05 08:34:02 -08:00
Griffin Bassman
9af6883fbe
fix: dotnet test CI and standardize test categories (#5286)
Co-authored-by: Ryan Sweet <rysweet@microsoft.com>
2025-02-03 11:49:08 -05:00
Jacob Alber
465a97472d
feat: Release pre-requisites for Microsoft.AutoGen.Core NuGet (#5270)
This is in preparation for releasing the Microsoft.AutoGen.Core NuGet
package.

* Moves IHandle<> to Microsoft.AutoGen.Contracts
* Makes KVStringParseHelper internal

* Updates versions of certain dependencies
* Updates NuGet package properties

* Enables deterministic build
* Enables ContinuousIntegrationBuild in CI
2025-01-30 17:08:39 -05:00
Griffin Bassman
994c8660df
fix: add unit tests for dotnet and improve test infrastructure (#5269) 2025-01-30 16:53:42 -05:00
Griffin Bassman
fca1de9279
feat: dotnet AgentId and MetaData tests (#5271) 2025-01-30 15:02:44 -05:00
Griffin Bassman
850377c74a
fix: Various fixes and cleanups to dotnet autogen core (#5242)
Co-authored-by: Jack Gerrits <jack@jackgerrits.com>
Co-authored-by: Ryan Sweet <rysweet@microsoft.com>
2025-01-28 17:13:36 -05:00
Jacob Alber
43e9c266c1
feat: Enable queueing and step mode in InProcessRuntime (#5239)
Moves the semantics of message delivery in .NET to be closer to Python
(up to vagaries of differences in Threading)

* Creates a message delivery queue in InProcessRuntime
* Creates Start/Stop/WaitForIdle APIs on InProcessRuntime
* Creates API to step individual messages
* Updates InProcessRuntime to play well with IHost as an IHostedService
2025-01-28 20:28:05 +00:00
Jack Gerrits
caa33124bf remove unported things from the solution
formatting
2025-01-28 09:24:16 -05:00
Jacob Alber
d9e0013975 feat: Implement mechanism to abstract over IHandle implementations 2025-01-28 09:24:16 -05:00
Jack Gerrits
d48b54fcaf rename Handle to HandleAsync 2025-01-28 09:24:16 -05:00
Jack Gerrits
0b850fdbdb add unsub test 2025-01-28 09:24:16 -05:00
Jack Gerrits
e15b449c16 fix test agent 2025-01-28 09:24:16 -05:00
Jack Gerrits
b16b94feb8 WIP, moved to base namespace 2025-01-28 09:24:16 -05:00
Jack Gerrits
b19374e81d first tests 2025-01-28 09:24:16 -05:00
Jacob Alber
537277554e test: Add test for topic-based delivery 2025-01-28 09:24:16 -05:00
Ryan Sweet
92941c6d70
Rysweet 5217 add send message (#5219)
this is work to align dotnet autogen with python

## Why are these changes needed?

bringing alignment between the projects

## Related issue number

close #5217 

## Checks

- [ ] I've included any doc changes needed for
https://microsoft.github.io/autogen/. See
https://microsoft.github.io/autogen/docs/Contribute#documentation to
build and test documentation locally.
- [x ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
2025-01-27 10:14:07 -05:00
Ryan Sweet
0aed066728
Rysweet 5207 net runtime interface to match python add registration to interface and inmemoryruntime (#5215)
* add Registry abstractions and Registry Storage to Core/Contracts
* brings Grpc in line with these abstractions
* add registeragenttype to in memory runtime. Note it's not necessary to
call this because we register all the agents with reflection unless you
tell the runtime not to.....

## Why are these changes needed?

Bringing the .NET more in line with the python

## Related issue number

close #5207 

## Checks

- [] I've included any doc changes needed for
https://microsoft.github.io/autogen/. See
https://microsoft.github.io/autogen/docs/Contribute#documentation to
build and test documentation locally.
- [x ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [x] I've made sure all auto checks have passed.

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-01-27 09:44:39 -05:00
Ryan Sweet
10e40b5a1f
Rysweet 5201 refactor runtime interface (#5204)
Changes to align the .NET code more with the python codebase. 
* rename *Worker to *Runtime
* refactor shared runtime elements to AgentRuntimeBase
* align runtime interface with python

## Why are these changes needed?

Aligning the .NET with the python code and then we can evolve together
from there.

## Related issue number

Closes #5201
2025-01-26 08:09:59 -08:00
Ryan Sweet
b6597fdd24
rysweet-unsubscribe-and-agent-tests-4744 (#4920)
* add tests for core functionality and client/server
* add remove subscription, get subscriptions
* fix LOTS of bugs
* add grpc tuning
* adapt to latest agreed agents_worker proto changes.
2025-01-24 19:24:00 -08:00
Ryan Sweet
c1646f21c0
Rysweet 4676 remove iagentruntime - collapse into iagentworker (#4740)
* moves AgentId into Agent
* Renames AgentRuntime to AgentMessenger (more accurate name)
* Remove IAgentRuntime Interface
* changes constructor of Agent to take IAgentWorker instead of IAgentRuntime
2024-12-17 13:04:37 -08:00
Ryan Sweet
a19c848622
rysweet-4677-rename-agents-project-to-core-trim-dependencies (#4696)
* move optional base agents to separate package
* rename main sdk to Core
* reduce dependency graph
Co-authored-by: @rysweet 
Authored-by: @kostapetan 
Co-authored-by: @kopetan-ms
2024-12-13 11:55:43 -08:00
Ryan Sweet
cdd84acd05
Rysweet 4688 core doesnt use orleans (#4689)
* removes core reps on Orleans
Co-Autohored-by: @kostapetan
2024-12-13 10:32:17 -08:00
Ryan Sweet
c169df8b7b
Rysweet 4679 move grpc to runtimegrpc project (#4680)
* refactor moving grpc runtime to a separate project
2024-12-13 09:29:57 -08:00
Ryan Sweet
55e157cb99
Rysweet refactor 4670 rename abstractions to contracts (#4674)
* refactor renaming agent base

* 1st draft

* 1st draft

* format

* rename the tsts

* move IagentWorker

* 1st draft

* format

* gen-proto

* run gen-proto-samples

* format

* merge problem format
2024-12-12 19:43:26 -08:00
Ryan Sweet
c9ebe32bd7
refactor renaming agent base - 4667 (#4669)
* refactor renaming agent base

* rename the files

* Update dotnet/src/Microsoft.AutoGen/Agents/Services/HostBuilderExtensions.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* update the tests

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2024-12-12 21:43:57 +01:00
Ryan Sweet
7d01bc6136
adds integration test for the InMemoryRuntime (#4659)
* adds integration test for the InMemoryRuntime

* format

* expand timeout for in memory runtime tests
2024-12-11 12:59:02 -08:00