Commit Graph

261 Commits

  • .NET: Make WorkflowBuilder more intuititve (#503)
    * feat: Make WorkflowBuilder more intutitve
    
    Right now Executorish binding has some unintutitive behaviour. When a user adds an eecutor with an id of an executor that already exists, we silently replace it, if the user provides it inside of add_edge. When a user introduces an executor via an unbound id, the user must bind it via BindExecutor, even though the registration is created implicitly when an edge id added.
    
    The change will remove the invisible update in favor of a "best efforts" check of type and instance equality.
    
    * Expand errors when rebinding to disallowed
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
  • .NET: feat: Implement Checkpointing API (#420)
    * feat: Implement Checkpointing API
    
    * refactor: Normalzie Namespaces and break out multi-class files
    
    * feat: Support checkpointing in AIAgentHostExecutor
    
    * test: Representation tests
    
    * feat: Add Step-level Tracing and WorkflowEvents
    
    * feat: Add Checkpointing Sample and Smoke Test
    
    * Fixes an issue where StateManager was not properly clearing the incoming queued updates.
    * Fixes order of checkpointing and in-step event publication
    * Adds import of RunContext state on LoadCheckpoint
    * Add re-firing of events for unserviced ExternalRequests on Checkpoint load
    
    * docs: Add documentation to publics
    
    * Also adds documentation to ICheckpointManager which may go public
    
    * refactor: Fix Union Aggregators and add Tests
    
    * fix: Fix issues raised in PR comments and remove dead code
  • .NET: feat: Microsoft.Extensions.AI.Agents.Hosting.A2A package (#390)
    * add timeout handling for message send
    
    * prepare a2a proj
    
    * fix it finally
    
    * add a holder for selected protocol
    
    * init types ;
    
    * see discoveredAgentCardJson
    
    * prettify json
    
    * correct usage
    
    * client setup for card
    
    * setp?
    
    * message:send
    
    * init task based communication
    
    * try call it via the agent thread
    
    * okay i got back the message wooooow!
    
    * nit
    
    * fix duplicates
    
    * yea matey!
    
    * fix knights-knaves for A2A-Task-based communication
    
    * fix a2a agents csproj
    
    * AI feedback
    
    * a2a does not support netstandard / netfx
    
    * try fix build + refactor
    
    * bump a2a for net9 only
    
    * rollback System.Net.ServerSentEvents & Microsoft.Bcl.AsyncInterfaces version upgrade; override in-place and retarget to net9;net8 for A2A
    
    * address PR comments x1
    
    * refactor a2a interfaces
    
    * address PR comments x2
    
    * fix cancel usage
    
    * separate project for A2A.AspNetCore
    
    * simplify
    
    * cleanup
    
    * cleanup dependencies
    
    * generate convertor tests / fix namespaces etc
    
    * setup actor client!
    
    * fix build
    
    * backoff conversations
    
    * fix duplicate message streaming
    
    * address PR comments x1
    
    * remove internalsvisibleto
    
    * dont implement agent card query on my own: give it to the user
    
    * nit
    
    * rename and move projects
    
    * fix dotnet-format
    
    * address PR comments x1
    
    * remove unreferenced project
    
    * rollback
    
    * rename
    
    * nit
    
    ---------
    
    Co-authored-by: Chris <66376200+crickman@users.noreply.github.com>
  • .NET: Add Approval capabilities to FunctionInvokingChatClient (#457)
    * Add Approval capabilities to FunctionInvokingChatClient
    
    * Address PR comments.
    
    * Address PR comments.
    
    * Address PR comments.
    
    * Address PR feedback, add sample, and fix bug plus unit test.
    
    * Address PR comments
  • .NET: feat: Host Workflow as AIAgent (#469)
    * feat: Host Workflow as AIAgent
    
    * Also changes AIAgent-as-Executor to use streaming runs and streaming
      events
    * Also enables default setting for yielding events
    
    * fix: Infinite loop in GenerateNewId()
    
    * docs: Spelling
    
    * test: Add Workflow-as-Agent sample and test
  • .NET: chore: support retries on Cosmos storage creation (#402)
    * support retries
    
    * tests + registration options
    
    * fix ordering ..
    
    * HK + update packages
    
    * fix paths
    
    * Update dotnet/tests/CosmosDB.IntegrationTests/Microsoft.Extensions.AI.Agents.Runtime.Storage.CosmosDB.Tests/CosmosTestFixture.cs
    
    * re create project and fix some pk usage
    
    * fix all tests
    
    * try workflow?
    
    * wip 1
    
    * fix definition
    
    * try with cosmos_use_emulator env?
    
    * try ignore SSL errors?
    
    * other cert verifications
    
    * hardcode to 8081?
    
    * proper valuation of ENV
    
    * logging
    
    * ensure db exsists for CI
    
    * bump
    
    * cleanup
    
    * fix usage
    
    * nit comment
    
    * try only release for stability?
    
    * try skip some flaky tests
    
    * merge fixes + rollback container
    
    * reimplement with iasyncdisposable pattern
    
    * remove example doc struct
  • .NET: Bring OpenAIResponsesChatClient temporarily (#449)
    * copy OpenAIResponsesChatClient from meai temporarly
    
    * Update dotnet/src/Microsoft.Extensions.AI.Agents.OpenAI/NewOpenAIResponsesChatClient.cs
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * add AsNewIChatClient extension method
    
    ---------
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
  • .NET: feat: Improve Support for AIAgent-as-Executor (#432)
    * feat: Support Executor-targeted messages
    
    This adds support for only sending a message to a given executor. Messages will still only route through connected edges.
    
    * feat: Support sending all valid input types after starting a run
    
    * feat: Normalize AIAgent-as-Executor Message Protocol to use MEAI types
  • .NET: Update OpenTelemetry Agent - Added Demo, AIAgentMetadata and Agent.GetService() (#356)
    * OTEL Demo
    
    * updating telemetry sample
    
    * OTEL updates
    
    * WIP
    
    * Adding GetService and Agent Metadata for Telemetry
    
    * WIP
    
    * Add UT for OTEL System behavior
    
    * Address Unicode problem
    
    * Add logging
    
    * Adjust for new extensions
    
    * Change Logger to LoggerFactory for the extension method
    
    * Address AI Feedback
    
    * Simplify script and readme just for Azure OpenAI
    
    * Increase code converage
    
    * Address merge conflict
    
    * Another slnx fix
    
    * Address PR comments
    
    * Address PR feedback + Add UT
    
    * Added Hosting UT to the solution
    
    * Address PR comments
    
    * Address missing sensitivity tests
    
    * Remove unecessary override
    
    * Address PR comments
  • .Net: WIP: feat: Define Workflow and Executor APIs (#261)
    * feat: Define Workflow and Executor APIs
    
    * feat: Define IExecutionContext and Events
    
    * feat: Simple Workflow Demos
    
    * refactor: Move Workflows classes to separate assembly
    
    * feat: Move FanOut/In to LowLevel API with new semantics
    
    * feat: Implement Local Execution
    
    * refactor: Assembly name .Workflow => .Workflows
    
    * feat: Enable Default Message Handling
    
    * also lifts Bind in MessageHandlerInfo to better be able to direclty invoke handlers (for AOT, later)
    
    * feat: Implement StreamingHandle APIs
    
    This allows the user to respond to WorkflowEvents with external messages, enabling HIL.
    
    * feat: Add checks for duplicate edges and chain cycles
    
    * feat: Add built-in WorkflowEvents
    
    * refactor: Pull classes into own files
    
    * refactor: Simplify Disposal pattern in Executor
    
    * refactor: Break EdgeRunner file into per-type files
    
    * refactor: Use Throw.IfNull()
    
    * refactor: Remove AddLoop()
    
    Per https://github.com/microsoft/agent-framework/pull/272#discussion_r2241739079 we decided this was not very useful.
    
    * refactor: Normalize use of ValueTask
    
    * fix: Build Break from removing .AddLoop
    
    * refactor: Explicit routing and RouteBuilder
    
    Split out reflection from MessageRouter implemention into build phase, enabling AOT compilation to drive RouteBuilding without reflection.
    
    * test: Add Reflection/Invocation tests
    
    * fix: Terminate on Completion event
    
    * refactor: Update public API surface
    
    * feat: Add support for external requests
    
    * feat: Support hosting AIAgent instances in Workflows
    
    * fix: Fix routing to go through Executor.ExecuteAsync
    
    * test: Update samples for "must SendMessage" semantics
    
    * Add invoking samples to unit tests to avoid future breaks
    
    * fix: ExternalRequest should block Workflow completion
    
    * feat: Normalize API surface against Python
    
    * Also adds xmldoc to all public APIs
    
    * refactor: Normalize UnitTest and Sample namespaces
    
    * fix: Formatting
    
    * refactor: Normalize project/folder names
    
    * feat: Remove DynamicCodeExecution from ValueTaskTypeErasure
    
    * fix: Fix ILTrim warnings
    
    * docs: Add missing docs and fix typos
    
    * feat: Hosted Agents should report Run events
    
    * fix: Fix type propagation for ILTrim changes
    
    * refactor: Simplify DynamicallyAccessedMembers annotations
    
    * sample: Use static-Type construction of InputPort
    
    * feat: Support non-Streaming Run Mode
    
    * test: Add test for non-streaming execution
    
    * refactor: Remove unused types
    
    * refactor: Simplify Event and EdgeData type hierarchies
    
    * feat: Add Switch (=Conditional Edge Group) control flow
    
    * feat: Make .NET AutoSend the MessageHandler result
    
    * feat: Implement State APIs
    
    * refactor: Simplify public namespaces and code organization
    
    * refactor: Reconcile .NET and Python names
    
    ---------
    
    Co-authored-by: Chris <66376200+crickman@users.noreply.github.com>
  • .NET: Avoid double responses when streaming (#365)
    * Avoid double responses when streaming.
    
    * Fix tests.
  • .NET: Add agent hosting package and update sample (#296)
    * Add agent hosting package and update sample
    
    * Review feedback and cleanup
    
    * Include the narrator
    
    * wip
    
    * wip
    
    * Remove workaround for empty state writes.
    
    * Handle changes to AgentThread.
    
    * One more.
    
    * Fix.
    
    ---------
    
    Co-authored-by: Aditya Mandaleeka <adityam@microsoft.com>
  • .Net: Add support for 3rd party thread storage and thread serialization (#203)
    * Add thread storage and serialization POC
    
    * Switch to using JsonElement and add unit tests
    
    * Add additional unit tests.
    
    * Exclude private debugger properties from CodeCoverage.
    
    * Rename IChatMessagesStorable to IChatMessageStore
    
    * Apply suggestions from code review
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * Improve xml doc.
    
    * Update the message storing thread to always use external store for both local and remote storage.
    
    * Remove threadid from the IChatMessageStore interface, since the store should own the thread id itself, if it requires one.
    
    * Switch GetMessages to IEnumerable
    
    * Address pr comments.
    
    * Make jsonserializer options default consistent on DeserializeThreadAsync
    
    * Move message storing thread functionality into AgentThread and simplify AgentThread behavior.
    
    * Remove embedding generation from VectorStore chat history sample.
    
    * Remove unecessary code and fix formatting.
    
    * Make GetNewThread and DeserializeThread virtual with default implementations.
    Remove unsued json utilities.
    
    * Fix formatting
    
    * Remove problem test.
    
    * Add more unit tests
    
    * Remove unused using clause.
    
    * Address pr feedback.
    
    * Address PR comments.
    
    * Make InMemory store internal
    
    * Switch InMemoryChatMessageStore to implement IList instead of inheriting from List.
    
    * Rename store deserialize param.
    
    * Update serialization based on PR comments.
    
    * Remove confusing comment.
    
    * Address Deserialization PR comments in the same way as Serialization
    
    * Add State to IChatMessageStore Serialize and Deserialize names.
    Make Thread Deserialize internal.
    Make AgentThread type switching fobidden.
    
    ---------
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    Co-authored-by: Chris <66376200+crickman@users.noreply.github.com>
  • .NET: Clean / address some message warnings (#291)
    * WIP
    
    * Structured Output sample
    
    * Update dotnet/samples/GettingStarted/Steps/Step06_ChatClientAgent_StructuredOutputs.cs
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * Address xml and comment targeting the Structured Output context
    
    * Update with proposed fix for Persistent ChatClient
    
    * Address PR feedback
    
    * Address minor warnings
    
    * Address initialization
    
    * Address initialization
    
    * Address PR comments, update suggestions
    
    * Revert changes to NullableAttributese.cs
    
    ---------
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    Co-authored-by: Chris <66376200+crickman@users.noreply.github.com>
  • .NET: CosmosDB Actor State Storage (#262)
    * Implement CosmosDB actor state storage.
    
    * Fix.
    
    * Minor fixes.
    
    * Fixes.
    
    * Make CosmosDB initialization be lazy.
    
    * Remove unnecessary read from write path.
    
    * Throw on empty writes.
    
    * Add arg validation for read.
    
    * Add CosmosIdSanitizer.
    
    * Fix.
    
    * Fix.
    
    * Simplify doc IDs.
    
    * Update comment.
    
    * fb
    
    * Make LazyCosmosContainer internal and add tests.
    
    * Make test constants public and remove IVT.
    
    * Use source generated JSON context for future nativeAOT support.
    
    * Re-add dropped comments.
  • .Net: Add Structured output ChatClientAgent samples (#250)
    * WIP
    
    * Structured Output sample
    
    * Update dotnet/samples/GettingStarted/Steps/Step06_ChatClientAgent_StructuredOutputs.cs
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * Address xml and comment targeting the Structured Output context
    
    * Update with proposed fix for Persistent ChatClient
    
    * Address PR feedback
    
    ---------
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    Co-authored-by: Chris <66376200+crickman@users.noreply.github.com>
  • Clean up handoff orchestration creation (#235)
    - Remove Dictionary-derived types
    - Add an optional name to orchestrations
    - Make Handoffs based purely on AIAgent instances rather than separately provided names
  • Initial draft of actor runtime abstractions (#197)
    * Initial draft of actor runtime abstractions
  • Add an AgentRunResponse ctor accepting a ChatResponse (#204)
    * Add an AgentRunResponse ctor accepting a ChatResponse
    
    * Update dotnet/src/Microsoft.Extensions.AI.Agents.Abstractions/AgentRunResponseUpdate.cs
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
  • Round 3 of cleanup (#186)
    - Enable warnings as errors
    - Make the remaining src projects NativeAOT compatible
    - Use Throw helpers
  • .Net: Add OpenTelemetry Support and Samples (#182)
    * Adding sample and implementation similar to MEAI approach
    
    * Add Telemetry UnitTests
    
    * Fix Async suffix
    
    * Add ADR with the proposal
    
    * Address merge changes
    
    * Fixing const visibility + coverage
    
    * Increase test coverage, add metrics collection code paths
    
    * Fix warnings
    
    * WIp
    
    * Convention adeherence
    
    * Add gen-ai.system logic + UT
    
    * Add convetion reference
    
    * Address PR comments
    
    * Addressing PR comments, Agent name optional
    
    * Remove constant
    
    * Update dotnet/src/Microsoft.Extensions.AI.Agents/ChatCompletion/ChatClientAgent.cs
    
    Co-authored-by: westey <164392973+westey-m@users.noreply.github.com>
    
    * GetLoggingName
    
    ---------
    
    Co-authored-by: westey <164392973+westey-m@users.noreply.github.com>
  • Add ChatClientAgent constructor overload (#188)
    * Add ChatClientAgent constructor overload
    
    * Add unit tests for new constructor
    
    * Up code coverage with extra tests
    
    * Address PR comments.
    
    * Address PR comment
    
    * Add additional test to increase code coverage.
  • Allow InProcessRuntime subscriptions to be processed concurrently (#179)
    * Allow InProcessRuntime subscriptions to be processed concurrently
    
    * Fix tests
  • Round 2 of cleanup for agent runtime and orchestrations (#164)
    - Moved InProcessRuntime type into abstractions package and deleted InProcess package.
    - Moved several members of IAgentRuntime to be extension methods instead, e.g. multiple GetActorAsync overloads.
    - Added synchronous RegisterMessageHandler overloads and used them to avoid unnecessary async usage at call sites.
    - Removed unnecessary surface area from InProcessRuntime, e.g. StopAsync, RunUntilIdleAsync, etc.
    - Fixed spin loop in InProcessRuntime that would consume an entire core for the duration of the orchestration's operation.
    - Removed a bunch of allocation from InProcessRuntime.
    - Made a runtime optional for orchestrations, defaulting to using a temporary InProcessRuntime if none is provided.
    - Removed custom delegate types from orchestrations.
    - Consolidated namespaces.
    - Used records to simplify message classes.
    - Tweaked naming on AgentActor to make purpose of protected methods more clear.
    - Removed invocation in AgentActor.InvokeAsync of empty update / isFinal parameter.
    - Changed OrchestrationHandoffs to avoid needing to pass in agents duplicatively.
    - Made various extension methods, such as those on OrchestrationHandoffsExtensions, into instance methods.
  • Run Response ADR & Updates (#104)
    * Add ADR for different run response options
    
    * Add another option to the list.
    
    * Update agno non-streaming with further clarification
    
    * Add another option
    
    * Adding optional includeUpdates option
    
    * Adding Pros/Cons for each option
    
    * Make pros/cons a list
    
    * Add some thoughts on structured outputs and custom AIContent types
    
    * Update design doc to clarify primary and secondary better and split out custom response types with it's own options
    
    * Add structured outputs competitive comparison and suggestion
    
    * Address PR comments.
    
    * Remove AgentRunFinishReason until we can find a good use case for it.
    
    * Add finish reason to list of excluded properties.
    
    * Add custom agent run response types.
    Usage to follow.
    
    * Update Agent run response types
    
    * Add additional code coverage
    
    * Remove onIntermediateMessage since it is unecessary with the new response approach.
    
    * Add AgentId to response.
    
    * Rename ParseAsStructuredOutput to Deserialize
    
    * Update decision doc.
    
    * Fix formatting.
    
    * Update CopilotStudio to return new response types
    
    * Address PR comment
    
    Co-authored-by: Roger Barreto <19890735+rogerbarreto@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Roger Barreto <19890735+rogerbarreto@users.noreply.github.com>
  • Add PoC CopilotStudio agent (#84)
    * Add project and skeleton files.
    
    * Add CopilotStudioAgent implementation
    
    * Add CopilotStudio integration tests
    
    * Fix typos and PR feedback.
    
    * Fix .net framework build errors.
    
    * Address PR comments
    
    * Remove temp test.
    
    * Add rawresponse for streaming updates and more comments.
    
    * Add TODO to review streaming updates
    
    * Address PR comments and fix some issues with streaming messages.
    
    * Map additional properties to agent reponses
    
    * Update CopilotStudio integration tests to match new approach.
    
    * Update copilot studio namespaces/project names to match new naming
    
    * Add todo's for AIContent types.
    
    * Remove files from PR.
    
    * Fix up sln file.
    
    * Update .gitignore.
    
    * Remove duplicate package version items.
  • .Net: Update Code Interpreter Sample as a Step. (#148)
    * Updating code interpreter samples
    
    * Small adjustments to ensure it works as expected
    
    * Update dotnet/samples/GettingStarted/Steps/Step03_ChatClientAgent_UsingCodeInterpreterTools.cs
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * Address xmldoc
    
    * Addressing PR coment, external implementaions + ChatClients update, removing RawRepresentationFactory requirement
    
    * Address warnings
    
    * Update Fix warnings
    
    * Proposed changes for the OpenAIAssistantChatClient
    
    * Address PR comments
    
    ---------
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    Co-authored-by: Mark Wallace <127216156+markwallace-microsoft@users.noreply.github.com>
  • Remove instructions from base agent type, and ensure description is only required where necessary. (#154)
    * Remove instructions from base agent type, and ensure description is only required where necessary.
    
    * Fix code issue.
    
    * Remove unused import.
    
    * Remove typo
    
    * Make the description parameter optional
    
    * Also use name for handoffs if no description is provided.
  • .NET Port Agent Orchestration (#107)
    * Checkpoint
    
    * Checkpoint
    
    * Namespaces
    
    * Namespace
    
    * Cleanup
    
    * Namespace order
    
    * Fix sync
    
    * Formatting
    
    * Formatting
    
    * Namespace
    
    * Namespace order
    
    * Code convention
    
    * Naming
    
    * Naming
    
    * Text handling
    
    * Text handling
    
    * Namespace
    
    * Namespace order
    
    * Namespace ordering
    
    * Test
    
    * ValueTask
    
    * net472
    
    * Test fix
    
    * Fix namespace (net472)
    
    * Namespace
    
    * Fix conditional namespace
    
    * Fix type expression
    
    * Compatibility and cleanup
    
    * Sample compatibility
    
    * Sample compat
    
    * Test compat
    
    * modifier order
    
    * Simply http-stub
    
    * Formating fix for unit-test
    
    * Fix test
    
    * Real fix
    
    * Test clean-up
    
    * Update dotnet/src/Microsoft.Agents.Orchestration/Handoff/HandoffOrchestration.cs
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * Fix build errors after merging
    
    ---------
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    Co-authored-by: Stephen Toub <stoub@microsoft.com>
  • Renaming to use Microsoft.Extensions prefix (#120)
    * Rename the folders
    
    * Rename the .csproj files
    
    * Some build file updates
    
    * Update namespaces
    
    * Fix order of imports
    
    * Fix order of imports
    
    * Fix order of imports
  • .Net: Agent Samples - Adding AzureAIAgentsPersistent to Steps (#105)
    * Adding Persistent Agent to Steps
    
    * Add comments
    
    * Ensure changes
    
    * Fix format
    
    * Fix formatting
    
    * Adding cancellation token good practice
  • .Net: Add Reasoning Model Integration tests (#100)
    * Add reasoning integration tests
    
    * Adding Reasoning Model config
  • Suggested tweaks to Agent (#88)
    - Id should return a stable ID, not a different value per access
    - The RunAsync virtuals needn't be virtuals... a derived type can/should override just the main worker abstract method
    - The protected methods should do argument validation
  • Add function call integration tests (#90)
    * Add function call tests
    
    * Address PR comment
  • Remove AdditionalInstructions from AgentRunOptions since it is not well supported outside of ChatClientAgents (#87)
    * Remove additional instructions from AgentRunOptions since it is not well supported outside of ChatClientAgents
    
    * Fix typos and remove unused test.
    
    * Make further namespace fixes and update AzureAIAgent with new tests.
    
    * Expand tests to increase code coverage
  • .Net: Added Azure AI Persistent Agents (#81)
    * Added PersistentAgentsChatClient
    
    * Added integration tests
    
    * Small fixes
    
    * Added sample
    
    * Added TODO for tools
    
    * Small rename
    
    * Removed user-secrets id
    
    * Renamed project
    
    * Fixed warning
    
    * Fixed warning
    
    * More fixes
    
    * More fixes
  • Add tests for ChatClientAgent with OpenAI responses (#82)
    * Add tests for ChatClientAgent with OpenAI responses
    
    * Address PR comments
    
    * Fix typo
  • Add additional integration tests and add OpenAIAssistant integration tests project. (#79)
    * Add additional integration tests and add OpenAIAssistant integration tests project.
    
    * Address PR comments.
    
    * Address PR comments.