Commit Graph

279 Commits

Author SHA1 Message Date
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
Ryan Sweet 78adf32f7d
pack agenthost as tool (#5647)
<!-- 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?

convenience - allows to just run "agenthost"

```
dotnet pack --no-build --configuration Release --output './output/release' -bl\n
dotnet tool install --add-source ./output/release Microsoft.AutoGen.AgentHost
agenthost 
```

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

## Related issue number

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

closes #5646 

## 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-02-24 14:23:45 -08: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 213da855ec
remove dep on aspire - add google.protobuf (#5645)
<!-- 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. -->

removes unneeded deps

## Related issue number

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

Closes #5644

## 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-02-24 16:02:49 +00:00
Ryan Sweet 3a239c5336
message registry buffer size limit #5582 (#5603) 2025-02-21 09:23:21 -08:00
Ryan Sweet 9a10427a7d
bugfix exception issue 5580 (#5581)
## Why are these changes needed?

fixing intermittent bug #5580 

was using the wrong scheduler. 

## Related issue number

closes #5580
2025-02-17 15:46:22 -08:00
Ryan Sweet 48242f5255
adding initial docker support for agenthost (#5479)
<!-- 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-17 16:07:19 +00:00
Ryan Sweet 2a90731c44
improving doc comments (#5550)
adding some missing doc comments
2025-02-17 16:01:48 +00:00
Jacob Alber 36da8f2af7
ci: Enable NuGet packaging of Core.Grpc and RuntimeGateway.Grpc (#5554) 2025-02-14 14:58:17 -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
Jacob Alber 8029572f3f
fix: Unhandled Messages should not error when no deserializer is found (#5549)
Right now if a remote agent sends a message that local agents do not
listen to (and thus will never configure a deserializer for), or if the
first agent in the iteration is one such, the runtime will throw an
unnecessary exception an come down, even though the deserialized message
will never actually be needed before a deserializer is registered.

The fix will downgrade that to a warning.

* Also updates the HelloAgent sample to be more amenable to being used
with gRPC directly, without configuring environment variables.
2025-02-14 10:27:29 -05: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
Jacob Alber 62954ea1cb
fix: Race condition between GrpcWorkerConnection open and agent type registration (#5521)
This finishes the fix for the race condition between opening a
GrpcWorkerConnection and registering agent types on that worker. Now,
instead of failing to register, we return from the call (with the
expectation that we will finish registration as we set up the
connection)

Part 1: #5494 
Part 2: #5514

---------

Co-authored-by: Ryan Sweet <rysweet@microsoft.com>
2025-02-12 19:51:49 -05: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 d9432510e4
fix: Switch HelloAgent to use agent_events.proto from the Agents project (#5512)
* There was an inconsistentcy between the package names that prevented
xlang from working even though the actual types were 1:1 compatible
* Also moves the HelloAgent aspire project into the Hello solution
folder
2025-02-12 18:37:42 -05:00
Jacob Alber 07fdc4e2da
fix: gRPC Agent Runtime Serialization Registration (#5513)
We were registering the serializers when we already had a concrete type
on the way into Publish or Send on the .NET side. However, in a xLang
scenario, messages could originate from e.g. Python before being
sent/published from .NET, resulting in no serializer being found.

This change adds a second-change registration and lookup when the agent
is instantiated based on the IHandle<T> implementations.
2025-02-12 12:12:07 -05: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
Xiaoyun Zhang 9ceb5c05a7
[.NET] save chatHistory in another list to avoid duplicate messages (#5478)
<!-- 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" -->
Fix #4731 

## 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-10 21:13:55 +00:00
Ryan Sweet 51b601b6d8
re-add hello app host (#5445) 2025-02-07 22:59:38 -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
Jack Gerrits b05878aa4a
Create and publish documentation site for 0.4 dotnet (#5275)
<img width="1840" alt="Screenshot 2025-01-30 at 6 26 02 PM"
src="https://github.com/user-attachments/assets/5b4c9ebf-0880-4b2e-aa1f-f2b956922b49"
/>
2025-01-30 19:04:26 -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
Jack Gerrits bd5a24ba72
Start from just protos in core.grpc (#5243)
<!-- 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-01-28 17:44:50 -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 2e83d7244a
refactor: Reduce reflection calls when using HandlerInvoker (#5241)
Changes `HandlerInvoker` to avoid reflecting for every message when handling arity=2 `IHandler<,>` instances, by moving it out of the final generated delegate.
2025-01-28 21:17:11 +00:00
Jacob Alber e6926352aa
feat: Expose self-delivery for InProcessRuntime in AgentsApp (#5240)
* Enable configuring SelfDelivery (defaults to false) when using
AgentsAppBuilder
* Also fixes the predicate for self-delivery

---------

Co-authored-by: Griffin Bassman <griffinbassman@gmail.com>
2025-01-28 21:06:10 +00: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
XiaoYun Zhang 91249c4b33 update debugType option 2025-01-28 09:24:16 -05:00
Jack Gerrits caa33124bf remove unported things from the solution
formatting
2025-01-28 09:24:16 -05:00
Jacob Alber 235a3bfab3 feat: Enable Services mapping without passing in HostApplicationBuilder
* update getting-started sample
2025-01-28 09:24:16 -05:00
Jacob Alber 7a6f4ded2e fix: Crash when sending message an agent does not listen to 2025-01-28 09:24:16 -05:00
Jacob Alber 34d34142b3 fix: Remember to register the IAgentRuntime in the DI AppBuilder 2025-01-28 09:24:16 -05:00
Jacob Alber 22d8f449fb fixup: IHandler.HandleAsync 2025-01-28 09:24:16 -05:00
Jacob Alber 69f7c6bc45 fix: Update BaseAgent to use HandlerInvoker
* Fixes issues around SendMessage
2025-01-28 09:24:16 -05:00
Jacob Alber c930251ebc fix: Increase MethodGroup type precision
* Fixes stackoverflow when calling InMemoryRutnime.RegisterAgentFactoryAsync()
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 a4d8d571b0 getting started sample 2025-01-28 09:24:16 -05:00