111 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
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
Ryan Sweet
d96997232f
rysweet-4150-xlang-ci-test (#4596)
adds aspire-based integration test that validates:
* registration
* subscriptions
* event delivery
* python -> .NET server -> python subscriber
* .NET -> .NET server  -> python subscriber
* python -> .NET server -> .NET subscriber
2024-12-09 14:07:59 -08:00
Ryan Sweet
b94abb2a6c
add default subscriptions for the agent type - Implicitly created sub… (#4324)
* add default subscriptions for the agent type - Implicitly created subscription for agent RPC #4321

* add default sub for agenttype+id

* fix subscription implementation for in memory runtime
---------

Co-authored-by: XiaoYun Zhang <xiaoyuz@microsoft.com>
2024-11-25 16:29:51 -08:00
Xiaoyun Zhang
8f4d8c89c3
.NET add roleplay tool call orchestrator in AutoGen.OpenAI (#4323)
* add roleplay tool call orchestrator

* add chinese business workflow test

* update
2024-11-22 13:51:08 -08:00
Xiaoyun Zhang
ac8fd99872
[.NET] Parse data uri when creating ImageMessage (#4272)
* add test

* parse data uri from ImageMessage
2024-11-19 15:09:07 -08:00
Ryan Sweet
1e3b765e3a
.net changes to re-enable xlang support, add subscription apis (#4159)
* add subscription response

* fix send subscription response

* add register agent type response

* adding a test

* working on shaping up a test

* appsettins update for backend

* another appsettings

* fixup aspire hosting

* enable AGENT_HOST var from aspire

* add SendMessageAsync

* remove broken test

* test compiles and runs but is not (yet) correct

* subscriptions grain wireup.

* temp assert true.

* remove DI for SubscriptionGrain

* add xlang python code

* add subscription response

* rebond

* Update to .NET 9.0

* Fix Backend project SDK

* Package updates

* get RegisterAgentTypeRequest working

* fix exceptions

* add error handling for requests

* whoops

* send cloud event message type

* processing cloudevents

* trying tosend proto data - doesn't work

* trying to pack proto_data

* fix (#4238)

* pack the Message from agents_events

* format - not sure why these?

* format

* cleanup, error handling, xlang sample publishes messages that can be heard by .NET and vice versa

* format

* sdk version

* sdk vers

* net8

* back to net8

* remove netstandard2

* fix used

* remove unused

* more cleanup

* remove unneeded package

* I'm terrible at writing tests

* deserialize the cloud events and sent them as events

* comment

* cleanup

* await

* Delete dotnet/samples/Hello/Backend/Backend.csproj

unneeded change

* whoops

* merge main python back into here

* revert back to local

* revert some of the helloAgents changes.

* [.NET] Add happy path test for in-memory agent && Simplify HelloAgent example && some clean-up in extension APIs (#4227)

* add happy path test

* remove unnecessary namespace

* fix build error

* Update AgentBaseTests.cs

* revert changes

---------

* fix busted merge from main

* addressing review comments

* make internal

* case sensitive rename step 1

* case sensitive rename step 2

* remove!

---------

Co-authored-by: Peter Chang <petchang@microsoft.com>
Co-authored-by: Reuben Bond <reuben.bond@gmail.com>
Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
Co-authored-by: Xiaoyun Zhang <bigmiao.zhang@gmail.com>
2024-11-19 11:00:48 -08:00
Xiaoyun Zhang
ad271d975c
[.NET] Add happy path test for in-memory agent && Simplify HelloAgent example && some clean-up in extension APIs (#4227)
* add happy path test

* remove unnecessary namespace

* fix build error

* Update AgentBaseTests.cs

* revert changes

---------
2024-11-18 13:32:49 -08:00
Ryan Sweet
458d273fc4
Refactoring the services and implementing an in-memory runtime for .NET (#4005)
closes #3950 closes #3702

What this is doing:

I am refactoring the services on the .NET runtime and attempting to clarify the naming and organization.
I added this doc to help capture the naming and concepts.
AgentRuntime / Worker should work similar to the python version and enables running the whole agent system in one process. For remote the system uses the versions of the services in the grpc folder.
lots of other bug fixes/threading cleanup - passing cancellation token throughout
Services update clarifies the naming and roles:

Worker: Hosts the Agents and is a client to the Gateway
Gateway:
-- RPC gateway for the other services APIs
-- Provides an RPC bridge between the workers and the Event Bus
Registry: keeps track of the agents in the system and which events they can handle
AgentState: persistent state for agents
2024-11-12 11:04:59 -08:00