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)
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>
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>
* 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.
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.
<!-- 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.
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.
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>
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
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
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.
* 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>
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
* moves AgentId into Agent
* Renames AgentRuntime to AgentMessenger (more accurate name)
* Remove IAgentRuntime Interface
* changes constructor of Agent to take IAgentWorker instead of IAgentRuntime
* 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
* 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
* 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>
* 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>
closes#3950closes#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