Commit Graph

28 Commits

  • .NET fix: Synthesized Handoff FunctionResult is never sent to agent (#5718)
    * test: Split out Handoff Orchestration tests
    
    * fix: Synthesized Handoff FunctionResult is never sent to agent
    
    When we receive a handoff request from the agent, we need to service it outside of the Agent Loop to terminate the loop. What this means is that we take ownership of terminating the call by feeding the result back into the agent on a subsequent invocation.
    
    When we refactored Handoff to support HITL and make use of AgentSession, we inadvertantly removed this step, causing subsequent invocations to the Handoff agent to fail (first works, but breaks the state).
    
    The fix is to be more precise about the agent's bookmark when concatenating the result of agent invocation to the shared conversation history.
    
    * test: Add unit tests for Handoff FunctionCall/Result matching fix
  • .NET: fix: Foundry Agents without description in Handoff (#5311)
    * fix: Foundry Agents without description in Handoff
    
    Foundry Agents without a description set will return an empty string (rather than null) for the description. This was breaking the fallback logic for `handoffReason`.
    
    * test: Add unit tests
  • .NET: feat: Refactor Handoff Orchestration and add HITL support (#5174)
    * feat: Refactor Handoff Orchestration and add HITL support
    
    * Change HandoffAgentExecutor to use factory-based instantiation
    * Extract shared request collection logic in AIAgentUnservicedRequestsCollector
    * Refactor HandoffAgentExecutor to use the "ContinueTurn" pattern as in AIAgentHostExecutor
    
    * fix: Remove '$' from exception strings
  • .NET: feat: Implement return-to-previous routing in handoff workflow (#4356)
    * feat: Implement return-to-previous routing in handoff workflow
    
    - Also obsoletes HandoffsWorkflowBuilder => HandoffWorkflowBuilder (no "s")
    
    * refactor: Remove instance-shared current agent tracking in handoffs
    
    Because the tracker was instance-shared between the start and end executors, it would be shared between all sessions, resulting in incorrect behaviour.
    
    The corect way to do this is to keep the data in a shared executor scope, which is per-session.
    
    * fix: Fix test logic for Handoff to correctly use checkpointing for multiturn
  • .NET: [BREAKING] Workflows API Review Naming Changes (Part 1?) (#4090)
    * refactor: Normalize Run/RunStreaming with AIAgent
    
    * refactor: Clarify Session vs. Run -level concepts
    
    * Rename RunId to SessionId to better match Run/Session terminology in AIAgent
    * [BREAKING]: Will break existing checkpointed sessions in CosmosDb due to field rename
    
    * refactor: Rename and simplify interface around getting typed data out of ExternalRequest/Response
    
    * Also adds hints around using value types in PortableValue
    
    * refactor: Rename AddFanInEdge to AddFanInBarrierEdge
    
    This will prevent a breaking change later when we introduce a programmable FanIn edge, analogous to the FanOut edge's EdgeSelector.
    
    The goal, in the long run is to support a number of different FanIn scenarios, with naive FanIn (no barrier) by default, similar to FanOut.
    
    * refactor: AsAgent(this Workflow, ...) => AsAIAgent(...)
    
    * misc - part1: SwitchBuilder internal
    
    ---------
    
    Co-authored-by: Dmytro Struk <13853051+dmytrostruk@users.noreply.github.com>
  • .NET: Remove FunctionCalls and Tool Messages from Handoff passed messages (#3811)
    * Fix handoff orchestration not passing user message to handoff target agent (#3161)
    
    Filter out internal handoff function call and tool result messages before
    passing conversation history to the target agent's LLM. These messages
    confused the model into ignoring the original user question.
    
    * Add handoff tool call filtering behavior and enhance workflow builder
    
    - Introduced HandoffToolCallFilteringBehavior enum to specify filtering behavior for tool call contents in handoff workflows.
    - Updated HandoffsWorkflowBuilder to support customizable handoff instructions and tool call filtering behavior.
    - Enhanced HandoffAgentExecutor to utilize new filtering options for improved message handling during agent handoffs.
    
    * Enhance handoff message filtering logic and add unit tests for filtering behaviors
    
    * Refactor HandoffMessagesFilter to remove unused handoff function names and enhance filtering logic for non-handoff function calls
    
    * Refactor HandoffMessagesFilter to streamline FilterCandidateState initialization and improve clarity
    
    * Refactor HandoffMessagesFilter to improve filtering logic and add integration tests for handoff workflows
    
    * fix: HandoffAgentExecutor tests
  • [BREAKING] .NET: Decouple Checkpointing from Run/StreamAsync APIs (#4037)
    * [BREAKING] refactor: Decouple Checkpointing and Execution APIs
    
    With this change, Checkpointing becomes an property of an IWorkflowExecutionEnvironment. This lets environments that are tightly-coupled to their CheckpointManager avoid needing to present APIs that would not work (e.g. taking in an InMemory CheckpointManager for Durable Tasks, for example)
    
    * refactor: Normalize IsCheckpointingEnabled naming
  • .NET: [BREAKING] Implement Polymorphic Routing (#3792)
    * feat: Implement Polymorphic Routing
    
    * feat: Add support for Send/Yield annotations with basic Executor
    
    * Adds annotations to Declarative workflow executors
    
    * fix: Address PR Comments
    
    * Implicit filter in collection loops
    * Remove debug / usused / superfluous code
    * Fix ProtocolBuilder implicit output registrations
    * Fix logic error in ExecuteRouteGeneratorTests.ClassWithManualConfigureProtocol_DoesNotGenerate
    
    * fix: Solidify type checks and send/yield type registrations
    
    * fix: Suppress generation of TurnTokens out of AggregateTurnMessagesExecutor
    
    * Fixes an issue where ConcurrentEndExecutor is not expecting TurnTokens.
    
    * fix: Add ProtocolBuilder support for chained-delegation
    
    * Updates Declarative pacakge to rely on chained-delegation Send/Yield registration
    * Renames DeclarativeActionExectuor's new ExecuteAsync to ExecuteActionAsync to avoid colliding with Executor.ExecutoeAsync
    
    * fix: Address PR Comments
    
    * Fixes type mapping in FanInEdgeRunner
    * Fixes and expalins send/yield type registration in FunctionExecutor
    
    * fixup: build-break
    
    * fix: Add missing SendsMesage declaration to InvokeAzureAgentExecutor
  • .NET: [BREAKING] Add session StateBag for state storage and support multiple providers on the Agent (#3806)
    * .NET: [BREAKING] Add session statebag to use for state storage instead of inside providers (#3737)
    
    * Add a StateBag to AgentSession and pass Agent and AgentSession to AIContextProvider and ChatHistoryProviders
    
    * Convert all AIContextProviders to use the statebag
    
    * Update InMemoryChatHistoryProvider to use StateBag
    
    * Update Comsos and Workflow ChatHistoryProviders
    
    * Update 3rd party chat history storage sample.
    
    * Remove serialize method from providers
    
    * Replacing provider factories with properties
    
    * Remove Providers from Session and flatten state bag serialization
    
    * Update samples to use getservice on agent
    
    * Updated additional session types to serialize statebag
    
    * Fix regression
    
    * Address PR comments
    
    * Address PR comments.
    
    * Fix formatting
    
    * Fix unit tests
    
    * Remove InMemoryAgentSession since it is not required anymore.
    
    * Address PR comments
    
    * Convert sessions for A2AAgent, ChatClientAgent, CopilotStudioAgent and GithubCopilotAgent to use regular json serialization.
    
    * Fix durable agent session jso usgae
    
    * Add jso to InMemory and Workflow ChatHistoryProviders
    
    * Update InMemoryChatHistoryProvider to use an options class for it's many optional settings.
    
    * Apply suggestions from code review
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * Address PR feedback
    
    * Fix verification bug.
    
    * Improve state bag thread safety
    
    * Address PR comments and fix unit tests
    
    * Address PR comments
    
    * Fix unit test
    
    ---------
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * Add a public StateKey property to providers (#3810)
    
    * .NET: [BREAKING] Update providers in such a way that they can participate in a pipeline (#3846)
    
    * Make providers pipeline capable
    
    * Fix unit tests
    
    * Move source stamping to providers from base class
    
    * Also update samples.
    
    * Address PR comments
    
    * Rename AsAgentRequestMessageSourcedMessage to WithAgentRequestMessageSource
    
    * .NET: [BREAKING] Add consistent message filtering to all providers. (#3851)
    
    * Add consistent message filtering to all providers.
    
    * Remove old chat history filtering classes
    
    * Fix merge issues
    
    * Fix unit test
    
    * Enforce non-nullable property
    
    * Fix merging bug and make troubleshooting source info easier by adding tostring implementation
    
    * .NET: [BREAKING] Add support for multiple AIContextProviders on a ChatClientAgent (#3863)
    
    * Add support for multiple AIContextProviders on a ChatClientAgent
    
    * Address PR comments and fix tests
    
    * Address PR comments.
    
    * .NET: [BREAKING]Delay AIContext Materialization until the end of the pipeline is reached. (#3883)
    
    * Delay AIContext Materialization until the end of the pipeline is reached.
    
    * Address PR comments.
    
    * Address PR comments
    
    * Modify InvokedContext to be immutable (#3888)
    
    * .NET: Address Feedback on StateBag feature branch PR (#3910)
    
    * Address Feedback on statebag feature branch PR
    
    * Update dotnet/src/Microsoft.Agents.AI.DurableTask/CHANGELOG.md
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * Address PR comments
    
    ---------
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
  • .NET: [BREAKING] Change SerializeSession to be Async (#3879)
    * Change SerializeSession to be Async
    
    * Update Changelog
  • .NET: Introduce Core implementation methods for session methods on AIAgent (#3699)
    * Introduce Core implementation methods for session methods on AIAgent
    
    * Update changelog
  • .NET: [BREAKING] Rename session state json param (#3681)
    * Rename session state json param to ensure consistency
    
    * Fix merge failures and PR comments.
  • .NET: [BREAKING] Move AgentSession.Serialize to AIAgent (#3650)
    * Move AgentSession.Serialize to AIAgent
    
    * Address PR comments.
    
    * Improve code and fix unit test
    
    * Update test agents to return a default json element instead of throwing where the the result of the serialization is never used.
    
    * Update further tests to actually serialize the session
  • .NET: [BREAKING] Rename GetNewSession to CreateSession (#3501)
    * Rename GetNewSession to CreateSession
    
    * Address copilot feedback
    
    * Suppress warning
    
    * Suppress warning
    
    * Fix further warnings.
  • .NET: [BREAKING] Rename AgentThread to AgentSession (#3430)
    * Rename AgentThread to AgentSession
    
    * Add more renames
    
    * Update readme files
    
    * Revert nullable variable change and further fixes.
    
    * Revert change in header name
    
    * Fix some comments and tests
    
    * Update changelog.
    
    * Address PR feedback.
    
    * Fixing code review comments.
    
    * Fix new errors after merging latest code.
  • .NET: [Breaking] Rename AgentRunResponseEvent and AgentRunUpdateEvent classes (#3214)
    * rename AgentRunResponseEvent and AgentRunUpdateEvent classes
    
    * rollback unnecessary changes
  • .NET: [Breaking] RenameAgentRunResponse and AgentRunResponseUpdate classes (#3197)
    * rename AgentRunResponse and AgentRunResponseUpdate classes - part1
    
    * rename varialbles, parameters, methods and tests
    
    * rollback unnecessary changes
  • .NET: [BREAKING] Change GetNewThread and DeserializeThread to async (#3152)
    * Change GetNewThread and DeserializeThread plus ChatMessageStore and AIContextProvider Factories to async
    
    * Merge fixes
  • .NET: [Breaking] Introduce RunCoreAsync/RunCoreStreamingAsync delegation pattern in AIAgent (#2749)
    * Initial plan
    
    * Refactor AIAgent: Make RunAsync and RunStreamingAsync non-abstract, add RunCoreAsync and RunCoreStreamingAsync
    
    Co-authored-by: SergeyMenshykh <68852919+SergeyMenshykh@users.noreply.github.com>
    
    * Fix infinite recursion in test implementations
    
    Co-authored-by: SergeyMenshykh <68852919+SergeyMenshykh@users.noreply.github.com>
    
    * Make RunAsync and RunStreamingAsync non-virtual as requested
    
    Co-authored-by: SergeyMenshykh <68852919+SergeyMenshykh@users.noreply.github.com>
    
    * Fix DelegatingAIAgent subclasses to use RunCoreAsync/RunCoreStreamingAsync
    
    Co-authored-by: SergeyMenshykh <68852919+SergeyMenshykh@users.noreply.github.com>
    
    * Fix XML documentation references in AnonymousDelegatingAIAgent
    
    Co-authored-by: SergeyMenshykh <68852919+SergeyMenshykh@users.noreply.github.com>
    
    * Restore <see cref> tags with proper qualified signatures in AnonymousDelegatingAIAgent
    
    Co-authored-by: SergeyMenshykh <68852919+SergeyMenshykh@users.noreply.github.com>
    
    * Rollback unnecessary XML documentation changes in AnonymousDelegatingAIAgent
    
    Co-authored-by: SergeyMenshykh <68852919+SergeyMenshykh@users.noreply.github.com>
    
    * Remove pragma and update crefs to RunCoreAsync/RunCoreStreamingAsync
    
    Co-authored-by: SergeyMenshykh <68852919+SergeyMenshykh@users.noreply.github.com>
    
    * Fix EntityAgentWrapper to call base.RunCoreAsync/RunCoreStreamingAsync
    
    Co-authored-by: SergeyMenshykh <68852919+SergeyMenshykh@users.noreply.github.com>
    
    * fix compilation issues
    
    * fix compilatio issue
    
    * fix tests
    
    * fix unit tests
    
    * fix unit test
    
    ---------
    
    Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
    Co-authored-by: SergeyMenshykh <68852919+SergeyMenshykh@users.noreply.github.com>
    Co-authored-by: SergeyMenshykh <sergemenshikh@gmail.com>
    Co-authored-by: Chris <66376200+crickman@users.noreply.github.com>
  • fix: .NET: Concurrency Support for Orchestrations (#1689)
    Concurrent run support was recently added to workflows, but Orchestrations did not fully update to support it. A few executors were missing Cross-Run Shareable annotations, and the ConcurrentEnd executor needed to be factory-instantiated.
    
    This also ports the fix for #1613 from #1637, to avoid waiting on that PR.
  • .NET: [BREAKING] Enable sharing of workflow instances across concurrently executing runs (#1464)
    * refactor: remove unused internals
    
    * feat: Execution Mode for sharing a workflow among concurrent runs
    
    * feat: Update WorkflowHostAgent to support concurrent execution
    
    * Also update AsAgent APIs to support injecting a CheckpointManager and an IWorkflowExecutionEnvironment
    
    * fix: Make Read logic consistent in DeclarativeWorkflowContext
  • .NET [WIP]: introduce Hosting extensions for Workflows (#1359)
    * skeleton
    
    * wip
    
    * rename + fix tests
    
    * implement workflow tests
    
    * fix comments
    
    * Update dotnet/src/Microsoft.Agents.AI.Hosting/HostApplicationBuilderWorkflowExtensions.cs
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * fixes
    
    * fix worfklow build logic
    
    * rollback + new overload on workflow builder
    
    * address PR comments
    
    * :)
    
    ---------
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
  • .NET: [BREAKING] Propagate CancellationToken into Workflow Executors and message handlers (#1280)
    * feat: Propagate CancellationToken to Executors
    
    * Also adds cancellation propagation to `Executor`-accessible APIs
    * Adds registrators for cancellable handlers to `RouteBuilder`
    * [BREAKING]: Adds `CancellationToken` to `IMessageHandler.HandleAsync`
    
    * test: Re-enable Concurrent Orchestration test
    
    * refactor: Delete unused IInputCoordinator
    
    * refactor: Remove superfluous argument qualifications
  • [BREAKING] .NET: Workflow Off-Thread Execution Mode (#1233)
    * Updates to async run loop.
    
    * fix: Workflow Onwership can be release by nonowner
    
    * fix: Incorrect handling of blockOnPending in StreamingRun
    
    Depending on whether we are running in streaming on non-streaming mode, we may be using the StreamingRun in different ways. Unfortunately, the only place we can really know what is the actual state of execution is in the RunEventStream implementations.
    
    This resulted in blocking where blocking was unneeded and occasionally not-blocking when blocking was needed.
    
    The fix is to move the logic of handling this blocking into RunEventStream implementations.
    
    * fix: Fix cleanup on error and end run
    
    This ensures we clean up the background resources correctly.
    
    * fix: Ensure we let the run loop proceed when shutting down
    
    * fix: Add timeout for Input Waiting
    
    * fix: Make the samples properly clean up `Run`s and `StreamingRun`s
    
    * fix: Simplify Declarative Workflow Run disposal pattern
    
    * Also fixes missing .Disposal() in Integration tests
    
    ---------
    
    Co-authored-by: Ben Thomas <ben.thomas@microsoft.com>
  • .NET: Move the AsAIAgent extension methods to the correct class (#1106)
    * Move the AsAIAgent extension methods to the correct class
    
    * Fix format issue
    
    * Disable unit test, see issue #1109
    
    ---------
    
    Co-authored-by: Mark Wallace <markwallace@microsoft.com>
  • .NET: Clean up stale mentions of M.E.AI.Agents (#997)
    * Clean up stale mentions of M.E.AI.Agents
    
    * Unused usings
  • .NET: Rename workflows projects (#975)
    * Renaming Microsoft.Agent.Workflows to Microsoft.Agents.AI.Workflows
    
    * Removing local settings.
    
    * Removing remining old files from merge.