Commit Graph

214 Commits

  • .NET: Align Foundry sample environment variables and credentials. (#6422)
    * dotnet: refresh Foundry sample guidance
    
    Carry forward the still-relevant sample guidance and Foundry-specific documentation fixes from the old stacked sample migration work, adapted to the current repo layout and policy.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * dotnet: rename Foundry sample env vars
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * dotnet: remove persistent provider sample
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * dotnet: drop SAMPLE_GUIDELINES.md from this PR
    
    Defer the guidelines doc and its cross-link to a follow-on PR to avoid broken-link failures in CI.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * dotnet: add DefaultAzureCredential warning to remaining samples
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * dotnet: address PR review feedback
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • .NET: Add LoopAgent capability for Harnesses (#6384)
    * Add LoopAgent capability for Harnesses
    
    * Address PR comments.
    
    * Add support for returning user messages and response aggregation
    
    * Support fresh context per iteration with input sessions via cloning
    
    * Add ability to receive newly created sessions via callback
    
    * Address PR comments
    
    * Add judge criteria
    
    * Address PR comments
  • .NET: Adds Valkey to chat message history - issue 5445 (#5542)
    * Adds Valkey to chat message history
    
    * Address review: switch to Valkey.Glide, add options class, remove context provider
    
    - Switch from StackExchange.Redis to Valkey.Glide 1.1.0 (official Valkey .NET client)
    - Extract optional params into ValkeyChatHistoryProviderOptions
    - Add JsonSerializerOptions support, remove [RequiresUnreferencedCode]
    - Make MaxMessages/MaxMessagesToRetrieve readonly via options
    - Remove ValkeyContextProvider (overlaps with ChatHistoryMemoryProvider + MEVD)
    - Remove ValkeyProviderScope (only used by context provider)
    - Remove connection string constructors (caller manages IConnectionMultiplexer)
    - Update samples to use new API and gpt-5.4-mini
    
    * Use type-safe JsonSerializer overloads, remove suppress attributes
    
    Use JsonSerializerOptions.GetTypeInfo() for Serialize/Deserialize calls
    to enable NativeAOT/trimming compatibility without suppress attributes.
    Default to AgentAbstractionsJsonUtilities.DefaultOptions when no options provided.
    
    Signed-off-by: Matthias Howell <matthias.howell@improving.com>
    
    * Update READMEs: remove context provider references
    
    Remove ValkeyContextProvider and long-term memory references from sample
    READMEs since the context provider was removed from this PR. Simplify
    Valkey server requirements (no search module needed for chat history).
    
    Signed-off-by: Matthias Howell <matthias.howell@improving.com>
    
    * Apply suggestion from @westey-m
    
    * Fix formatting (dotnet format)
    
    Signed-off-by: Matthias Howell <matthias.howell@improving.com>
    
    * Update dotnet/src/Microsoft.Agents.AI.Valkey/Microsoft.Agents.AI.Valkey.csproj
    
    Co-authored-by: Roger Barreto <19890735+rogerbarreto@users.noreply.github.com>
    
    ---------
    
    Signed-off-by: Matthias Howell <matthias.howell@improving.com>
    Co-authored-by: Matthias Howell <matthias.howell@yoppworks.com>
    Co-authored-by: westey <164392973+westey-m@users.noreply.github.com>
    Co-authored-by: Roger Barreto <19890735+rogerbarreto@users.noreply.github.com>
  • .NET: Hosted Agent Sample - Toolbox with various Auth (#5777) (#6018)
    * .NET: Add Hosted-Toolbox-AuthPaths sample and auto-map /readiness with toolbox health gating (#5777)
    
    Add a new hosted agent sample demonstrating five MCP tool authentication paths
    (API key, agent MI, project MI, custom OAuth, literal token) via a Foundry Toolbox.
    
    Package changes (Microsoft.Agents.AI.Foundry.Hosting):
    - MapFoundryResponses now auto-maps GET /readiness via MapHealthChecks, idempotent
      across Tier 1/2 (AgentHost, already mapped) and Tier 3 (WebApplication, gap filled).
    - AddFoundryResponses registers AddHealthChecks() so the pipeline is available.
    - AddFoundryToolboxes registers FoundryToolboxHealthCheck on the /readiness aggregate,
      gating readiness on pre-registered toolbox startup outcome (per spec section 3.1).
    - FoundryToolboxService now exposes StartupStatus and FailedToolboxNames properties.
    
    New types:
    - FoundryToolboxStartupStatus (public enum): Pending, Healthy, Failed, NoEndpoint.
    - FoundryToolboxHealthCheck (internal IHealthCheck): adapts startup status to the
      AspNetCore HealthChecks pipeline with failed toolbox names in result data.
    
    Tests:
    - 3 new tests for /readiness auto-mapping (Tier 3 default, pre-mapped skip, idempotent).
    - 4 new tests for FoundryToolboxHealthCheck (Pending, NoEndpoint, Failed, Healthy).
    - 3 enhanced FoundryToolboxServiceTests with StartupStatus assertions.
    
    * .NET: Align FoundryToolboxService with tools-integration-spec (#5777 Part A)
    
    Bring Microsoft.Agents.AI.Foundry.Hosting's toolbox path into compliance with
    tools-integration-spec.md sections 2-4, 6.3, and 9. Empirically validated
    against tao-foundry-prj: the previous code (reading FOUNDRY_AGENT_TOOLSET_ENDPOINT,
    which the platform never injects) silently registered zero tools in production.
    
    Package changes (Microsoft.Agents.AI.Foundry.Hosting):
    
    - FoundryToolboxService.StartAsync now derives the toolbox proxy base URL from
      the platform-injected FOUNDRY_PROJECT_ENDPOINT and constructs the per-toolbox
      URL as {FOUNDRY_PROJECT_ENDPOINT}/toolboxes/{name}/mcp?api-version={ApiVersion}
      per spec sections 2-3. The legacy FOUNDRY_AGENT_TOOLSET_ENDPOINT env var is
      removed outright (preview package, no production consumers).
    - FoundryToolboxOptions.ApiVersion default flipped to 'v1' to match spec example.
    - FoundryToolboxBearerTokenHandler always sends the mandatory
      Foundry-Features: Toolboxes=V1Preview header per spec section 2, merging any
      additional flags supplied via the FOUNDRY_AGENT_TOOLSET_FEATURES env var.
    - FoundryToolboxBearerTokenHandler token scope changed from
      https://cognitiveservices.azure.com/.default to https://ai.azure.com/.default
      per spec section 4.
    - FoundryToolboxBearerTokenHandler propagates W3C trace context (traceparent,
      tracestate, baggage) from Activity.Current per spec section 6.3.
    
    Sample changes:
    
    - Hosted-Toolbox-AuthPaths and Hosted-Toolbox Program.cs, README.md, and
      .env.example corrected to describe the actual env-var contract
      (FOUNDRY_PROJECT_ENDPOINT auto-injected; AZURE_AI_PROJECT_ENDPOINT as the
      local-dev fallback). Removes the misleading 'auto-injected by Foundry runtime'
      claims for FOUNDRY_AGENT_TOOLSET_ENDPOINT.
    - Hosted-Toolbox-AuthPaths/agent.manifest.yaml declares the toolbox and model
      dependencies under resources[] per the AgentManifest schema so azd ai agent
      init users get them provisioned automatically.
    
    Tests:
    
    - 4 new FoundryToolboxServiceTests covering env-var derivation, EndpointOverride
      precedence, trailing-slash normalization, and the existing NoEndpoint behavior
      under the new env var name.
    - 4 new FoundryToolboxBearerTokenHandlerTests covering token scope, mandatory
      feature header always present, header merging with override, no duplicate
      mandatory flag, trace context propagation from Activity.Current, and no
      override of caller-set traceparent.
    - New FoundryProjectEndpointEnvFixture xUnit collection definition serializes
      env-var-mutating tests across FoundryToolboxServiceTests and
      FoundryToolboxHealthCheckTests, preventing parallel-execution races.
    - FoundryToolboxHealthCheckTests adjusted for the new env var name.
    
    * .NET: Drop ACA prereq from Hosted-Toolbox-AuthPaths README (#5777 Part B)
    
    Empirically verified that any Azure Cognitive Services MCP endpoint already in
    the Foundry project (e.g., a Language service MCP) accepts Entra tokens and can
    serve Paths 2 and 3 without deploying a separate Azure MCP Server to ACA.
    
    README updates:
    - Step 0 rewritten: 'Identify an Entra-authenticated MCP target in your project'
      instead of 'Deploy Azure MCP Server to Azure Container Apps' (the original
      azmcp-foundry-aca-mi setup is now optional, not required).
    - Auth-paths matrix updated to describe AAD-based connections targeting a
      Cognitive Services MCP URL (e.g., Language service) instead of an ACA URL.
    - Step 2 connections table updated: the Entra ID category is now a single 'AAD'
      authType. The original 'Agent Identity' vs 'Project Managed Identity' as
      selectable connection sub-types is NOT exposed via the ARM control plane
      today; the platform selects the calling principal contextually. Both
      connections in the walkthrough share the same shape and target.
    - Added an explicit RBAC note: the agent identity AND project MI must hold the
      required role (typically Cognitive Services User) on the target resource;
      without it the MCP server returns HTTP 401 even though the connection wiring
      is correct.
    - Toolbox tool entries renamed lang_entra_agent / lang_entra_project to
      match the new connection names.
    
    Empirical validation supporting these changes is captured in the session
    plan.md (Part B addendum).
    
    * .NET: Document correct connection shape for Hosted-Toolbox-AuthPaths Paths 2/3 (#5777)
    
    Updates the sample README with the verified connection shape and RBAC procedure
    for Microsoft Entra agent-identity and project-managed-identity MCP authentication:
    
    - Connection authType values: AgenticIdentityToken (agent identity) and
      ProjectManagedIdentity (project MI), both with category=RemoteTool.
    - Top-level audience property required; for Cognitive Services targets the value
      is https://cognitiveservices.azure.com.
    - Connections created via ARM REST (the Foundry portal wizard does not yet
      expose these authTypes).
    - RBAC grants target the project's shared agent identity blueprint principal
      (project.properties.agentIdentity.agentIdentityId) for Path 2 and the
      project's system-assigned MI (project.identity.principalId) for Path 3.
    - Troubleshooting table updated with the audience-mismatch symptom and the
      startup-cache behavior of FoundryToolboxService.
    
    * .NET: Drop Path 3 (project MI) and align with new agent model in Hosted-Toolbox-AuthPaths (#5777)
    
    Updates the sample to use only the new Foundry agent object model and removes
    the project managed identity path:
    
    - Auth-path matrix reduced to four paths: key, Entra agent identity, custom
      OAuth, inline authorization. Project managed identity is moved into a note
      describing when it applies (multiple agents sharing access) rather than as
      a documented sample path.
    - RBAC instructions reference the agent's own instance_identity.principal_id
      from the agent ARM resource (new agent object model) instead of the
      project's shared agent identity blueprint (legacy model).
    - Step 2 (connections) creates only the AgenticIdentityToken connection.
    - Step 3 (toolbox tools) lists four tool entries instead of five.
    - Sample prompts and troubleshooting table updated to match.
    
    * .NET: Restore Path 3 (project MI) to Hosted-Toolbox-AuthPaths matrix (#5777)
    
    The sample's purpose is to enumerate every authentication path a Foundry toolbox
    can drive, not to pick one. Path 3 belongs alongside the other four with
    explicit guidance for when each path is the right choice.
    
    - Path 3 (project managed identity, authType=ProjectManagedIdentity) restored
      to the matrix with a 'When to pick this' column.
    - Step 2 (connections) provisions both lang-mcp-agent-id and lang-mcp-project-mi
      via ARM REST.
    - Step 3 (toolbox) lists five tool entries (one per path).
    - RBAC instructions cover both the agent's instance identity (Path 2) and the
      project's system-assigned MI (Path 3).
    - Sample prompts include all five paths.
    - Troubleshooting table updated accordingly.
    
    * .NET: Fix duplicate line in Hosted-Toolbox-AuthPaths README (#5777)
    
    * .NET: Fix broken markdown link to ToolCallingApprovalHostedAgentFixture (#5777)
    
    * .NET: Fix relative path depth in markdown link (#5777)
    
    * .NET: Address Copilot review feedback for #5777
    
    - FoundryToolboxHealthCheck description: rename FOUNDRY_AGENT_TOOLSET_ENDPOINT
      → FOUNDRY_PROJECT_ENDPOINT (stale reference; operator-facing in /readiness body).
    - FoundryToolboxStartupStatus.NoEndpoint XML doc: same rename.
    - ServiceCollectionExtensions XML docs: same rename + URL shape update.
    - Foundry.Hosting.IntegrationTests.TestContainer: remove explicit
      app.MapGet('/readiness') — now redundant + would conflict with the
      auto-mapped readiness route from MapFoundryResponses.
    - Hosted-Toolbox-AuthPaths agent.manifest.yaml: parameterize TOOLBOX_NAME via
      {{TOOLBOX_NAME}} template substitution and declare it under parameters with a
      default of 'auth-paths-toolbox' so the README's 'use any name' guidance
      actually works for hosted deployments.
    
    * .NET: Address Copilot review round 2 — fallback env + dedup + naming (#5777)
    
    - FoundryToolboxService.StartAsync: fall back to AZURE_AI_PROJECT_ENDPOINT when
      FOUNDRY_PROJECT_ENDPOINT is absent. Matches the local-dev convention used by
      the samples and resolves the doc/code mismatch flagged in review.
    - FoundryToolboxHealthCheck description updated for the fallback.
    - AddFoundryToolboxes: guard against duplicate health-check registration via an
      explicit name-uniqueness check on HealthCheckServiceOptions.Registrations.
      AddCheck<T>(name, ...) does not dedupe by name, so repeated AddFoundryToolboxes
      calls would have registered multiple instances.
    - FoundryToolboxOptions.EndpointOverride doc: clarify URL becomes
      {EndpointOverride}/toolboxes/{name}/mcp (was missing /toolboxes/ segment).
    - Hosted-Toolbox sample (Program.cs + README): switch FOUNDRY_TOOLBOX_NAME to
      TOOLBOX_NAME (the FOUNDRY_* prefix is reserved by the platform), default
      changed from 'my-toolset' to 'my-toolbox', terminology updated from 'Toolset'
      to 'Toolbox'.
    - FoundryToolboxServiceTests: 2 test renames to reflect what they actually
      assert (StartupStatus + FailedToolboxNames, not URL shape directly).
    - Tests adjusted to clear both env vars in NoEndpoint scenarios.
    
    * .NET: Fix stale NoEndpoint XML doc and misleading test comment (#5777)
    
    Update FoundryToolboxStartupStatus.NoEndpoint XML doc to mention both
    FOUNDRY_PROJECT_ENDPOINT and AZURE_AI_PROJECT_ENDPOINT (the service
    checks both since the fallback was added).
    
    Fix test comment that claimed URL derivation validation when the test
    only asserts on StartupStatus and FailedToolboxNames.
    
    * Remove OAuth consent path from AuthPaths sample, keep four working auth paths
    
    The interactive OAuth identity passthrough path needs a protocol gap closed in the
    hosting package (the proprietary oauth_consent_request item is not representable
    through the OpenAI/MEAI abstractions), so it is deferred to a separate spike branch.
    
    This strips the OAuth path from the AuthPaths sample, the companion REPL client, the
    agent manifest, and the docs, then renumbers the inline Authorization path so the
    sample teaches four contiguous paths: API key via connection, Entra agent identity,
    Entra project managed identity, and inline Authorization (anti-pattern).
    
    Package code is unchanged; the consent infrastructure already present in main stays
    as baseline. Both samples build with --warnaserror and all 246 hosting unit tests pass.
    
    * .NET: Drop project MI auth path and dedicated client from Hosted-Toolbox-AuthPaths (#5777)
    
    Live validation against tao-foundry-prj showed the ProjectManagedIdentity
    path failing with an unresolved token audience 401, so the sample now ships
    three working auth paths instead of four: connection key, agent managed
    identity, and inline Authorization.
    
    Changes:
    - Remove the project managed identity path from the AuthPaths sample matrix,
      prerequisites, connections, toolbox table, prompts, Program.cs instructions
      and agent.manifest.yaml.
    - Delete the near duplicate Hosted-Toolbox-AuthPaths-Client project and remove
      it from the solution. The README now drives the agent with the shared
      SimpleAgent REPL via AsAIAgent(agentEndpoint).
    - Correct the troubleshooting note: the Foundry toolbox tools/list is all or
      nothing, so one bad source returns -32007, fails startup, and returns 424
      for every path. Add the allowed_tools caveat that names must match the
      upstream server.
    - Mark the toolbox startup status and health check experimental under
      AgentsAIExperiments (MAAI001) instead of AIOpenAIResponses, and update the
      package NoWarn set accordingly.
    
    * .NET: Address PR review nits for Hosted-Toolbox-AuthPaths (#5777)
    
    - Remove duplicated NU1903 comment in Foundry.Hosting csproj.
    
    - Fix stale 'four-tool' cross-links in Hosted-Toolbox and Hosted-McpTools READMEs to describe the three-path toolbox driven by the shared SimpleAgent REPL.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * .NET: Address toolbox startup-status review feedback (#5777)
    
    - Rename FoundryToolboxStartupStatus.Failed to Unhealthy so it is the proper opposite of Healthy, and clarify the doc comment covers the partial-failure case.
    
    - Raise the missing-endpoint toolbox log from Information to Warning, since enabling toolboxes is an explicit opt-in and a silently disabled toolbox warrants a higher-severity signal.
    
    - Update unit tests and the AuthPaths README troubleshooting row accordingly.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * .NET: Reword toolbox-wiring comment to avoid hosting-layer internals (#5777)
    
    Address PR review feedback: explain how a Foundry Toolbox is attached using the public API (AddFoundryToolboxes vs the CreateHostedMcpToolbox marker) and observable behavior, instead of naming the internal AgentFrameworkResponseHandler type and FoundryToolboxService.Tools property.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • .NET: Add Hosted-ToolboxMcpSkills sample (#6175)
    * .NET: Add Hosted-ToolboxMcpSkills sample
    
    Adds a hosted Foundry Responses sample that discovers MCP-based skills from a Foundry Toolbox and makes them available to the agent via AgentSkillsProvider.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Align README and Program.cs default model to gpt-5
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Clarify MCP skills provider log to avoid implying eager discovery
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Drop redundant skills provider configured log
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Add Foundry Toolbox Skills tag to manifest
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Simplify BearerTokenHandler by deriving from HttpClientHandler
    
    Removes the need for an explicit InnerHandler. Enables CheckCertificateRevocationList to satisfy CA5399.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • .NET: Support ClaimsIdentity-based scoping of agent sessions (#5696)
    * feat: Add DelegatingAgentSessionStore
    
    Add helper for decorator pattern for AgentSessionStore
    
    * feat: Add UserIdentityScopedSessionStore
    
    Add support for using the ASP.Net Core ambient `ClaimsIdentity` User, along with a user-specified claim type to scope the session store based on authenticated identity.
    
    * fix: Harden scope mapping
    
    * fix: Add UserIdentityScopeSessionStoreOptions to avoid future breaking changes
    
    * Split UserIdentityScopedSessionStore into a separate IsolationKeyProvider and IsolationKeyScopedSessionStore
    
    * Add GetService<>() capabilities to interrogate AgentSessionStore delegation chain
    
    * Harden default for A2A hosting by using an IsolationKeyScopedAgentSessionStore when no store is available.
    
    * Pipe isolation through Hosting helper extension methods
    
    * Add comment to samples about adding SessionIsolationKeyProvider
    
    * Fix isolation key provider nullability semantics
    
    * fix A2A defaults
    
    * fixup
    
    * remove unneeded keyProvider requirement test
    
    * Add trust-model XML docs to AgentSessionStore, InMemoryAgentSessionStore, MapAGUI, A2A entry points
    
    Agent-Logs-Url: https://github.com/microsoft/agent-framework/sessions/e466c53a-faad-40a8-8b5f-83cf0dce0b1d
    
    Co-authored-by: lokitoth <6936551+lokitoth@users.noreply.github.com>
    
    * fix: Switch ClaimsBasedIsolationKeyProvider to be Singleton
    
       * matches HttpContextAccessor and related MAF services
    
    * release: Ensure new project is in the release filter
    
    * fixup: Integraitaon tests
    
    ---------
    
    Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
    Co-authored-by: lokitoth <6936551+lokitoth@users.noreply.github.com>
  • .NET: Add Foundry Toolbox MCP skills discovery sample (#6134)
    * feat: add Agent_Step26_FoundryToolboxMcpSkills sample
    
    Add a new sample demonstrating MCP-based skills discovery from a Foundry
    Toolbox endpoint using AgentSkillsProviderBuilder and AIContextProviders.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * fix: address PR review comments for Step26 sample
    
    - Add Foundry-Features: Toolboxes=V1Preview header to MCP transport
      options, matching the Step25 pattern
    - Document skill://index.json prerequisite in README
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Update dotnet/samples/02-agents/AgentsWithFoundry/Agent_Step26_FoundryToolboxMcpSkills/Program.cs
    
    Co-authored-by: Roger Barreto <19890735+rogerbarreto@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    Co-authored-by: Roger Barreto <19890735+rogerbarreto@users.noreply.github.com>
  • .NET: [BREAKING] Remove Support for Code-Gen in Declarative Workflows (#6095)
    * Removed
    
    * Remove sample
    
    * Remove orphaned code-gen related code path
    
    * Remove remaining references to code gen.
    
    ---------
    
    Co-authored-by: Chris Rickman <crickman@microsoft.com>
    Co-authored-by: Chris <66376200+crickman@users.noreply.github.com>
  • .NET: Add MCP-based skills support (skill-md type) (#6108)
    * Add MCP-based skills support
    
    - Add AgentMcpSkill, AgentMcpSkillResource, AgentMcpSkillsSource, and McpSkillIndex to Microsoft.Agents.AI.Mcp
    - Add AgentSkillsProviderBuilderMcpExtensions for DI integration
    - Add Agent_Step06_McpBasedSkills sample project
    - Add unit tests for AgentMcpSkillsSource
    - Update solution file and project references
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Remove unnecessary [Experimental] attributes from MCP package
    
    The package is already alpha, so the [Experimental] attribute is redundant.
    Removed from both AgentSkillsProviderBuilderMcpExtensions and
    AgentMcpSkillsSource classes.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Make Agent_Step06_McpBasedSkills self-contained and add to verify-samples
    
    Embed an internal MCP server (launched via --server flag as a child process)
    that serves skill://index.json and skill://unit-converter/SKILL.md resources,
    replacing the external MCP_SKILLS_ENDPOINT dependency. The sample now uses
    StdioClientTransport and a fixed prompt instead of an interactive loop.
    
    Added SampleDefinition to AgentsSamples.cs for automated verification.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Sort usings
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • .NET: Add Hosted-AgentSkills sample with Foundry Skills integration (#6013)
    * .NET: Add Hosted-AgentSkills sample for Foundry Skills integration
    
    Add a new hosted agent sample that demonstrates how to load behavioral
    guidelines from Foundry Skills at startup using AgentSkillsProvider and
    the progressive disclosure pattern (advertise -> load on demand).
    
    The sample:
    - Downloads SKILL.md files from Foundry via ProjectAgentSkills SDK
    - Extracts ZIP archives with zip-slip protection
    - Wires skills into AgentSkillsProvider as an AIContextProvider
    - Hosts the agent via the Responses protocol
    
    Ships two Contoso Outdoors skills matching the Python sample (PR #5822):
    - support-style: tone, formatting, signature guidelines
    - escalation-policy: when and how to escalate tickets
    
    Includes convenience provisioning gated behind PROVISION_SAMPLE_SKILLS
    env var, clearly documented as NOT a production pattern.
    
    Closes #5776
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * .NET: Add unit tests and integration test for Hosted-AgentSkills
    
    Unit tests (14 tests, all passing):
    - ZIP extraction with zip-slip guard (valid archive, traversal attack,
      sibling-prefix attack, directory entries)
    - Skill name validation (rejects dots, separators, traversal patterns)
    - AgentSkillsProvider with downloaded skills (advertises both skills,
      load_skill returns canary tokens, unknown skill returns error)
    
    Container integration test:
    - New 'agent-skills' scenario in the test container that creates
      Contoso Outdoors skills on disk and wires AgentSkillsProvider
    - AgentSkillsHostedAgentFixture + 4 integration tests verifying:
      - Routine questions load support-style skill (STYLE-CANARY-3318)
      - Escalation triggers load escalation-policy (ESC-CANARY-7742)
      - Skills are advertised in system prompt
      - load_skill tool is invoked via FunctionCallContent
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * .NET: Add smoke test, bootstrap, and docs for agent-skills integration
    
    - Add scripts/smoke.ps1 for local Docker smoke testing: builds the
      contributor image, runs the container, verifies both skills are loaded
      via canary tokens (STYLE-CANARY-3318, ESC-CANARY-7742)
    - Add 'agent-skills' to the bootstrap script scenario list
    - Add agent-skills row to the integration test README scenarios table
    - Exclude HostedAgentSkillsPatternTests from net472 (uses net8.0+ APIs)
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * .NET: Update commented-out package versions to latest across all hosted samples
    
    Update the end-user PackageReference versions (in the commented-out
    sections) from 1.0.0 to the current latest NuGet versions:
    
    - Microsoft.Agents.AI: 1.6.1
    - Microsoft.Agents.AI.Foundry: 1.6.1-preview.260514.1
    - Microsoft.Agents.AI.Foundry.Hosting: 1.6.1-preview.260514.1
    - Microsoft.Agents.AI.Hosting: 1.6.1-preview.260514.1
    - Microsoft.Agents.AI.OpenAI: 1.6.1
    - Microsoft.Agents.AI.Workflows: 1.6.1
    
    Also adds explicit versions to Hosted-Workflow-Handoff which had bare
    PackageReference entries without Version attributes.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * .NET: Fix broken markdown links in Hosted-AgentSkills README
    
    Remove references to non-existent ../../README.md. Replace with
    inline instructions matching other hosted samples that don't have
    a parent README.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * .NET: Use OS-appropriate string comparison in zip-slip guard
    
    Use Ordinal on Unix (case-sensitive FS) and OrdinalIgnoreCase on
    Windows to prevent case-based path bypass on Linux containers.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • .NET: Add MCP long-running task support for MCP client tools (#5994)
    * Add MCP long-running task support for MCP client tools
    
    * Fixed project file formatting issue.
    
    * Removed experimentation tag from MCP alpha project.
    
    * Addressed PR comments
  • .NET: Add Magentic Orchestration Sample (#5823)
    * Add Magentic orchestration sample scaffold
    
    Agent-Logs-Url: https://github.com/microsoft/agent-framework/sessions/8799740a-74d8-4100-b6f6-76dcd0418c87
    
    Co-authored-by: lokitoth <6936551+lokitoth@users.noreply.github.com>
    
    * Validate Magentic orchestration sample
    
    Agent-Logs-Url: https://github.com/microsoft/agent-framework/sessions/8799740a-74d8-4100-b6f6-76dcd0418c87
    
    Co-authored-by: lokitoth <6936551+lokitoth@users.noreply.github.com>
    
    * Document follow-up changes for the Magentic .NET sample
    
    Agent-Logs-Url: https://github.com/microsoft/agent-framework/sessions/caa3488f-d6f5-494d-a928-a45d6a98b3c3
    
    Co-authored-by: lokitoth <6936551+lokitoth@users.noreply.github.com>
    
    * Remove CHANGES.md from Magentic sample
    
    Agent-Logs-Url: https://github.com/microsoft/agent-framework/sessions/ffab38e2-37f9-4643-a782-20680573965a
    
    Co-authored-by: lokitoth <6936551+lokitoth@users.noreply.github.com>
    
    * Fix PauseIfInteractive to also skip when stdout is redirected
    
    Agent-Logs-Url: https://github.com/microsoft/agent-framework/sessions/07ddf735-29cc-4775-b588-fd71ca76fa58
    
    Co-authored-by: lokitoth <6936551+lokitoth@users.noreply.github.com>
    
    * fix: Update for PR Review Feedback
    
    * fix: Update Sample README for PR Feedback
    
    ---------
    
    Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
    Co-authored-by: lokitoth <6936551+lokitoth@users.noreply.github.com>
    Co-authored-by: Jacob Alber <jaalber@microsoft.com>
  • .NET: Add additional openai specific error observers and move them to openai project (#6004)
    * Add additional openai specific error observers and move them to openai project
    
    * Address PR comments
  • .NET: Harness code act skill sample (#5930)
    * Add sample that shows code execution and skills together
    
    * Use nuget for python module path
    
    * Update readme.
    
    * Fix formatting.
    
    * Reduce flashing in rendering.
    
    * Improve screen clearing for Powershell
    
    * Add a couple of small UX fixes
  • .NET: Require TODO finish reason and rename SubAgents to BackgroundAgents (#5902)
    * Require TODO finish reason and rename SubAgents to BackgroundAgents
    
    * Address PR comments
  • .NET: Add Hosted-MemoryAgent sample with isolation key plumbing (#5692) (#5702)
    * .NET: Add Hosted-MemoryAgent sample with isolation key plumbing (#5692)
    
    Adds HostedSessionContext + HostedSessionIsolationKeyProvider in Microsoft.Agents.AI.Foundry.Hosting so AIContextProviders (notably FoundryMemoryProvider) can scope per user via the platform's x-agent-user-isolation-key / x-agent-chat-isolation-key headers.
    
    - New types: HostedSessionContext (sealed), HostedSessionContextExtensions (public Get, internal Set), abstract HostedSessionIsolationKeyProvider (async), internal PlatformHostedSessionIsolationKeyProvider mapping ResponseContext.Isolation.
    
    - AgentFrameworkResponseHandler now resolves the provider, tags fresh sessions, and validates resumed sessions against the live request (strict 403 'Hosted session identity context mismatch' on any mismatch; 500 on null keys).
    
    - New shared sample project Hosted_Shared_Contributor_Setup hosts DevTemporaryTokenCredential and DevTemporaryLocalSessionIsolationKeyProvider plus AddDevTemporaryLocalContributorSetup. All 9 existing responses samples migrated to consume it so local runs keep working under the strict isolation contract.
    
    - New Hosted-MemoryAgent sample: travel assistant wired through FoundryMemoryProvider with stateInitializer reading session.GetHostedContext().UserId. Includes Dockerfile, smoke.ps1, agent.yaml/manifest.
    
    - New IT scenario 'memory' in Foundry.Hosting.IntegrationTests + MemoryHostedAgentFixture + MemoryHostedAgentTests. Verified end to end against the tao Foundry project.
    
    - ADR 0026 captures the design tree.
    
    * Address PR review feedback
    
    - Dockerfile: add header noting it targets NuGet builds; contributors must use Dockerfile.contributor for ProjectReference source builds.
    
    - PlatformHostedSessionIsolationKeyProvider: doc said 'returns context with empty values'; corrected to 'returns null' which the handler treats as 500.
    
    - FakeHostedSessionIsolationKeyProvider: doc clarifies that null configurations are allowed for testing the handler error path.
    
    - HostedSessionContextExtensions.SetHostedContext: enforce write-once with InvalidOperationException; doc + xml exception updated.
    
    - AgentFrameworkResponseHandler: cache PlatformHostedSessionIsolationKeyProvider as static readonly to avoid per-request allocation.
    
    - MemoryHostedAgentTests: tighten waits from 20s to 5s (FoundryMemoryProvider defaults UpdateDelay=0; ingestion ~3s).
    
    - Sample Program.cs imports reordered to satisfy IDE0005.
    
    * Add HostedFoundryMemoryProviderScopes built-in helpers (#5692)
    
    Addresses review feedback from @lokitoth on Hosted-MemoryAgent/Program.cs:54.
    
    - New HostedFoundryMemoryProviderScopes static class with PerUser, PerChat, PerUserAndChat factories returning Func<AgentSession?, FoundryMemoryProvider.State>.
    
    - All helpers throw InvalidOperationException when GetHostedContext() is null, with a message pointing at writing a custom stateInitializer for non-hosted scenarios.
    
    - New HostedFoundryMemoryScope enum and AddHostedFoundryMemoryProvider DI extension (two overloads: explicit AIProjectClient and DI-resolved). Singleton lifetime. Default scope = PerUser.
    
    - Hosted-MemoryAgent sample and the memory IT scenario container both swap their inline lambdas for HostedFoundryMemoryProviderScopes.PerUser().
    
    - 14 new unit tests (241/241 hosting unit tests pass).
    
    * Replace HostedFoundryMemoryScope enum with Func<...> parameter (#5692)
    
    Address PR review feedback from @westey-m: enums are a breaking-change hazard when extended, and the enum was redundant with the existing HostedFoundryMemoryProviderScopes static class.
    
    - Delete HostedFoundryMemoryScope.cs.
    
    - AddHostedFoundryMemoryProvider DI extensions now take Func<AgentSession?, FoundryMemoryProvider.State>? stateInitializer = null. When null, default to HostedFoundryMemoryProviderScopes.PerUser().
    
    - Callers pick a built-in helper (PerUser/PerChat/PerUserAndChat) or pass a custom delegate. New built-ins are a single static method addition with zero impact on existing callers.
    
    - Tests updated; 244/244 hosting unit tests pass.
    
    * Fix isolation context resume for externally-created conversations (#5692)
    
    Branch on the session's existing hosted-context (not on conversation_id presence) so a conversation provisioned externally (e.g. via conversations.CreateProjectConversationAsync) is treated as fresh on first hosted-agent request and stamped, rather than rejected with 403 hosted_session_identity_mismatch. Strict equality is preserved on real resume of an already-stamped session.
    
    Also tighten dotnet/global.json to version 10.0.204 + rollForward latestPatch so local builds match the CI Docker image SDK and avoid 10.0.300 dotnet format stripping required usings.
    
    * Revert global.json SDK pin to upstream (#5692)
    
    The 10.0.204 + latestPatch pin from the previous commit broke the dotnet-format CI job (hostfxr_resolve_sdk2 could not find a compatible SDK in the mcr.microsoft.com/dotnet/sdk:10.0 image). Restore upstream 10.0.200 + minor; local Release builds with SDK 10.0.300 should set GITHUB_ACTIONS=true to bypass the auto-format-on-build target.
  • .NET: Add sample for invoking Foundry Toolbox tools from declarative workflows (#5829)
    * Add sample for invoking Foundry Toolbox tools from declarative workflows
    
    * Addressed initial PR comments.
  • .NET: feat(evals): add ground_truth/expected_output support for workflow evaluation (#5755)
    * .NET: feat(evals): add ground_truth/expected_output support for workflow eval
    
    Brings .NET to parity with Python PR #5234 for issue #5135:
    
    - Add expectedOutput parameter to Run.EvaluateAsync (workflow) and stamp on the overall EvalItem.ExpectedOutput.
    - Map EvalItem.ExpectedOutput -> ground_truth in the Foundry JSONL payload, item_schema, and data_mapping for similarity.
    - Add GroundTruthEvaluators set (currently builtin.similarity) and a FindMissingGroundTruthEvaluators helper.
    - Fail fast with InvalidOperationException when a ground-truth evaluator is selected but no item provides an ExpectedOutput, instead of surfacing a remote provider error.
    - Add tests in FoundryEvalConverterTests and WorkflowEvaluationTests.
    - Add Evaluation_WorkflowExpectedOutputs sample (workflow + Foundry similarity).
    
    Fixes microsoft/agent-framework#5135 (.NET side).
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Address review: relax BuildOverallItem events to IReadOnlyList<WorkflowEvent>
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Sample: disable per-agent breakdown when using reference-based evaluator
    
    Per-agent EvalItems are intentionally left without ExpectedOutput, so the new fail-fast validation in FoundryEvals would throw when Similarity is invoked for per-agent items. Pass includePerAgent: false in the workflow + similarity sample, and document this gotcha in the EvaluateAsync XML doc.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fix BuildOverallItem: fall back to last ExecutorCompletedEvent
    
    AgentResponseEvent is only emitted when AIAgentHostOptions.EmitAgentResponseEvents is enabled, which is not the default for WorkflowBuilder(agent).AddEdge(...). When it is absent, fall back to the last non-internal ExecutorCompletedEvent whose Data is an AgentResponse / ChatMessage / string so the overall EvalItem (and any expectedOutput) is produced. Without this, samples wired up the standard way returned 0 evaluation items.
    
    Update test to cover the fallback path.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Sample: enable EmitAgentResponseEvents; eval throws clear error when no overall response found
    
    Root cause of '0 results': AIAgentHostExecutor only emits AgentResponseEvent when AIAgentHostOptions.EmitAgentResponseEvents is true (default false). For ordinary AIAgent executors the runtime's ExecutorCompletedEvent.Data is null, so the prior fallback couldn't find a final response either.
    
    Sample now builds executors with EmitAgentResponseEvents=true via BindAsExecutor(hostOptions). EvaluateAsync now throws InvalidOperationException with a remediation hint when the user supplies expectedOutput but no overall final response can be located, instead of silently returning 0/0.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Guard against null sample/error/usage/datasource_item in ParseDetailedItem
    
    Foundry eval responses can have these properties present with JSON null
    or non-object values, which caused JsonElement.TryGetProperty to throw
    'requires Object, has Null'. Check ValueKind == Object before drilling in.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Address PR review: reorder expectedOutput, tighten ground-truth check, add fail-fast test
    
    * WorkflowEvaluationExtensions.EvaluateAsync: move 'expectedOutput' to
      after 'splitter' so the original positional contract of (splitter,
      cancellationToken) is preserved for existing callers.
    * FoundryEvals: require ALL items to carry ExpectedOutput when a
      ground-truth evaluator is selected (e.g. similarity), not just any.
      Reference-based evaluators score per-item, so a single missing GT
      would still surface as a provider-side validation error. Updated
      fail-fast message accordingly.
    * WorkflowEvaluationTests: add EvaluateAsync_WithExpectedOutputButNoFinalResponse_ThrowsAsync
      to verify the InvalidOperationException is thrown (and that the
      message mentions EmitAgentResponseEvents).
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fail-fast on missing overall item regardless of expectedOutput; harden BuildOverallItem default
    
    * EvaluateAsync now throws InvalidOperationException whenever 'includeOverall'
      is requested but BuildOverallItem cannot produce an item, instead of only
      when 'expectedOutput' is supplied. Same misconfiguration (agents not bound
      with EmitAgentResponseEvents) used to silently return empty results — now
      it surfaces a clear, actionable error in both cases.
    * BuildOverallItem switch default now throws instead of returning null. The
      preceding for-loop already constrains Data to AgentResponse/ChatMessage/
      string, so reaching default would indicate a contract drift; throw to make
      the bug visible.
    * Test renamed and broadened to verify the throw fires without expectedOutput.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: alliscode <25218250+alliscode@users.noreply.github.com>
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • .NET: Add harness agent package (#5782)
    * Add harness agent package
    
    * Fix formatting.
    
    * Fix formatting.
    
    * Update release filter
    
    * Address PR comments.
  • .NET: Feat/dotnet shell tool (#5604)
    * feat(dotnet): add Microsoft.Agents.AI.Tools.Shell with LocalShellTool
    
    Ports Python LocalShellTool to .NET as a new package (net8/9/10).
    
    - Microsoft.Agents.AI.Tools.Shell: LocalShellTool, ShellPolicy (deny-list
      guardrail), ShellResolver (cross-OS pwsh/powershell/cmd vs bash/sh),
      ShellResult with head+tail truncation, timeout + process-tree kill,
      AsAIFunction with required-by-default human approval gate.
    - Persistent mode via ShellSession (sentinel protocol over pwsh/bash).
    - acknowledgeUnsafe parity gate matches the Python implementation.
    - Auto-injected platform context in the AIFunction description so the
      LLM sees the active OS and shell at tool-discovery time.
    - 17 xunit.v3 tests cover policy allow/deny, echo roundtrip, exit
      codes, timeout/kill, AsAIFunction shape + approval wrapping,
      persistent cwd/env carry-over, head+tail truncation, sentinel race.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * feat(shell): close Python parity gaps for LocalShellTool
    
    Closes the .NET vs Python parity gaps identified in the competitive eval:
    
    - Default mode flipped to ShellMode.Persistent (matches Python). Every
      call now reuses a long-lived shell so cd/exports/functions persist;
      pass mode: ShellMode.Stateless to opt out.
    - New IShellExecutor interface — pluggable backend so future
      DockerShellTool / Hyperlight / SSH executors don't fork the framework.
      LocalShellTool implements it.
    - Workdir confinement: confineWorkingDirectory (default true) re-anchors
      every persistent-mode command back to workingDirectory so a wandering
      cd in one call doesn't leak to the next. Mirrors Python _maybe_reanchor.
    - Graceful interrupt on timeout: ShellSession sends SIGINT (POSIX) or
      Ctrl+C-on-stdin (Windows) before falling back to a hard close+respawn.
      Successfully-interrupted commands return exit 124 + TimedOut=true while
      preserving session state for the next call.
    - cleanEnvironment opt-in: when true, only PATH/HOME/USER/USERNAME/
      USERPROFILE/SystemRoot/TEMP/TMP plus user-supplied vars are visible.
    - shellArgv: IReadOnlyList<string> override accepted alongside the
      string shell binary param (mutually exclusive). Lets advanced callers
      inject flags like --rcfile or --login.
    - Typed exceptions ShellTimeoutException and ShellExecutionException
      replace InvalidOperationException for launch / liveness failures.
    
    Tests: 17 -> 23. New cases cover persistent-default ctor, mutually-
    exclusive shell/shellArgv, confined re-anchor, confine-disabled leak,
    clean-env strip, and IShellExecutor implementation. All green on net10.0.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * feat(shell): add DockerShellTool sandboxed shell tier
    
    Ports the Python DockerShellTool to .NET. Mirrors the public surface of
    LocalShellTool but executes commands inside an isolated container, where
    the container is the security boundary. Stateless and persistent modes
    both supported; persistent mode reuses ShellSession by launching
    'docker exec -i <ctr> bash --noprofile --norc' as the long-lived REPL,
    so the sentinel protocol works unchanged.
    
    Defaults chosen for safety:
    - --network none, --user 65534:65534 (nobody), --read-only root
    - --cap-drop=ALL, --security-opt=no-new-privileges
    - 512m memory cap, pids-limit 256, --tmpfs /tmp
    - Optional host workdir mount, ro by default
    
    Public surface:
    - DockerShellTool ctor with image/container_name/mode/host_workdir/
      workdir/network/memory/pids_limit/user/read_only_root/extra_run_args/
      environment/policy/timeout/max_output_bytes/on_command/docker_binary
    - StartAsync, CloseAsync, RunAsync, AsAIFunction, IShellExecutor impl
    - IsAvailableAsync(binary) probe
    - Static argv builders (BuildRunArgv, BuildExecArgv) — pure, side-
      effect free, so unit tests don't need a Docker daemon
    
    AsAIFunction defaults to requireApproval: false (the container IS the
    boundary). LocalShellTool keeps the opposite default.
    
    Tests: 23 -> 35. 12 new tests cover argv builders, env/extra-args/host-
    workdir flags, exec interactive vs stateless, container name uniqueness,
    IShellExecutor implementation, AsAIFunction approval defaults, and
    IsAvailableAsync false-path. None require Docker. Multi-TFM build
    (net8/9/10) green.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * test(shell): add DockerShellTool integration tests
    
    Adds 9 end-to-end tests that exercise DockerShellTool against a live
    Docker (or Podman) daemon. Tests are tagged [Trait("Category",
    "Integration")] and auto-skip via Assert.Skip when no daemon is
    available, so they are CI-safe.
    
    Coverage:
    - IsAvailableAsync probe
    - Persistent mode basic command + state preservation across calls
    - --network none blocks outbound DNS
    - --read-only root prevents writes outside /tmp; /tmp tmpfs is writable
    - --user 65534:65534 (nobody) is in effect
    - Stateless mode: env vars do not leak across calls
    - HostWorkdir bind-mount + read-only enforcement
    - Environment variables passed via -e
    
    Tests use debian:stable-slim (alpine ships only busybox sh, which
    ShellSession persistent bash REPL cannot drive).
    
    Run locally:
      dotnet test --filter "Category=Integration"
    or filter by class on the test exe directly.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * style(shell): apply dotnet format pass
    
    - Whitespace and code-style fixes from `dotnet format` across both
      projects
    - Convert all new files to UTF-8 with BOM and LF line endings
      (repo convention)
    - Rename ShellSession statics to s_ prefix (IDE1006)
    - Add Async suffix to async test methods (IDE1006)
    
    No behavioral changes. All 44 tests still pass on net10.0; multi-TFM
    build (net8/net9/net10) green. `dotnet format --verify-no-changes`
    now reports clean for both projects.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * docs(shell): add DockerShellTool walkthrough with sequence diagrams
    
    Explains the mental model (we shell out to the docker CLI; we never speak the engine API), the hardened docker run argv, persistent vs stateless lifecycles with mermaid sequence diagrams, the full agent-to-bash call ladder, and the failure modes.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * PR 5604 review fixes (group a): libc DllImport, namespace cleanup, policy-msg dedup
    
    Three quick-win review comments on PR #5604:
    
    1. ShellSession: the libc `killpg` P/Invoke was annotated with
       `DllImportSearchPath.System32`, a Windows-only loader hint that does
       nothing for libc.so on POSIX. Switched to `SafeDirectories` (CA5392
       /CA5393 clean) and added a comment noting the call site is gated to
       non-Windows.
    
    2. DockerShellToolTests: replaced the fully-qualified
       `Extensions.AI.ApprovalRequiredAIFunction` with a `using
       Microsoft.Extensions.AI;` import and the bare type name, matching
       `LocalShellToolTests`.
    
    3. LocalShellTool / DockerShellTool: `AsAIFunction`'s catch block was
       producing a doubled "Command blocked by policy: Command rejected by
       policy: ..." prefix because the `ShellPolicyException` message
       already starts with "Command rejected by policy". Now we return
       `ex.Message` directly.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * PR 5604 review fix (group b): add ShellKind.Sh for /bin/sh fallback
    
    Review comment (#3): when /bin/bash is missing the resolver fell back to
    /bin/sh but tagged it as ShellKind.Bash, so the launcher passed bash-only
    flags --noprofile --norc to dash/ash/busybox, which interpret them as
    positional script names.
    
    Fix:
    
    * Added ShellKind.Sh for minimal POSIX shells (sh, dash, ash, busybox).
    * /bin/sh fallback is now tagged Sh.
    * ClassifyKind maps "SH" / "DASH" / "ASH" / "BUSYBOX" binary names to Sh.
    * StatelessArgvForCommand emits just `-c <command>` for Sh (no
      bash-only flags); PersistentArgv emits no flags at all.
    * LocalShellTool's system-prompt builder describes Sh distinctly and
      warns the model away from bash-only constructs.
    
    Tests: ShellResolverTests covers Sh/Bash classification through the
    observable argv output (14 new theory cases). Total: 58/58.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * PR 5604 review fix (group d): honor timeout=null, add DefaultTimeout
    
    Review comment (#5): both LocalShellTool and DockerShellTool documented
    `timeout: null` as "disables timeouts" but the constructor coerced null
    to 30 seconds, making the documented disable mechanism unreachable
    through the public API.
    
    Fix:
    
    * Drop the `?? TimeSpan.FromSeconds(30)` coercion in both ctors.
      `_timeout` now faithfully reflects what the caller passed (null =
      disabled). The downstream CTS-construction sites already short-circuit
      on null, so no other code changes are required.
    * Add `public static readonly TimeSpan DefaultTimeout` (30 s) on both
      tools so callers who want a bounded timeout can opt in explicitly.
    
    Tests:
    
    * New `RunAsync_NullTimeout_DoesNotTimeOutAsync` confirms a quick
      command runs to completion when the caller passes `timeout: null`.
    * New `DefaultTimeout_IsThirtySeconds` documents the constant.
    
    Behavioral note: this is a deliberate change-of-default. Callers that
    previously omitted `timeout` and relied on the implicit 30 s now get
    "no timeout". They should pass `LocalShellTool.DefaultTimeout` or
    `DockerShellTool.DefaultTimeout` explicitly to preserve the prior
    behavior.
    
    Tests: 60/60 (44 baseline + 14 resolver + 2 new timeout tests).
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * PR 5604 review fix (group e): smart requireApproval default for DockerShellTool
    
    Review comment (#6, design): requireApproval: false baked in a
    safety decision the type cannot prove on its own. Callers can
    weaken any isolation knob (network, user, readOnlyRoot, mount,
    extraRunArgs) and still get an unapproved tool by default.
    
    Fix:
    
    * New public IsHardenedConfiguration property returns true iff the
      effective config matches the safe defaults: network=="none",
      non-root user, read-only root, host mount (if any) read-only,
      no extra run args.
    * AsAIFunction's requireApproval parameter is now bool? defaulting
      to null. When null, approval is enabled iff
      IsHardenedConfiguration is false. Pass false explicitly to opt
      out, or true to force.
    * docker-shell-tool.md updated with the new approval matrix.
    
    Tests: 4 new theory cases + 2 facts cover hardened-default,
    relaxed-network, root-user, writable-root, extraRunArgs, and
    explicit-opt-out branches. Total: 66/66.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * PR 5604 review fix (group c): wrap POSIX shell in setsid for correct killpg
    
    Review comment (#1): killpg(proc.Id, SIGINT) only behaves like a
    process-group signal when proc.Id IS a process group id. Since the
    .NET launcher does not call setsid() / setpgid() itself, the spawned
    shell inherits the agent host's process group — so killpg targeted
    the wrong group and the cancel signal could leak to the agent.
    
    Fix:
    
    * On non-Windows, EnsureStartedAsync probes for setsid (well-known
      paths first, then PATH). When found it wraps the shell launch as
      `setsid <shell> <args...>` so the spawned shell becomes a session
      leader (PID == PGID).
    * A new _isSessionLeader flag tracks whether the wrap succeeded.
    * InterruptCurrentCommandAsync only calls killpg when
      _isSessionLeader is true. Without setsid, killpg on an unsuited
      PID could signal the agent itself, so we skip the fast path and
      let the caller's hard close-and-respawn handle the timeout.
    * Windows behaviour is unchanged (Ctrl+C-via-stdin to pwsh).
    
    No public-API changes; existing tests cover the interrupt path and
    all 66/66 still pass.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * .Net: DockerShellTool design + caller-cancel container leak fixes (PR #5604)
    
    Addresses three Copilot review findings on PR #5604.
    
    Design (group f):
    * StartAsync: change inner ResolvedShell from ShellKind.Bash to ShellKind.Sh.
      BuildExecArgv() already includes `--noprofile --norc` in ExtraArgv;
      Bash's PersistentArgv() was appending those flags a second time,
      yielding `bash --noprofile --norc --noprofile --norc`. Sh's
      PersistentArgv() returns Array.Empty so ExtraArgv is forwarded
      unchanged.
    * BuildExecArgv: remove the dead `interactive: false` branch and the
      `interactive` parameter. The `false` path produced an unusable argv
      ending in `-c` with no command and was never invoked internally
      (stateless mode uses BuildRunArgvStateless). Updated tests and
      docs/docker-shell-tool.md sequence diagram.
    
    Reliability (group g):
    * RunStatelessAsync: add a second `catch (OperationCanceledException)`
      guarded on `cancellationToken.IsCancellationRequested` that issues
      `docker kill --signal KILL <perCallName>` before rethrowing.
      Previously, caller-driven cancellation bypassed the timeout-only
      catch and propagated without killing the container; because `--rm`
      only fires when PID 1 exits, the container ran indefinitely.
      Extracted the kill-by-name logic into a `BestEffortKillContainerAsync`
      helper shared by both the timeout and caller-cancel paths.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * .Net: Fill PR #5604 test coverage gaps for Shell tools
    
    Addresses the test-coverage findings in the latest Copilot review.
    
    * ShellResultTests (new): direct branch coverage for
      ShellResult.FormatForModel() — empty stdout, non-empty stderr,
      truncated, timed-out, success, and the truncated-with-empty-stdout
      edge where the marker is intentionally suppressed. This method's
      string is what the language model sees, so it benefits from
      explicit unit-level coverage independent of integration tests.
    * ShellSessionTests (new): direct unit tests for the internal
      TruncateHeadTail head-tail truncation utility — under-cap (no
      truncation), exactly at cap (no truncation), over-cap (truncated
      with marker, both head and tail preserved), and empty-string.
      Reachable via InternalsVisibleTo.
    * LocalShellToolTests: Theory test exercising 8 representative
      patterns from ShellPolicy.DefaultDenyList (rm -rf /, mkfs.ext4,
      curl|sh, wget|sh, Remove-Item /, shutdown, reboot, Format-Volume)
      to catch deny-list regex regressions; previously only 1/16 was
      tested.
    * LocalShellToolTests: explicit stderr-capture assertion (echo to
      stderr → result.Stderr contains the message). Stderr capture was
      not directly asserted anywhere in the suite.
    * DockerShellToolTests: RunAsync_RejectedCommand throws
      ShellCommandRejectedException. The Docker-side policy check is a
      pure-logic path that runs before any docker invocation, so this
      test covers the rejection branch without needing a Docker daemon.
    
    Total: 66 -> 85 tests, all passing on net10.0.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * feat(dotnet/shell): add ShellEnvironmentProvider for OS-aware shell instructions
    
    Pairs LocalShellTool/DockerShellTool with an AIContextProvider that
    probes the live shell once per session (OS, family, version, CWD,
    configurable CLI versions) and injects authoritative instructions so
    the agent uses platform-native idioms (PowerShell vs POSIX). Fixes the
    class of bugs where the model emits 'VAR=value' / '/tmp' / '$VAR' on
    a Windows PowerShell session.
    
    - ShellEnvironmentProvider/Snapshot/Options public surface in the
      existing Microsoft.Agents.AI.Tools.Shell package (one new project
      reference to Microsoft.Agents.AI.Abstractions).
    - Probes go through the same IShellExecutor that runs agent commands,
      so they respect the configured policy and (for DockerShellTool) the
      container boundary.
    - 8 unit tests covering snapshot capture, default formatter idioms,
      missing-tool handling, custom formatter override, and refresh.
    - Agent_Step21_ShellWithEnvironment sample replays the DEMO_TOKEN
      cross-call scenario using a persistent local shell.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * fix(dotnet/shell): address PR review feedback round 3
    
    - ShellEnvironmentProvider.cs split into one-type-per-file (ShellFamily,
      ShellEnvironmentSnapshot, ShellEnvironmentProviderOptions, plus the
      provider class) to match FoundryMemoryProvider/AgentSkillsProvider
      layout.
    - csproj: drop IsPackable=false (package will publish on merge), add
      IsReleased=true and disable package validation baseline (first release),
      use TargetFrameworksCore, add InjectSharedDiagnosticIds and
      InjectExperimentalAttributeOnLegacy to align with shipping packages.
    - Sample: refactor to demonstrate stateless mode first (independent
      read-only commands), then persistent mode (state carried across calls,
      e.g. DEMO_TOKEN). Strip narrative/historical comments.
    - Move docker-shell-tool.md out of the package — that doc lives in
      the docs repo (semantic-kernel-pr/agent-framework, branch
      feat/dotnet-shell-tool).
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Address PR #5604 round 4 review feedback
    
    - Sample (Agent_Step21_ShellWithEnvironment): add prominent WARNING block
      noting LocalShellTool runs real commands on the host. Restructure sample
      to demonstrate stateless mode first (cd does not carry across calls) then
      persistent mode (cd and env vars persist), motivating when to pick each.
    - DockerShellTool class XML doc: reframe as a best-effort baseline rather
      than a security guarantee; list mitigations users should still apply.
    - DockerShellTool ShellKind.Sh comment: rephrase as forward-looking design
      rationale (avoid duplicate --noprofile/--norc if Bash is reintroduced)
      instead of bug-history narrative.
    - DockerShellTool.IsHardenedConfiguration / AsAIFunction XML docs: clarify
      these are configuration-shape checks and convenience defaults, not
      security guarantees.
    - Drop IDisposable from LocalShellTool and DockerShellTool. The previous
      sync Dispose() blocked on DisposeAsync().GetAwaiter().GetResult() with a
      VSTHRD002 suppression, which is fragile under sync contexts. Both tools
      now expose IAsyncDisposable only; tests updated to await using.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Add Async suffix to async test methods to satisfy IDE1006
    
    Fixes check-format CI failure on PR #5604.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fix CPU busy-spin in WaitForSentinelAsync
    
    When new bytes arrived in the stdout read loop, the producer called
    TrySetResult on _stdoutSignal but did not replace it with a fresh TCS.
    A consumer looping inside WaitForSentinelAsync would then re-read the
    same already-completed TCS, causing WaitAsync(100ms) to return
    synchronously every iteration — a tight busy-spin that pinned a core
    until the sentinel arrived or the timeout fired.
    
    Swap the signal before completing the old one so the next consumer
    iteration observes a fresh (uncompleted) TCS, matching the pattern
    already used in ReadExitCodeAsync.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Remove unused onCommand audit hook from shell tools
    
    The Action<string> onCommand callback was a redundant audit-logging seam:
    no production callers, no Python parity, and the framework already
    provides function-invocation middleware for cross-cutting concerns at
    the AIFunction layer. Removing the parameter from LocalShellTool and
    DockerShellTool keeps the public surface lean.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Align Shell csproj with Foundry.Hosting preview-package conventions
    
    - Add RootNamespace
    - Move Title/Description into the primary PropertyGroup with
      TargetFrameworks/VersionSuffix to match the Foundry.Hosting layout
    - Drop IsReleased (preview packages do not set it)
    - Drop UTF-8 BOM
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Document why ShellEnvironmentProvider uses Instructions, not Messages
    
    Expand the class XML doc to record the design rationale: the shell
    environment is stable runtime metadata, not per-turn retrieval, so it
    belongs in AIContext.Instructions (matching AgentSkillsProvider).
    Messages is reserved for retrieval payloads (TextSearchProvider,
    ChatHistoryMemoryProvider). System-role placement also has higher
    steering weight and benefits from prompt caching in major providers.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Clarify which probe failures ShellEnvironmentProvider swallows
    
    Name the four exception types explicitly (timeout, policy rejection,
    spawn failure, cancellation) and note that all other exceptions
    propagate normally. Avoids the misleading impression that the provider
    is a blanket try/catch.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Strip cross-language and bug-history narrative from shell tool comments
    
    Remove "hard-won" framing and explicit "Mirrors the Python ..." cross
    references from class XML docs and inline comments in ShellSession,
    DockerShellTool, and ShellResolver. Comments now describe current
    behavior without commentary on prior implementations or development
    history.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Address PR #5604 round 5 review feedback
    
    - ShellResolver: classify only `bash` as ShellKind.Bash; sh/zsh/dash/ash/ksh/busybox now route through ShellKind.Sh so bash-only --noprofile/--norc flags are not emitted to shells that reject them. Update enum doc and tests.
    
    - ShellEnvironmentProvider.ProbeToolVersionAsync: validate the tool name against ^[A-Za-z0-9._-]+$ before interpolating into a shell command (prevents injection if ProbeTools is sourced from untrusted config). Fall back to stderr when stdout is empty so CLIs like java/older gcc still report a version. Drop misleading 'quoted' comment.
    
    - ShellSession.TruncateHeadTail: truncate by UTF-8 byte count on rune boundaries, honouring the documented maxOutputBytes contract for non-ASCII output.
    
    - ShellEnvironmentProviderTests: drop reflection on private _options; assert against the options instance the test already owns. Rename misnamed RefreshAsync test to reflect re-probing semantics. Add coverage for invalid tool names and stderr-only version output.
    
    - ShellSessionTests: add multi-byte UTF-8 truncation tests (byte-budget honoured, no rune split, no U+FFFD).
    
    - Move DockerShellToolIntegrationTests.cs from the unit test project into a new Microsoft.Agents.AI.Tools.Shell.IntegrationTests project so 'dotnet test' on the unit suite no longer requires a Docker daemon. Wire the new project into agent-framework-dotnet.slnx.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Address PR #5604 round 6 review feedback
    
    - ShellSession.MaybeReanchor: switch from double-quoted to single-quoted literal-quoting per shell. Double quotes still expand $VAR, ``, and backticks in both PowerShell and POSIX, so a working directory containing shell metacharacters could trigger command substitution. Add QuotePowerShell (escape ' as '') and QuotePosix (close-and-reopen around ') helpers and route MaybeReanchor through them. Add tests covering ``, $VAR, backticks, and embedded single quotes.
    
    - ShellEnvironmentProvider.RunProbeAsync: narrow the OperationCanceledException filter to `when (!cancellationToken.IsCancellationRequested)` so caller-driven cancellation propagates instead of being silently converted to a null snapshot. Update the class XML doc to call out the distinction. Add tests for both paths (caller cancellation throws, probe-timeout returns null fields).
    
    - DockerShellTool.RunStatelessAsync / RunDockerCommandAsync: replace unbounded StringBuilder accumulators with a shared HeadTailBuffer (extracted from LocalShellTool into its own internal type). Caps memory at roughly maxOutputBytes regardless of how much output a command emits; drops the now-redundant trailing TruncateHeadTail call. RunDockerCommandAsync caps helper-command output at 1 MiB (defends against chatty docker pull progress streams). Add HeadTailBufferTests covering bounded behaviour over 10 MiB of streamed input.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Address PR #5604 round 7 review feedback
    
    - HeadTailBuffer: switch to UTF-8 byte-aware truncation. The class previously
    
      capped on UTF-16 char count while callers pass _maxOutputBytes, so multi-byte
    
      output could exceed the budget and head/tail boundaries could split surrogate
    
      pairs into orphaned halves. Now tracks UTF-8 byte counts and treats each rune
    
      as an indivisible unit (encode -> bytes -> head/tail), guaranteeing the final
    
      string round-trips through UTF-8 and never contains an unpaired surrogate.
    
      The truncation marker now reads `bytes` instead of `chars` to match.
    
    - ShellEnvironmentProvider: clear cached _snapshotTask on failure. Previously a
    
      faulted/cancelled first probe permanently poisoned the provider — every later
    
      ProvideAIContextAsync await replayed the same exception. Now the failed task
    
      is cleared via a CompareExchange so the next caller starts a fresh probe.
    
    Tests: added rune-boundary coverage for HeadTailBuffer, plus two regression
    
    tests for poison-recovery (executor-throw and caller-cancellation paths).
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Address PR #5604 round 8 review feedback
    
    - HeadTailBuffer odd-cap data loss: previously _halfCap = cap / 2 was used as
    
      both the head fill bound and the tail eviction threshold, so an odd cap (e.g.
    
      cap=5 -> halfCap=2) would silently drop a byte while ToFinalString still
    
      reported truncated == false. Split into _headCap = cap / 2 and _tailCap =
    
      cap - _headCap so head + tail budgets always sum to exactly cap; any input
    
      whose UTF-8 size is <= cap now round-trips losslessly.
    
    - ShellSession.TakePrefixByBytes unpaired-high-surrogate: the prefix walker
    
      advanced 2 chars whenever it saw a high surrogate, without verifying that the
    
      next char was actually a low surrogate. Mirrored the pair check from
    
      TakeSuffixByBytes so unpaired surrogates are treated as a single (invalid)
    
      BMP char and the encoder substitutes U+FFFD as it would anywhere else.
    
    - Centralize clean-environment preserved-vars list. The {PATH, HOME, USER,
    
      USERNAME, USERPROFILE, SystemRoot, TEMP, TMP} allowlist was duplicated in
    
      LocalShellTool (stateless launch) and ShellSession (persistent startup), so
    
      adding a new variable required touching both. Extracted into
    
      CleanEnvironmentHelper.PreservedVariables / ApplyPreserved; both call sites
    
      collapse to a single line.
    
    Tests: HeadTailBuffer round-trip-at-odd-cap regression, ShellSession unpaired-
    
    surrogate test.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Address PR #5604 round 9 review feedback
    
    - ShellSession.TruncateHeadTail odd-cap budget: same fix applied to
    
      HeadTailBuffer last round but missed here. Use headCap = cap/2 +
    
      tailCap = cap - headCap so the head/tail budgets sum to exactly cap.
    
    - Replace TakePrefixByBytes / TakeSuffixByBytes Encoder.Convert loops with
    
      rune iteration. The old code ignored Encoder.charsUsed and trusted the
    
      caller's hand-rolled surrogate-pair detection, which made the byte count
    
      fragile around unpaired surrogates. EnumerateRunes + Utf8SequenceLength
    
      is stateless and self-evidently correct.
    
    - ShellEnvironmentProvider.ProbeAsync now skips case-insensitive duplicates
    
      in the user-supplied ProbeTools list. Previously {\"git\",\"GIT\"} would
    
      probe twice and rely on insertion order to determine the kept value.
    
    - DockerShellToolTests.AsAIFunction_RelaxedConfig_DefaultsToApprovalGated:
    
      removed unused trailing ool _ parameter and matching InlineData column.
    
    Tests: added duplicate-ProbeTools regression test.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Address PR #5604 round 10 review feedback
    
    * ShellSession.ReadLoopAsync: replace per-byte buf.Add(chunk[i]) loop with a single buf.AddRange(new ArraySegment<byte>(chunk, 0, n)) bulk copy on the read hot path.
    
    * ShellPolicy: compile allow-list patterns with RegexOptions.IgnoreCase, matching the deny-list and avoiding case-mismatch surprises.
    
    * LocalShellToolTests.RunAsync_NonZeroExit: drop the redundant ternary that selected between two identical 'exit 7' literals.
    
    * DockerShellToolIntegrationTests.NetworkNone: fix the comment to reference 'getent' (matching the actual command) instead of the stale 'wget' phrasing.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * fix(dotnet): address PR #5604 round-3 review feedback
    
    - Rename LocalShellTool/DockerShellTool -> LocalShellExecutor/DockerShellExecutor
    - Rename IShellExecutor.StartAsync/CloseAsync -> InitializeAsync/ShutdownAsync
    - Rename ShellDecision -> ShellPolicyOutcome
    - Rename CleanEnvironmentHelper.ApplyPreserved -> EnvironmentSanitizer.RemoveNonPreserved
    - Convert ShellRequest/ShellPolicyOutcome from record struct to plain readonly struct (with IEquatable<T>)
    - Split ShellMode, ShellTimeoutException, ShellExecutionException into their own files
    - Add DockerNetworkMode static class with None/Bridge/Host constants
    - Convert DockerShellExecutor memory parameter from string to long? memoryBytes
    - Use Throw.IfNull(image) in DockerShellExecutor ctor
    - Make ShellResolver.EnvVarName public const
    - Inline-comment each DefaultDenyList regex; document allow-precedence-over-deny on ShellPolicy.Evaluate
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * fix(dotnet): address PR #5604 round-3 follow-up nits
    
    - DockerShellExecutor / LocalShellExecutor: drop redundant IAsyncDisposable from class declarations (IShellExecutor : IAsyncDisposable already covers it)
    - DockerShellExecutor: scope DefaultImage / DefaultContainerUser / DefaultNetwork / DefaultMemoryBytes / DefaultPidsLimit / DefaultContainerWorkdir to internal (only used as parameter defaults; tests have InternalsVisibleTo)
    - DockerShellExecutor.RunAsync: blank line after the null-guard block (style consistency)
    - csproj: move <Title>/<Description> below the nuget-package.props import so they are not overwritten by the shared defaults; refresh wording to match new executor names
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Refactor shell tool: abstract ShellExecutor, options classes, ContainerUser record
    
    Round-3 review responses for PR #5604:
    
    * Replace IShellExecutor interface with abstract ShellExecutor base class so the surface can be extended without breaking implementers (review feedback from @westey-m).
    
    * Drop ShutdownAsync from the executor surface; DisposeAsync is the canonical teardown (review feedback from @SergeyMenshykh).
    
    * Replace the long parameter lists on Local/DockerShellExecutor constructors with LocalShellExecutorOptions and DockerShellExecutorOptions classes so adding new knobs is no longer a breaking change (review feedback from @SergeyMenshykh).
    
    * Introduce ContainerUser(Uid, Gid) record in place of a 'uid:gid' string for the Docker user, with Default and Root statics (review feedback from @lokitoth).
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Remove IsHardenedConfiguration; AsAIFunction defaults to approval-gated
    
    Addresses PR #5604 review thread AZpMj. The IsHardenedConfiguration
    property was a configuration-shape check, not a security guarantee,
    and using it to auto-disable approval gating gave false confidence.
    
    - Delete IsHardenedConfiguration property.
    - AsAIFunction(requireApproval: null) now always wraps in
      ApprovalRequiredAIFunction; callers must explicitly pass false to
      opt out.
    - Update class- and method-level XML docs to drop hardened-attestation
      language and call out approval gating as the primary safety control.
    - Drop two hardening-assertion tests and the relaxed-config theory;
      add one test asserting null requireApproval is approval-gated.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Replace ShellExecutionException/ShellTimeoutException with standard exceptions
    
    Addresses PR #5604 review threads AaqVP and Aasod. The custom
    exception types added no behavior beyond the base type — only a
    different name — so callers gain nothing from them.
    
    - Delete ShellExecutionException.cs and ShellTimeoutException.cs.
    - Process spawn failures (LocalShellExecutor, DockerShellExecutor)
      and broken-pipe to a long-lived shell (ShellSession) now throw
      IOException, which is the natural .NET shape for these failures.
    - ShellTimeoutException was declared but never thrown; the only
      in-process timeout path uses the OperationCanceledException raised
      by the linked CancellationTokenSource. The catch-and-swallow in
      ShellEnvironmentProvider now matches IOException + TimeoutException.
    - Update XML doc comments accordingly.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Remove ShellPolicy.DefaultDenyList; default policy is empty
    
    Addresses PR #5604 review thread AY7Ba. A regex deny-list is
    bypassed in seconds by hex escapes ($(echo -e "\x72\x6D")),
    command substitution ($(base64 -d <<<...)), and envvar splicing
    ($(A=r B=m; echo $A$B)). No major agent framework uses regex
    matching as a primary control; AutoGen explicitly removed theirs
    in v2. The real defenses are approval gating (default) and the
    Docker sandbox tier.
    
    - Delete DefaultDenyList property from ShellPolicy.
    - ShellPolicy(denyList: null) now means an empty deny-list.
    - Rewrite ShellPolicy class XML docs to frame as a UX pre-filter
      for operator-supplied patterns, not as a security control.
    - Update LocalShellExecutorOptions/DockerShellExecutorOptions
      Policy docs to match.
    - Tests that exercise the deny-list mechanism now supply patterns
      explicitly, mirroring real operator usage.
    - Add Policy_DefaultConstruction_AllowsAnyNonEmptyCommand test.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Document single-session ownership for persistent shell mode
    
    Several PR #5604 review threads (notably AaQh2) raised that the persistent
    shell experience has no concurrency story. The framework's actual design
    is "one executor per conversation" — there is no per-caller isolation —
    but that contract was only stated briefly on ShellExecutor and not at all
    on the types and properties developers reach for first.
    
    Strengthen the docs in the places a user is most likely to land:
    
    - ShellMode.Persistent: explicit single-session-ownership paragraph
      (state visible across calls, single pipe, no isolation, one per session).
    - ShellExecutor: rewrite the Concurrency paragraph to enumerate what
      leaks (cwd, env, history, background jobs) and call out DI scoping.
    - LocalShellExecutor: new Single-session-ownership paragraph mirroring
      the executor-level contract and pointing at Stateless mode as the
      escape hatch.
    - DockerShellExecutor: same, framed around the container + bash REPL
      the persistent-mode executor owns end-to-end.
    - ShellSession: add a Single-owner paragraph on the type docs and a
      comment on _runLock clarifying that it serializes the owner's calls,
      not multiple tenants.
    - LocalShellExecutorOptions.Mode / DockerShellExecutorOptions.Mode:
      per-property note pointing at the executor remarks.
    
    Docs-only; src builds clean with zero warnings, zero errors.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: alliscode <bentho@microsoft.com>
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • .NET: Refactor harness console rendering (#5751)
    * Refactor harness console rendering
    
    * Fix formatting issues
    
    * Address PR comments
  • .NET: Add A2A input-request content for human-in-the-loop scenarios (#5743)
    * .NET: Add A2A input-request content for human-in-the-loop scenarios
    
    Adds first-class support for handling user input requests from A2A agents
    when they return an `input-required` task state.
    
    - Add `A2AInputRequestContent` (wraps the requested `AIContent`) and
      `A2AInputResponseContent` (wraps the user's `AIContent` reply), with
      `CreateResponse` helper overloads on the request type.
    - Surface input requests on `AgentResponse` / `AgentResponseUpdate` via
      `AgentTask` and `TaskStatusUpdateEvent` mappings.
    - Link follow-up messages containing `A2AInputResponseContent` to the
      existing task via `TaskId` instead of `ReferenceTaskIds`.
    - Add `A2AAgent_HumanInTheLoop` sample and register it in the solution
      and parent README.
    - Add unit tests for the new types, extensions, and `A2AAgent` paths.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Remove unnecessary using directive flagged by CI format check
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * address feedback
    
    * Guard against null TaskId when sending A2AInputResponseContent
    
    Throw InvalidOperationException if TaskId is missing when the message
    contains A2AInputResponseContent, preventing silent no-op responses.
    Also adds tests for both RunAsync and RunStreamingAsync paths.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Leave Contents null for non-InputRequired status updates
    
    Remove unnecessary '?? []' fallback so Contents stays null when there
    are no input requests, matching the other update mapping patterns.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Use consistent GUID format for request IDs
    
    Use ToString("N") to match message ID format used elsewhere in
    the A2A component.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Remove Debug build exclusion for the HumanInTheLoop sample so it                                                                                                                                                                                                               participates in normal solution validation.
    
    * Add missing using Microsoft.Extensions.AI to A2AAgent_HumanInTheLoop
    
    The sample uses ChatMessage, TextContent, and ChatRole types from
    Microsoft.Extensions.AI but was missing the using directive, causing
    CS0246 build errors on all CI jobs.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * change the way user input requests are handled based on pr review comments
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • .NET: Remove Foundry Toolbox server-side tools support (#5753)
    * .NET: Remove Foundry Toolbox server-side tools support
    
    Mirrors the Python cleanup in microsoft/agent-framework#5671. Passing
    toolbox tools as server-side Responses tools is not the experience we
    want to support; the hosted-agent MCP toolbox path (HostedMcpToolboxAITool
    + FoundryToolboxService) remains the supported way to consume Foundry
    Toolboxes.
    
    Removed:
    - FoundryToolbox static class (GetToolboxVersionAsync / GetToolsAsync /
      ToAITools / SanitizeAndConvert)
    - AIProjectClient.GetToolboxToolsAsync extension
    - Agent_Step25_ToolboxServerSideTools sample (+ slnx entry)
    - FoundryToolboxTests, TestDataUtil, HttpHandlerAssert, and the toolbox
      JSON fixtures only those tests referenced
    - ToolboxHostedAgentTests and ToolboxHostedAgentFixture; the "toolbox"
      switch arm + CreateToolboxAgent helper in TestContainer; matching
      README scenario row and bootstrap script entry
    
    Kept (MCP path, unchanged):
    - HostedMcpToolboxAITool, FoundryAITool.CreateHostedMcpToolbox,
      FoundryAIToolExtensions.CreateHostedMcpToolbox(ToolboxRecord/Version)
    - FoundryToolboxService, AddFoundryToolboxes, marker injection in
      AgentFrameworkResponseHandler, InputConverter.ReadMcpToolboxMarkers
    - Hosted-Toolbox sample, McpToolbox* tests, FoundryToolboxServiceTests
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * .NET: Add Foundry Toolbox MCP sample (Agent_Step25_FoundryToolboxMcp)
    
    Adds a non-hosted-agent equivalent of the Python foundry_chat_client_with_toolbox.py sample. The agent connects to a Foundry Toolbox's MCP endpoint via Streamable HTTP, injects a fresh Azure AI bearer token on every request, and discovers the toolbox's tools at runtime via McpClient.ListToolsAsync.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * .NET: Tighten Agent_Step25_FoundryToolboxMcp README/Program comments
    
    Drop 'non-hosted agent' framing from README (this sample isn't related to hosted agents) and remove narrative comparison to server-side tools from the Program.cs header comment.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Drop python sample reference from Agent_Step25 README
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Drop incorrect .NET 10 prereq from Agent_Step25 README
    
    Toolboxes don't require .NET 10 (Microsoft.Agents.AI.Foundry targets net8.0+); the parent AgentsWithFoundry README already lists the sample SDK prereq.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fix Toolsets api-version in Agent_Step25 example endpoint
    
    Use 2025-05-01-preview to match FoundryToolboxOptions.ApiVersion. The placeholder 'v1' is not accepted by the Toolsets endpoint.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: alliscode <bentho@microsoft.com>
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • .NET: Hosted Agents - RAG Sample with Azure AI Search (#5693) (#5701)
    * .NET: Hosted Agents - RAG Sample with Azure AI Search (#5693)
    
    Adds a Hosted-AzureSearchRag sample plus a live Foundry.Hosting integration
    test scenario backed by a real Azure AI Search index.
    
    Sample (Hosted-AzureSearchRag): keyword-only Azure AI Search via
    SearchClient adapter into TextSearchProvider, scope-aware
    DevTemporaryTokenCredential consuming AZURE_BEARER_TOKEN_FOUNDRY +
    AZURE_BEARER_TOKEN_SEARCH for local Docker, Dockerfile + contributor
    Dockerfile mirroring Hosted-TextRag.
    
    Integration test: AzureSearchRagHostedAgentFixture extends the PR #5598
    HostedAgentFixture with the new azure-search-rag scenario branch in the
    shared test container; AzureSearchRagHostedAgentTests asserts the model
    returns canary tokens (TR-CANARY-7821, SHIP-CANARY-4493) that exist only
    in the seeded documents - real proof the agent grounded its answer in
    retrieved content rather than training data.
    
    * Address PR 5701 Copilot review feedback
    
    - Sample README: drop stale 'bootstraps the index on first run' line; index is pre-provisioned out of band
    
    - Sample + TestContainer search adapters: propagate CancellationToken to await foreach via .WithCancellation()
  • .NET: Hosted-Files sample + AgentSessionFiles SDK companion + integration test (#5698)
    * .NET: Add Hosted-Files sample + alpha AgentSessionFiles SDK companion + integration test
    
    Closes #5691
    
    - Hosted-Files server sample (mirrors python 06_files): 3 local tools reading
      the per-session \C:\Users\rbarreto sandbox volume.
    - SessionFilesClient REPL companion: code-first equivalent of
      zd ai agent files upload using the alpha
      Azure.AI.Projects.AgentSessionFiles SDK (upload/ls/download/rm + session
      lifecycle with isolation key).
    - session-files scenario added to the Foundry.Hosting.IntegrationTests
      multi-scenario harness (PR #5598): SessionFilesHostedAgentFixture +
      SessionFilesHostedAgentTests.UploadAndAgentReadsFileAsync, end-to-end
      validating upload then agent-reads-file (agent_session_id pinned via
      CreateResponseOptions.Patch). Bundled testdata is linked from the sample
      so there is a single source of truth.
    
    * .NET: Hosted-Files: REPL companion now demonstrates file-as-knowledge end-to-end
    
    Adds an 'ask <prompt>' command to SessionFilesClient that pins
    agent_session_id (via CreateResponseOptions.Patch) so the agent invoked from
    the REPL reads files this REPL just uploaded. Surfaces the file content as
    agent knowledge in the same in-process loop instead of telling the user to
    shell out to azd ai agent invoke.
    
    * .NET: Reshape Hosted-Files sample - bake files into image, SessionFilesClient becomes thin chat REPL
    
    The previous SessionFilesClient leaned on the alpha AgentSessionFiles SDK
    to upload files at runtime, which made it diverge from the canonical
    Using-Samples shape (SimpleAgent / SimpleInvocationsAgent: tiny chat REPLs).
    
    This change:
    
    - Bakes the sample resources/ directory into the published output via a
      Content Include in HostedFiles.csproj. Inside the container the files live
      at /app/resources/. Two local function tools (ListFiles, ReadFile) surface
      them to the model.
    - Reshapes SessionFilesClient as a thin FoundryAgent chat REPL, identical
      shape to SimpleAgent. AGENT_ENDPOINT + AGENT_NAME, that is it.
    - Demo flow: user asks 'Give me the total revenue in the contoso file' and
      the agent answers with the figure read from its bundled file. Validated
      end-to-end locally against Hosted-Files on http://localhost:60419.
    - Bypasses SampleEnvironment alias on optional env vars to avoid stdin
      prompts when running unattended.
    
    The Foundry.Hosting.IntegrationTests session-files scenario continues to
    validate the alpha AgentSessionFiles SDK end-to-end (upload + agent reads
    from session HOME) and is unchanged.
    
    * .NET: Foundry.Hosting.IntegrationTests TestContainer - constrain session-files tools to $HOME
    
    Addresses the path-traversal review comment on the session-files scenario:
    ResolveSessionPath in TestContainer used to allow absolute paths and ..
    traversals, which (when chained with indirect prompt injection in an
    uploaded file) would let the model read or list arbitrary container files
    via the ReadFile / ListFiles tools.
    
    Mirrors the canonicalize + StartsWith(home) pattern from the framework's
    own FileSystemAgentFileStore.ResolveSafePath: rejects rooted paths, calls
    Path.GetFullPath, and verifies the result stays under $HOME, throwing
    ArgumentException otherwise.
    
    The Hosted-Files sample is already safe (uses Path.GetFileName which strips
    any directory component) so no change there. The integration test continues
    to upload and read 'contoso_q1_2026_report.txt', a single relative filename
    which passes the new validation unchanged.
    
    * .NET: SessionFilesHostedAgentTests - shrink to alpha SDK round-trip
    
    The previous test attempted to pin agent_session_id into the /responses
    payload via JsonPatch so the agent would read the file uploaded through
    AgentSessionFiles. The Foundry alpha service now consistently rejects the
    explicit-session-id pin with HTTP 400 conflict on /responses, regardless
    of whether the session was pre-created via AgentAdministrationClient or
    left to be auto-provisioned, so the agent leg of the test is no longer
    reachable from the SDK surface.
    
    Reshape the test to exercise what the alpha SDK actually guarantees:
    create session, upload, list (assert presence + size), download (assert
    deterministic token), delete (assert removed), cleanup. Everything stays
    inside Azure.AI.Projects.Agents.AgentSessionFiles.
    
    Verified live against tao-foundry-prj:
      UploadListDownloadAndDeleteAsync passed in 30s.
      Full Foundry.Hosting.IntegrationTests run: 25 total, 6 passed, 19
      skipped (existing placeholders), 0 failed.
    
    * .NET: SessionFilesHostedAgentTests - rewrite as upload-then-FoundryAgent.RunAsync e2e
    
    Per review feedback the integration test must validate the hosted agent
    itself: client uploads a file via the alpha AgentSessionFiles SDK, then
    FoundryAgent.RunAsync invokes the deployed agent and the agent's
    container-side ReadFile tool surfaces the uploaded file content into the
    response.
    
    Test flow:
      1. agent.RunAsync(warmup) - platform provisions a per-session container.
      2. AgentAdministrationClient.GetSessionsAsync(latest) - resolve the
         just-provisioned agent_session_id.
      3. AgentSessionFiles.UploadSessionFileAsync - upload contoso file to
         that session, asserts BytesWritten + GetSessionFiles listing.
      4. agent.RunAsync(real prompt, options=PreviousResponseId chain) -
         chained to warmup so the platform routes back to the same container.
      5. Assert response contains '1,482.6' (deterministic token from file).
      6. Best-effort cleanup.
    
    The test is annotated with [Fact(Skip=...)] right now: the Foundry alpha
    service consistently returns HTTP 400 conflict on /responses requests
    that link to a prior session via previous_response_id, conversation_id,
    or agent_session_id pinning - verified across multiple retries with
    multiple chaining strategies. Without that link we cannot route the
    second invocation to the same container the file was uploaded to. When
    the platform regression is resolved, removing the Skip will exercise
    the full flow.
    
    Full Foundry.Hosting.IntegrationTests run with this change: 25 total,
    5 passed, 20 skipped (existing placeholders + this one), 0 failed.
    
    * .NET: SessionFilesHostedAgentTests - end-to-end upload-then-FoundryAgent.RunAsync now passes
    
    The blocker was a routing problem combined with a platform race:
    
    1. Routing two /responses calls to the same per-session container.
       - agent_session_id pin in body -> 400 (platform treats it as create)
       - conversation_id created at project root -> 404 at agent endpoint
       - previous_response_id chain -> different session
       The working answer is to create the conversation on a per-agent
       ProjectOpenAIClient (AgentName option, URL becomes
       /agents/{name}/endpoint/protocols/openai/conversations) and pass that
       conversation_id on both calls. Both then resolve to the SAME
       x-agent-session-id (verified by capturing the response header).
    
    2. Race after AgentSessionFiles upload. The upload mutates session/
       conversation revision; a /responses call issued immediately after
       400-conflicts with 'modified concurrently. Please retry.' Bounded
       exponential retry handles it (5 attempts, 2*attempt seconds).
    
    Test flow:
      1. Create per-agent OpenAI client + ProjectConversationsClient + ProjectResponsesClient.
      2. CreateProjectConversationAsync on the per-agent client.
      3. Warm-up agent.RunAsync(prompt, ChatOptions { ConversationId = ... })
         - captures x-agent-session-id from the response header via a custom pipeline policy.
      4. AgentSessionFiles.UploadSessionFileAsync to that session id.
      5. ProjectResponsesClient.CreateResponseAsync (raw, retry-on-conflict)
         with the same conversation_id -> routes back to the same container.
      6. Assert response contains '1,482.6' (deterministic token from file).
      7. Cleanup: delete file, leave session for TTL.
    
    Verified live against tao-foundry-prj:
      UploadedFile_IsReadByHostedAgentAsync passed in 24.9s.
      Full Foundry.Hosting.IntegrationTests run: 25 total, 6 passed, 19
      skipped (existing placeholders), 0 failed.
    
    * .NET: address Copilot PR review findings
    
    - agent.manifest.yaml: description + tags now reflect bundled-files agent (image-baked /app/resources), not the obsolete session-sandbox tools the prior shape claimed.
    - SessionFilesHostedAgentTests: wrap test body in try/finally to call DeleteConversationAsync on the conversation we created (matches HappyPathHostedAgentTests pattern; prevents conversation leakage across runs).
    - ResponseHeaderCapturePolicy: drop unused LastRequestBody capture left over from diagnosis.
    
    Test still passes live (40s).
    
    * .NET: Hosted-Files: split into bundled vs session-file tool pairs
    
    The previous Hosted-Files agent only exposed bundled (image-baked) file
    knowledge. The platform also surfaces session-uploaded files at \C:\Users\rbarreto
    inside the per-session container per container-image-spec.md line 172
    (verified live by SessionFilesHostedAgentTests). The sample now teaches
    both patterns.
    
    Two distinct tool pairs, each scoped to its own root:
    
      Bundled (image-baked):    ListBundledFiles, ReadBundledFile
                                -> /app/resources/ (BUNDLED_FILES_DIR override)
    
      Session-uploaded (\C:\Users\rbarreto): ListSessionFiles, ReadSessionFile
                                -> \C:\Users\rbarreto (default /home/session per container spec)
    
    Security model -- distinct tools, distinct sandboxes:
      - Tool input is a fileName, not a path. Schema-level: model cannot
        request directories or traversals.
      - Path.GetFileName(input) strips any directory components.
      - Path.GetFullPath + StartsWith(root) check rejects anything outside
        the tool's root, mirroring FileSystemAgentFileStore.ResolveSafePath.
      - Read-only, non-recursive listing. No glob, no '..'.
      - Failures non-revealing: 'File <name> not found in <scope>.'
    
    The two roots are physically isolated (image-baked vs platform-mounted
    per-session volume). A bundled-root tool can never reach a session file
    and vice-versa, even if the implementation has a bug.
    
    README updated to document both flows, the security pattern, and cite
    the container-image-spec.md line 172 contract for \C:\Users\rbarreto. Live IT
    SessionFilesHostedAgentTests.UploadedFile_IsReadByHostedAgentAsync
    re-passed in 42s after the change (TestContainer is unchanged; the
    sample-agent split does not affect the IT).
    
    * .NET: Hosted-Files README - fix broken relative link to IT (4..5 dots)
  • .NET: Add Foundry.Hosting.IntegrationTests (#5598)
    * Foundry.Hosting.IntegrationTests: scaffold project, fixtures, and 24 tests
    
    Add a new integration test project for Foundry hosted agents alongside the existing Foundry.IntegrationTests project. The project provisions a real Foundry hosted agent per scenario via AgentAdministrationClient.CreateAgentVersionAsync, points it at a single test container image (built and pushed out of band by scripts/it-build-image.ps1 in a follow up commit), and exercises the agent through AIProjectClient.AsAIAgent.
    
    Six scenario fixtures are introduced, each pointing at the same image but selecting behavior via the IT_SCENARIO environment variable on the HostedAgentDefinition:
    - HappyPathHostedAgentFixture (round trip, multi turn, stored=false flag)
    - ToolCallingHostedAgentFixture (server side AIFunctions)
    - ToolCallingApprovalHostedAgentFixture (approval flow)
    - ToolboxHostedAgentFixture (Foundry toolbox)
    - McpToolboxHostedAgentFixture (MCP backed toolbox)
    - CustomStorageHostedAgentFixture (custom storage provider)
    
    24 tests across 6 test classes are scaffolded. All are tagged Skip pending the test container build and the end to end smoke iteration in follow up commits. Once the container is in place the Skip annotations can be removed scenario by scenario.
    
    Adds an IT_HOSTED_AGENT_IMAGE constant to the shared TestSettings so every IT project agrees on the env var name the build script emits.
    
    * Foundry.Hosting.IntegrationTests: add TestContainer, build script, slnx, README
    
    Adds the rest of the integration test infrastructure on top of the previous scaffolding commit:
    
    * Foundry.Hosting.IntegrationTests.TestContainer csproj and Program.cs implementing the multi scenario container (one image, IT_SCENARIO env var dispatches between happy-path, tool-calling, tool-calling-approval, toolbox, mcp-toolbox, and custom-storage). The toolbox, mcp-toolbox, and custom-storage branches are placeholders pending API surface stabilization.
    * Dockerfile and dockerignore in the test container project, using the contributor pattern matching the investigation work (host side dotnet publish, container only does COPY out/).
    * scripts/it-build-image.ps1 with mandatory Registry parameter (no hardcoded ACR), content hashed tags so unchanged source results in a no op push, and emits IT_HOSTED_AGENT_IMAGE for shells and CI to consume.
    * slnx entry for both new projects.
    * README in the IT project covering env vars, image build, scenario table, and current placeholder status.
    
    Steps still pending: end to end smoke (step 5) and CI workflow integration (step 6) require a live Foundry deployment and ACR push, so they land in follow up commits.
    
    * Foundry.Hosting.IntegrationTests: address PR 5598 review feedback
    
    Fix issues raised by Copilot review:
    
    * it-build-image.ps1: hash file contents, not the path list, so any source edit produces a fresh tag. Normalize Registry input by stripping scheme and trailing slash before deriving the ACR short name. Validate the short name is non empty.
    * HostedAgentFixture: route GetAgentAsync through _adminClient (which has the FoundryFeaturesPolicy attached) instead of through _projectClient.AgentAdministrationClient (which does not).
    * HostedAgentFixture FoundryFeaturesPolicy: replace Headers.Add with Remove plus Add so retries cannot accumulate duplicate headers.
    * HappyPath, ToolCalling, ToolCallingApproval, CustomStorage tests: create the AgentSession before turn 1 and reuse it for both turns. The previous pattern created the session after turn 1 so turn 2 had no link to turn 1, defeating the multi turn assertion.
    
    * .NET: Foundry.Hosting.IntegrationTests: constrain to net10.0 + dotnet format autofix
    
    - Set <TargetFrameworks>net10.0</TargetFrameworks>: the project references both
      Microsoft.Agents.AI.Foundry.Hosting (net8/9/10 only) and AgentConformance.IntegrationTests
      (net10.0;net472 — inherits the tests-default TFM list). The intersection is net10.0;
      the previous $(TargetFrameworksCore) triple caused NU1702 + System.Text.Json version
      conflicts on the net8.0/net9.0 builds because AgentConformance had no matching asset.
    - Apply `dotnet format` autofix on the test files (IDE0005, IDE0009, IDE0032, IMPORTS).
    
    * .NET: Foundry.Hosting.IntegrationTests.TestContainer/Program.cs: add UTF-8 BOM
    
    CI's check-format requires charset=utf-8-bom per .editorconfig.
    
    * Foundry.Hosting IntegrationTests: wire end-to-end CI flow against hosted agents
    
    Make the integration tests usable end-to-end against a live Foundry deployment, including
    a per-run rebuild of the test container so framework code changes are exercised.
    
    Fixture (HostedAgentFixture.cs)
    
    * Switch from per-run unique agent names to stable scenario-keyed names (it-happy-path,
      it-tool-calling, ...). The agent's managed identity carries the Azure AI User role on
      the project scope, which is required for inbound inference; deleting the agent recycles
      the MI and breaks that role assignment, so we keep the agent across runs and only churn
      versions.
    * Add IT_RUN_ID env var to defeat Foundry's content-addressed version dedup; otherwise a
      rerun just receives the existing version and Dispose deletes it.
    * PATCH the per-agent endpoint with AgentEndpointConfig (Responses protocol, version
      selector at 100% to the new version). Without this, /agents/{name}/endpoint/protocols/
      openai/responses returns HTTP 400.
    * Build a per-agent ProjectOpenAIClient (not the cached projectClient.ProjectOpenAIClient,
      which is bound to the project-level URL); set AgentName in options so the URL routes
      through the agent endpoint, and add the Foundry-Features header to the inference
      pipeline.
    * Use Versions (which serializes to container_protocol_versions) instead of the
      deprecated ProtocolVersions; the server now rejects the legacy field.
    * On Dispose, delete only the version this fixture created. Never delete the agent.
    
    Tests
    
    * Tag every HostedAgentTests class with [Trait("Category", "FoundryHostedAgents")] so the
      CI workflow can route them to a separate Foundry project than the rest of the
      integration suite.
    
    CI workflow (.github/workflows/dotnet-build-and-test.yml)
    
    * Add a foundryHosting paths-filter covering Microsoft.Agents.AI.Foundry.Hosting and its
      in-repo dependency chain (Foundry, Agents.AI, Agents.AI.Abstractions), the test
      container, the test fixture, Directory.Packages.props, the build script, and this
      workflow file. Skip the costly hosted-agent steps when none of those changed.
    * Add "Build and push Foundry Hosted Agents test container" step that invokes
      scripts/it-build-image.ps1 against vars.IT_HOSTED_AGENT_REGISTRY and pipes the resulting
      IT_HOSTED_AGENT_IMAGE=<tag> into GITHUB_ENV.
    * Add "Run Foundry Hosted Agents Integration Tests" step that filters in only the new
      trait, with AZURE_AI_PROJECT_ENDPOINT/AZURE_AI_MODEL_DEPLOYMENT_NAME pointed at
      IT_HOSTED_AGENT_PROJECT_ENDPOINT/IT_HOSTED_AGENT_MODEL_DEPLOYMENT_NAME (Tao project,
      East US 2; the SK IT project's region does not yet support hosted agents preview).
    * Exclude the new trait from the existing "Run Integration Tests" step.
    * TEMP: drop the != 'pull_request' guard on the new steps and on Azure CLI Login when the
      paths-filter triggers, so PR #5598 can validate the wiring before promoting to merge
      queue only. Restore the original guard after one green PR run.
    
    Build script (scripts/it-build-image.ps1)
    
    * Hash now spans TestContainer source AND its referenced framework projects so any
      framework code change forces a fresh tag and a real docker push; the previous
      TestContainer-only hash silently reused stale images on framework edits.
    
    Bootstrap script (dotnet/tests/Foundry.Hosting.IntegrationTests/scripts/it-bootstrap-agents.ps1)
    
    * New idempotent script that creates the six stable scenario agents and grants Azure AI
      User on the project scope to each agent's MI. Run once per Foundry project. Includes
      AAD-graph propagation retries because newly created MIs take time to appear there.
    
    README (dotnet/tests/Foundry.Hosting.IntegrationTests/README.md)
    
    * Document the bootstrap prerequisite, the regional caveat (East US 2 is the only region
      we have validated; East US returned "Unsupported region" at the time of writing), the
      per-run image rebuild, and the CI wiring including the SP RBAC requirements.
    
    SDK pin (TEMP)
    
    * Bump Microsoft.Agents.AI.Foundry.Hosting's Azure.AI.Projects VersionOverride to
      2.1.0-alpha.20260505.1 from the azure-sdk public daily feed (added to nuget.config).
      This release is the first that builds the per-agent inference URL as
      /agents/{name}/endpoint/protocols/openai (the 2.1.0-beta.1 release builds
      .../openai/openai/v1, which the server rejects). Revert both the feed and the override
      once the URL fix lands in a stable Azure.AI.Projects release.
    
    * Foundry.Hosting IntegrationTests: revert alpha SDK pin; move endpoint PATCH to bootstrap
    
    The alpha SDK pin (Azure.AI.Projects 2.1.0-alpha.20260505.1 from the azure-sdk public
    daily feed) was needed only for the URL routing fix and the strongly-typed
    AgentEndpointConfig/PatchAgentOptions wrapper. We do not need either right now: the
    fixture stays compatible with the public 2.1.0-beta.1 by moving the one-time endpoint
    PATCH to the bootstrap script (it sets version_selector to FixedRatio @latest, so each
    new fixture run becomes the served version automatically without a per-run PATCH from
    the test code). The hosted-agent invocation path will start working end-to-end once the
    URL routing fix lands in a stable Azure.AI.Projects release; until then the tests stay
    [Fact(Skip = ...)] as documented.
    
    * Revert dotnet/nuget.config: drop the azure-sdk-for-net public feed.
    * Revert Microsoft.Agents.AI.Foundry.Hosting.csproj VersionOverride to 2.1.0-beta.1.
    * Revert Microsoft.Agents.AI.Foundry.UnitTests and Microsoft.Agents.AI.Foundry.Hosting.UnitTests
      Azure.AI.Projects pin (they had been bumped to align Azure.Core 1.54 transitive).
    * Drop the AgentEndpointConfig PATCH block from HostedAgentFixture.cs (the type is
      alpha-only). Replace with a comment pointing at the bootstrap script.
    * Bootstrap script (it-bootstrap-agents.ps1) now also PATCHes each agent's endpoint
      with version_selector=@latest if not already set. Idempotent.
    
    * Foundry.Hosting IntegrationTests: drop accidentally committed filtered.slnx
    
    * Foundry.Hosting IntegrationTests: revert TEMP PR override on Azure CLI Login + IT steps
    
    The previous attempt to validate the new hosted-agent IT wiring on PR #5598 failed
    because the PR is from a fork (rogerbarreto/agent-framework-public). GitHub never passes
    environment secrets to fork PRs regardless of event-name guards on individual steps,
    so 'azure/login@v2' fails with 'client-id and tenant-id are not supplied'. Restore the
    original github.event_name != 'pull_request' guard. The new steps will execute on
    push to main and on merge_group runs.
    
    * Foundry.Hosting IntegrationTests: invoke build-and-push script with absolute path
    
    The pwsh shell on the GitHub Actions runner couldn't resolve ./scripts/it-build-image.ps1
    when the step had no working-directory set; the step inherits the runner's PWD which is
    not always the repo root after preceding steps. Use github.workspace explicitly to remove
    the ambiguity.
    
    * Foundry.Hosting IntegrationTests: move it-build-image.ps1 inside the IT project tree
    
    The previous location at scripts/it-build-image.ps1 lived outside the sparse-checkout
    paths the workflow uses (.github, dotnet, python, declarative-agents), so the runner
    never had the file when the new step tried to invoke it. Move the script next to its
    sibling it-bootstrap-agents.ps1 inside the IT project tree, and anchor its relative
    paths to the repo root via  so callers can invoke it from any PWD.
    
    * Move scripts/it-build-image.ps1 -> dotnet/tests/Foundry.Hosting.IntegrationTests/scripts/it-build-image.ps1
    * Add Push-Location to the resolved repo root inside the script (Pop-Location in finally)
      so the existing relative paths (TestContainerProject, hashed src dirs) keep working
      no matter where the script is invoked from.
    * Update the workflow path filter and the step's invocation path to the new location.
    
    * Foundry.Hosting IntegrationTests: enable 5 HappyPath tests on the live Foundry endpoint
    
    The fixture already constructs ProjectOpenAIClient via the per-agent path that beta.1
    supports (new ProjectOpenAIClient(uri, cred, opts { AgentName })), so no SDK pin bump
    is required to run the smoke tests end-to-end. Un-skip the 5 tests that pass against
    the live test container.
    
    Tests un-skipped (verified passing locally against tao-foundry-prj):
    
    * RunAsync_ReturnsNonEmptyTextAsync
    * RunStreamingAsync_YieldsAtLeastOneUpdateAsync
    * MultiTurn_WithPreviousResponseId_PreservesContextAsync
    * StoredFalse_Baseline_DoesNotPersistResponseAsync
    * Instructions_FromContainerDefinition_AreObeyedAsync
    
    Tests still skipped with a more specific reason (4 of 9 in HappyPath plus all
    ToolCalling*, McpToolbox, Toolbox, CustomStorage) because the test container does not
    yet emit usable response_id / conversation_id chains, and the placeholder scenarios are
    not implemented in the test container's Program.cs. These are test container limitations,
    not infra bugs, and can be un-skipped as the container surfaces stabilize.
    
    * Foundry.Hosting IntegrationTests: extract hosted IT into parallel job, add Workflows dep
    
    Address Wesley's review feedback on PR #5598:
    
    1. Pull Foundry hosted-agent IT into its own dotnet-foundry-hosted-it job that runs in parallel to dotnet-build and dotnet-test. Same path-filter gate keeps it skipped on unrelated edits. Builds only the filtered solution containing Foundry.Hosting.IntegrationTests and src deps. dotnet-build-and-test-check now waits on it too.
    
    2. Add Microsoft.Agents.AI.Workflows to the foundryHosting paths-filter and to hashedDirs in it-build-image.ps1 since Foundry.Hosting transitively depends on it.
    
    TFM constraint on the IT csproj stays at net10.0 because AgentConformance.IntegrationTests targets net10/net472 and is consumed by ~12 other IT projects on net472.
    
    ---------
    
    Co-authored-by: Roger Barreto <rbarreto@microsoft.com>
  • .NET: Add hosted agent observability sample (#5660)
    * .Net: Add hosted agent observability sample
    
    Mirrors the Python sample added in #5608 for Foundry hosted agents. The
    .NET hosting library already wires OpenTelemetry automatically via
    Microsoft.Agents.AI.Foundry.Hosting (ApplyOpenTelemetry) plus
    Azure.AI.AgentServer.Core's AddAgentHostTelemetry, so no framework
    changes are needed. The sample is documentation plus a runnable artifact
    that produces an interesting span tree (invoke_agent / agent_invoke /
    chat / execute_tool).
    
    Adds Hosted-Observability under FoundryHostedAgents/responses with two
    small tools (GetCurrentLocation, GetWeather), agent.yaml /
    agent.manifest.yaml declaring OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT
    (the .NET equivalent of Python's ENABLE_SENSITIVE_DATA), Dockerfile +
    Dockerfile.contributor, .env.example and README explaining the .NET vs
    Python defaults. Project added to agent-framework-dotnet.slnx.
    
    * Address PR feedback: use Random.Shared and add .dockerignore
  • .NET: Add Microsoft.Agents.AI.Hyperlight package for CodeAct integration (.NET) (#5329)
    * Add Microsoft.Agents.AI.Hyperlight package for CodeAct integration
    
    Introduces a new Microsoft.Agents.AI.Hyperlight package that enables CodeAct-style sandboxed code execution via Hyperlight (hyperlight-sandbox .NET SDK, PR #46) for .NET agents, following the docs/features/code_act/dotnet-implementation.md design and the Python agent_framework_hyperlight reference.
    
    Highlights:
    - HyperlightCodeActProvider (AIContextProvider): injects an execute_code tool and CodeAct guidance per invocation; single-instance-per-agent via a fixed StateKeys value; supports multiple provider-owned tools (exposed inside the sandbox via call_tool), file mounts, and an outbound domain allow-list; snapshot/restore per run.
    - HyperlightExecuteCodeFunction: standalone AIFunction for manual/static wiring when the sandbox configuration is fixed.
    - Approval model via CodeActApprovalMode (AlwaysRequire / NeverRequire) with propagation from ApprovalRequiredAIFunction-wrapped tools.
    - Unit tests (instruction builder, tool bridge, approval computation, provider CRUD, ProvideAIContextAsync snapshot isolation and approval wrapping).
    - Env-gated integration test (HYPERLIGHT_PYTHON_GUEST_PATH).
    - Three samples under samples/02-agents/AgentWithCodeAct (interpreter, tool-enabled, manual wiring).
    
    Build is not yet runnable: requires .NET SDK 10.0.200 and the not-yet-published HyperlightSandbox.Api 0.1.0-preview NuGet package. Package is marked IsPackable=false until the dependency is available.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Address PR #5329 review feedback for Hyperlight CodeAct provider
    
    - A. Build-breakers: drop unused usings, override test TargetFrameworks
      off net472, drop redundant Microsoft.Extensions.AI.Abstractions PackageRef.
    - B. API: keep CRUD but rebuild sandbox when config fingerprint changes;
      add HyperlightCodeActProviderOptions.CreateForWasm/CreateForJavaScript
      factory methods (Backend/ModulePath now read-only); rename WorkspaceRoot
      to HostInputDirectory; convert AllowedDomain & FileMount from record to
      sealed class; drop ToolBridge.Unwrap (ApprovalRequiredAIFunction is
      invocable as-is).
    - C. ToolBridge: collapse SerializeResult switch; add comment explaining
      AOT-driven choice to keep JsonNode.Parse over typed Deserialize.
    - D. InstructionBuilder: drop language-specific 'Python code' phrasing;
      strip host filesystem paths from execute_code description.
    - E. Style polish: ternary expression-body for ComputeApprovalRequired,
      .Where(x is not null), .ToList() over .ToArray() in IReadOnlyList
      returns.
    - F. Samples: add guest-module / KVM-WHP build instructions to Step01;
      note future Excel-upload sample in Step02.
    
    Also adds SandboxExecutorTests covering the new RunSnapshot.ComputeFingerprint
    used for sandbox-rebuild detection.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Align Hyperlight package id and JS warm-up with merged upstream SDK
    
    The .NET SDK in hyperlight-dev/hyperlight-sandbox PR #46 has merged. The
    published package id is Hyperlight.HyperlightSandbox.Api (the bare
    HyperlightSandbox.Api remains the assembly/namespace) and the reference
    CodeExecutionTool uses 'void 0;' as the JavaScript warm-up no-op. Update
    the package reference, project comment, README, and SandboxExecutor warm-up
    accordingly.
    
    No functional change beyond that — all other public APIs we depend on
    (SandboxBuilder.With*, Sandbox.Run/RegisterToolAsync/AllowDomain/Snapshot/
    Restore, ExecutionResult, SandboxBackend) match the merged shape.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Bump Hyperlight package to 0.4.0 and fix build/test issues
    
    Hyperlight.HyperlightSandbox.Api 0.4.0 is now published on nuget.org. Bump
    the version reference and address the analyzer/runtime issues that surfaced
    once restore could complete:
    
    - Add HyperlightJsonContext source-generated JsonSerializerContext for the
      execute_code result + tool error envelopes; route arbitrary AIFunction
      results through AIJsonUtilities.DefaultOptions to keep IsAotCompatible=true.
    - Replace explicit ObjectDisposedException throws with
      ObjectDisposedException.ThrowIf (CA1513).
    - Use HyperlightSandbox.Api.SandboxBackend in cref docs to disambiguate.
    - Update tests to match AIContext.Tools being IEnumerable<AITool>, drop
      ConfigureAwait(false) in xUnit test methods (xUnit1030), use collection
      expressions for AllowedDomain methods.
    - Add 'using OpenAI.Chat;' to all three samples so AsAIAgent resolves.
    - Verified: dotnet build of all four hyperlight projects + samples succeeds
      on net8/9/10; dotnet test for the unit tests passes 32/32 on net10.0.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fix CI check failures: file encoding (UTF-8 BOM + LF) and broken markdown link
    
    - Convert all new .cs/.csproj files to UTF-8 with BOM and LF line endings
      to satisfy the dotnet/.editorconfig charset/end_of_line settings
      enforced by check-format.
    - Drop unused System.Collections.Generic using in HyperlightCodeActProviderTests.
    - Add missing using Microsoft.Extensions.AI in CodeActApprovalMode.cs and
      shorten ApprovalRequiredAIFunction cref (IDE0001).
    - Fix broken README link to docs/decisions/0024-codeact-integration.md.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Address PR review: AIFunction inheritance, packaging, GetService approval check
    
    - HyperlightExecuteCodeFunction now inherits AIFunction directly. The
      AsAIFunction() indirection is gone; instances are accepted anywhere an
      AIFunction is. Approval requirement is surfaced via GetService<ApprovalRequiredAIFunction>()
      which lazily exposes a wrapping ApprovalRequiredAIFunction proxy when the
      effective ApprovalMode/tool stack requires it.
    - ComputeApprovalRequired now uses GetService<ApprovalRequiredAIFunction>() so
      approval-required tools nested anywhere in the AITool decorator stack are
      detected (not just the top-most class).
    - csproj: drop IsPackable=false (ready to release with the published
      Hyperlight.HyperlightSandbox.Api 0.4.0 dependency); add PackageReadmeFile
      and pack README.md at the package root, matching the pattern used by
      Aspire.Hosting.AgentFramework.DevUI / Microsoft.Agents.AI.DurableTask.
    - Update Step03 sample and README wording to reflect direct AIFunction usage.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • .NET: Harness Feature branch (#5310)
    * .NET: Add a TODO AIContextProvider (#5233)
    
    * Add a TODO AIContextProvider
    
    * Add unit tests
    
    * Address PR comments
    
    * Address PR comments
    
    * Fix test after removing one tool
    
    * .NET: Add a ModeProvider for managing agent modes (#5247)
    
    * Add a ModeProvider for managing agent modes
    
    * Fix typo
    
    * Fix typo
    
    * Fix typo
    
    * Address PR comments
    
    * .NET: Add sample to show how to build a harness (#5268)
    
    * Add sample to show how to build a harness
    
    * Improve sample
    
    * Sample max output tokens and model
    
    * Fix encoding
    
    * Fix model name in readme
    
    * Address PR comments
    
    * .NET: Add context window size compaction strategy for harness (#5304)
    
    * Add context window size compaction strategy for harness
    
    * Apply suggestions from code review
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * Address PR comments
    
    ---------
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * .NET: Add a file memory provider (#5315)
    
    * Add a file memory provider
    
    * Address PR comments
    
    * Fix review comments.
    
    * Add additional unit tests
    
    * Addressing PR comments.
    
    * .NET:  Harness: Improve prompts and add FileSystem store (#5365)
    
    * Harness: Improve prompts and add FileSystem store
    
    * Address PR comments
    
    * .NET: Harness: Improve path validation (#5404)
    
    * Harness: Improve path validation
    
    * Address PR comments
    
    * .NET: Add always approve helpers, improve sample and fix bug (#5451)
    
    * Add always approve helpers, improve sample and fix bug
    
    * Address PR comments
    
    * .NET: Make Todo, Mode and FileMemory providers more configurable (#5477)
    
    * Make Todo, Mode and FileMemory providers more configurable
    
    * Address PR comments.
    
    * .NET: Add subagents provider and sample (#5518)
    
    * Add subagents provider and sample
    
    * Addressing PR comments.
    
    * .NET: Harness filememory index plus instructions consistency (#5540)
    
    * Add FileMemoryProvider index and improve instruction consistency
    
    * Address PR comments.
    
    * Address PR comments
    
    * Address PR comments.
    
    * Apply suggestion from @rogerbarreto
    
    Co-authored-by: Roger Barreto <19890735+rogerbarreto@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Roger Barreto <19890735+rogerbarreto@users.noreply.github.com>
    
    * .NET: Refactor harness console to be more extensible and easy to understand with better UX (#5573)
    
    * Refactor harness console to be more extensible and easy to understand with better UX.
    
    * Fix formatting issues.
    
    * Allow multiple clarifications in one response
    
    * Address PR comments
    
    * .NET: Add FileAccessProvdider and concurrency fix for FileMemoryProvider (#5583)
    
    * Add FileAccessProvdider and concurrency fix for FileMemoryProvider
    
    * Address PR comments
    
    ---------
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    Co-authored-by: Roger Barreto <19890735+rogerbarreto@users.noreply.github.com>
  • .NET: Add dedicated Foundry.Hosting UnitTest project (#5592)
    * Foundry.Hosting.UnitTests: extract project from Foundry.UnitTests
    
    Move all Hosting/* tests, three toolbox TestData JSONs, and the FakeAuthenticationTokenProvider/HttpHandlerAssert/TestDataUtil helpers (trimmed to toolbox getters) into a new Microsoft.Agents.AI.Foundry.Hosting.UnitTests project. Add it to the slnx and grant the new assembly InternalsVisibleTo from Microsoft.Agents.AI.Foundry and Microsoft.Agents.AI.Foundry.Hosting.
    
    * Foundry.Hosting.UnitTests: align namespaces to assembly name
    
    Rename namespaces from Microsoft.Agents.AI.Foundry.UnitTests(.Hosting) to Microsoft.Agents.AI.Foundry.Hosting.UnitTests across all moved tests, the duplicated helpers, and the trimmed TestDataUtil. Also fixes the prior namespace inconsistency in FoundryToolboxTests.
    
    * Foundry.Hosting.UnitTests: split WorkflowIntegrationTests by SUT
    
    Replace the WorkflowIntegrationTests file (an IT-named file inside a UT project) with two SUT-focused files plus a shared test-doubles file:
    
    - AgentFrameworkResponseHandlerWorkflowTests.cs - the 5 handler-driven tests that exercise AgentFrameworkResponseHandler with a real workflow agent.
    - OutputConverterWorkflowTests.cs - the 5 OutputConverter tests driven by hand-crafted update sequences mirroring real workflow patterns.
    - WorkflowTestAgents.cs - StreamingTextAgent and ThrowingStreamingAgent extracted as internal types used by both files.
    
    * Foundry.UnitTests: trim Hosting-related conditionals and dead testdata
    
    Now that Hosting tests live in their own project:
    - drop the Compile Remove guard for the Hosting subfolder,
    - drop the .NETCoreApp-only PackageReferences (Azure.AI.AgentServer.Responses, Microsoft.AspNetCore.TestHost, OpenTelemetry, OpenTelemetry.Exporter.InMemory),
    - drop the conditional ProjectReference to Microsoft.Agents.AI.Foundry.Hosting,
    - delete the three Toolbox JSON files and the matching Toolbox getters in TestDataUtil.
    
    * Foundry.Hosting.UnitTests: drop redundant 'using Microsoft.Agents.AI.Foundry.Hosting'
    
    The new project namespace is Microsoft.Agents.AI.Foundry.Hosting.UnitTests, which already brings the parent Microsoft.Agents.AI.Foundry.Hosting namespace into scope. The explicit using statement is therefore redundant (IDE0005). Caught by 'dotnet format --verify-no-changes' running on Linux against the .NET 10 SDK.
    
    * Foundry.Hosting: drop InternalsVisibleTo to Foundry.UnitTests
    
    The non-hosting Foundry.UnitTests project no longer holds any Hosting tests after the split, so it doesn't need access to internal types in Microsoft.Agents.AI.Foundry.Hosting. Only Microsoft.Agents.AI.Foundry.Hosting.UnitTests needs it.
    
    * Foundry.Hosting: rename DelegatingResponsesClient to UserAgentResponsesClient
    
    Address westey-m's review feedback on PR #5453: `Delegating*` is conventionally reserved for inheritable base classes (mirroring `DelegatingHandler`) where consumers override one or two members. This polyfill is sealed and only injects the User-Agent supplement, so the new name reflects its actual purpose.
    
    Renamed via `git mv` to preserve history:
    * `src/Microsoft.Agents.AI.Foundry.Hosting/DelegatingResponsesClient.cs` to `UserAgentResponsesClient.cs`
    * `tests/Microsoft.Agents.AI.Foundry.Hosting.UnitTests/DelegatingResponsesClientTests.cs` to `UserAgentResponsesClientTests.cs`
    
    Class, constructor, and all references updated across:
    * `src/.../UserAgentResponsesClient.cs` (class + constructor + internal log message)
    * `src/.../ServiceCollectionExtensions.cs` (cref + type check + instantiation)
    * `src/.../HostedAgentUserAgentPolicy.cs` (cref)
    * `tests/Foundry.UnitTests/RequestOptionsExtensionsTests.cs` (comment)
    * `tests/Foundry.Hosting.UnitTests/UserAgentResponsesClientTests.cs` (class + cref + instantiations)
  • .NET: Add declarative HttpRequestAction sample (#5572)
    * Add declarative HttpRequestAction support to workflows
    
    * Clean up response body for diagnostics  and fix tests.
    
    * Fix merge with main.
    
    * Remove redundant fallback for request content headers.
    
    * Add declarative InvokeHttpRequest sample
    
    * Fix solution file and update sample yaml comments
    
    * Add final newline to sample class to fix formatting failure
  • .NET: dotnet: Add server-side Foundry Toolbox support and fix SDK beta.4 br… (#5450)
    * dotnet: Add server-side Foundry Toolbox support and fix SDK beta.4 breaking changes
    
    Add FoundryToolbox and AIProjectClient extensions to Microsoft.Agents.AI.Foundry.Hosting
    for server-side toolbox tool integration matching Python's FoundryChatClient.get_toolbox()
    pattern. Tools are fetched from the Foundry project SDK and passed as server-side tools
    in the Responses API request.
    
    New files:
    - FoundryToolbox.cs: Core implementation using AgentAdministrationClient SDK
    - AIProjectClientToolboxExtensions.cs: Extension methods on AIProjectClient
    - Agent_Step25_ToolboxServerSideTools sample with create helper and combine flow
    - 19 unit tests covering param validation, conversion, sanitization, and extensions
    
    SDK breaking changes (Azure.AI.AgentServer.Responses beta.3 -> beta.4):
    - FunctionToolCallOutputResource renamed to OutputItemFunctionToolCallOutput
    - AzureAIAgentServerResponsesModelFactory made internal, replaced with direct constructors
    - ResponseUsage constructor now requires non-null token details parameters
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * fix: reuse endpoint variable in CreateSampleToolboxAsync
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * fix: pass endpoint through static local functions to avoid capture
    
    Static local functions cannot capture top-level variables. Thread the
    endpoint parameter through Main, CombineToolboxes, and CreateSampleToolboxAsync.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * refactor: remove unused projectClient param from CreateSampleToolboxAsync
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Update dotnet/samples/02-agents/AgentsWithFoundry/Agent_Step25_ToolboxServerSideTools/README.md
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * Update dotnet/samples/02-agents/AgentsWithFoundry/Agent_Step25_ToolboxServerSideTools/Program.cs
    
    Co-authored-by: westey <164392973+westey-m@users.noreply.github.com>
    
    * Update dotnet/samples/02-agents/AgentsWithFoundry/Agent_Step25_ToolboxServerSideTools/Program.cs
    
    Co-authored-by: westey <164392973+westey-m@users.noreply.github.com>
    
    * Removing GetToolbocVersion.
    
    * Removing tests for GetToolboxVersion
    
    * fix: map cached/reasoning token counts in ConvertUsage instead of hardcoding zeros
    
    Extract InputTokenDetails.CachedTokenCount and OutputTokenDetails.ReasoningTokenCount
    from UsageDetails.AdditionalCounts, matching the pattern in AgentResponseExtensions.
    Also accumulate detail counts when merging with existing usage.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: alliscode <bentho@microsoft.com>
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    Co-authored-by: westey <164392973+westey-m@users.noreply.github.com>
  • .NET: Add dynamic tool expansion sample (#5425)
    * Add dynamic tool expansion sample
    
    * Address PR comments
    
    * Remove tool names from tool call response to avoid confusing LLM
  • .NET: Update Aspire package to be preview (#5444)
    * Update Aspire package to be preview
    
    * Also update readme file
    
    * Include README.md in pack
  • .NET: [Breaking] Migrate A2A agent and hosting to A2A SDK v1 (#5423)
    * update a2a agent to the latest a2a sdk (#5257)
    
    * Move A2A samples from 04-hosting to 02-agents (#5267)
    
    Move the A2A sample projects (A2AAgent_AsFunctionTools and
    A2AAgent_PollingForTaskCompletion) from samples/04-hosting/A2A/ to
    samples/02-agents/A2A/ to better align with the sample directory
    structure. Update solution file and samples README accordingly.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * .NET: Fix stream reconnection for A2AAgent (#5275)
    
    * Add SSE stream reconnection support to A2AAgent
    
    Implement automatic reconnection for SSE streams that disconnect mid-task,
    using the Last-Event-ID header to resume from where the stream left off.
    
    Changes:
    - Add InvokeStreamingWithReconnectAsync method to A2AAgent with configurable
      max retries and delay between attempts
    - Add new log messages for reconnection events
    - Add A2AAgent_StreamReconnection sample demonstrating the feature
    - Update existing polling sample to use simplified SendMessageAsync API
    - Add unit tests for stream reconnection logic
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * address comments
    
    * Address PR review feedback
    
    - Dispose SSE enumerator before GetTaskAsync fallback to release HTTP connection
    - Wrap StreamWriter in using blocks with leaveOpen:true and explicit UTF-8 encoding
    - Print update.Text instead of update object in stream reconnection sample
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * .NET: Use IA2AClientFactory to create A2AClient (#5277)
    
    * Refactor A2A extensions to use IA2AClientFactory and add ProtocolSelection sample
    
    - Update A2AAgentCardExtensions to accept IA2AClientFactory instead of A2AClientOptions
    - Update A2ACardResolverExtensions to accept IA2AClientFactory
    - Update A2AClientExtensions to accept IA2AClientFactory
    - Update A2AAgent to use IA2AClientFactory for client creation
    - Add A2AAgent_ProtocolSelection sample demonstrating protocol selection
    - Add comprehensive unit tests for all changes
    - Update README files with new sample reference
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Reorder params: options before loggerFactory in A2A extensions
    
    Move A2AClientOptions parameter before ILoggerFactory in AsAIAgent
    and GetAIAgentAsync extension methods to follow the repo convention
    of keeping LoggerFactory and CancellationToken as the last parameters.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * .NET: Migrate A2A hosting to A2A SDK v1 (#5363)
    
    * .NET: Migrate A2A hosting to A2A SDK v1
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * remove unused agent card
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * .NET: Split A2A endpoint mapping into protocol-specific methods (#5413)
    
    * .NET: Refactor A2A hosting registration into A2AServerServiceCollectionExtensions
    
    - Rename A2AHostingOptions to A2AServerRegistrationOptions
    - Move server registration logic from A2AEndpointRouteBuilderExtensions
      and AIAgentExtensions into new A2AServerServiceCollectionExtensions
    - Remove A2AProtocolBinding and AIAgentExtensions (consolidated)
    - Update samples and tests to use the new registration API
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * address copilot comments
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Remove unnecessary using directive in AgentWebChat.AgentHost
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * restore AsyncEnumerable package version
    
    * address copilot initial feedback
    
    * address automated code review and formatting issues
    
    * fix formatting issues
    
    * Add DI wiring verification tests for AddA2AServer
    
    Add three tests to A2AServerServiceCollectionExtensionsTests that verify
    custom keyed services are actually wired through to the A2AServer, not
    just that the server resolves non-null:
    
    - Custom IAgentHandler: verifies the keyed handler is invoked when
      processing a SendMessageRequest instead of the default A2AAgentHandler.
    - Custom AgentSessionStore (no handler): verifies the keyed session
      store's GetSessionAsync is called during request processing when no
      custom handler is registered.
    - Default stores end-to-end: verifies the InMemoryAgentSessionStore and
      InMemoryTaskStore defaults successfully process a request. Uses a new
      CreateAgentMockForRequests helper that includes SerializeSessionCoreAsync
      setup needed by InMemoryAgentSessionStore.
    
    All tests call A2AServer.SendMessageAsync directly (no HTTP layer needed)
    and use CancellationToken timeouts to guard against hangs.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • .NET [WIP] Foundry Hosted Agents Support (#5312)
    * Add Azure AI Foundry Responses hosting adapter
    
    Implement Microsoft.Agents.AI.Hosting.AzureAIResponses to host agent-framework
    AIAgents and workflows within Azure Foundry as hosted agents via the
    Azure.AI.AgentServer.Responses SDK.
    
    - AgentFrameworkResponseHandler: bridges ResponseHandler to AIAgent execution
    - InputConverter: converts Responses API inputs/history to MEAI ChatMessage
    - OutputConverter: converts agent response updates to SSE event stream
    - ServiceCollectionExtensions: DI registration helpers
    - 336 unit tests across net8.0/net9.0/net10.0 (112 per TFM)
    - ResponseStreamValidator: SSE protocol validation tool for samples
    - FoundryResponsesHosting sample app
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Bump System.ClientModel to 1.10.0 for Azure.Core 1.52.0 compat
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Clean up tests and sample formatting
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Update Azure.AI.AgentServer packages to 1.0.0-alpha.20260401.5
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Add hosted package version suffix (0.9.0-hosted) to distinguish from mainline
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Move Foundry Responses hosting into Microsoft.Agents.AI.Foundry package
    
    Move source and test files from the standalone Hosting.AzureAIResponses project
    into the Foundry package under a Hosting/ subfolder. This consolidates the
    Foundry-specific hosting adapter into the main Foundry package.
    
    - Source: Microsoft.Agents.AI.Foundry.Hosting namespace
    - Tests: merged into Foundry.UnitTests/Hosting/
    - Conditionally compiled for .NETCoreApp TFMs only (net8.0+)
    - Deleted standalone Hosting.AzureAIResponses project and test project
    - Updated sample and solution references
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Bump package version to 0.9.0-hosted.260402.2
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Bump OpenTelemetry packages to fix NU1109 downgrade errors
    
    - OpenTelemetry/Api/Exporter.Console/Exporter.InMemory: 1.13.1 -> 1.15.0
    - OpenTelemetry.Exporter.OpenTelemetryProtocol: already 1.15.0
    - OpenTelemetry.Extensions.Hosting: already 1.14.0
    - OpenTelemetry.Instrumentation.AspNetCore/Http: already 1.14.0
    - OpenTelemetry.Instrumentation.Runtime: 1.13.0 -> 1.14.0
    - Azure.Monitor.OpenTelemetry.Exporter: 1.4.0 -> 1.5.0
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fix CA1873: guard LogWarning with IsEnabled check
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fix model override bug and add client REPL sample
    
    - InputConverter: stop propagating request.Model to ChatOptions.ModelId
      Hosted agents use their own model; client-provided model values like
      'hosted-agent' were being passed through and causing server errors.
    - Add FoundryResponsesRepl sample: interactive CLI client that connects
      to a Foundry Responses endpoint using ResponsesClient.AsAIAgent()
    - Bump package version to 0.9.0-hosted.260403.1
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Catch agent errors and emit response.failed with real error message
    
    Previously, unhandled exceptions from agent execution would bubble up
    to the SDK orchestrator, which emits a generic 'An internal server
    error occurred.' message — hiding the actual cause (e.g., 401 auth
    failures, model not found, etc.).
    
    Now AgentFrameworkResponseHandler catches non-cancellation exceptions
    and emits a proper response.failed event containing the real error
    message, making it visible to clients and in logs.
    
    OperationCanceledException still propagates for proper cancellation
    handling by the SDK.
    
    Also bumps package version to 0.9.0-hosted.260403.2.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Renaming and merging hosting extensions. (#5091)
    
    * Rename AddAgentFrameworkHandler to AddFoundryResponses and add MapFoundryResponses
    
    - Rename extension methods: AddAgentFrameworkHandler -> AddFoundryResponses, MapAgentFrameworkHandler -> MapFoundryResponses
    - AddFoundryResponses now calls AddResponsesServer() internally
    - Add MapFoundryResponses() extension on IEndpointRouteBuilder
    - Update sample and tests to use new API names
    - Remove redundant AddResponsesServer() and /ready endpoint from sample
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fixing numbering in sample.
    
    ---------
    
    Co-authored-by: alliscode <bentho@microsoft.com>
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Address breaking changes in 260408
    
    * Bump hosted internal package version
    
    * Add UserAgent middleware tests for Foundry hosting
    
    * Hosting Samples update
    
    * Hosting Samples update
    
    * Hosting Samples update
    
    * Hosting Samples update
    
    * ChatClientAgent working
    
    * Adding SessionStorage and SessionManagement, improving samples to align Consumption vs Hosting
    
    * Using updates
    
    * Update chat client agent for contributor and devs
    
    * Foundry Agent Hosting
    
    * Address text rag sample working
    
    * Version bump
    
    * Adding LocalTools + Workflow samples
    
    * Removing extra using samples
    
    * Add Hosted-McpTools sample with dual MCP pattern
    
    Demonstrates two MCP integration layers in a single hosted agent:
    - Client-side MCP: McpClient connects to Microsoft Learn, agent handles
      tool invocations locally (docs_search, code_sample_search, docs_fetch)
    - Server-side MCP: HostedMcpServerTool delegates tool discovery and
      invocation to the LLM provider (Responses API), no local connection
    
    Includes DevTemporaryTokenCredential for Docker local debugging,
    Dockerfile.contributor for ProjectReference builds, and the openai/v1
    route mapping for AIProjectClient compatibility in Development mode.
    
    * .NET: Bump Azure.AI.AgentServer packages to 1.0.0-beta.1/beta.21 and fix br… (#5287)
    
    * Bump Azure.AI.AgentServer packages to 1.0.0-beta.1/beta.21 and fix breaking API changes
    
    - Azure.AI.AgentServer.Core: 1.0.0-beta.11 -> 1.0.0-beta.21
    - Azure.AI.AgentServer.Invocations: 1.0.0-alpha.20260408.4 -> 1.0.0-beta.1
    - Azure.AI.AgentServer.Responses: 1.0.0-alpha.20260408.4 -> 1.0.0-beta.1
    - Azure.Identity: 1.20.0 -> 1.21.0 (transitive requirement)
    - Azure.Core: 1.52.0 -> 1.53.0 (transitive requirement)
    - Remove azure-sdk-for-net dev feed (packages now on nuget.org)
    - Fix OutputConverter for new builder API (auto-tracked children, split EmitTextDone/EmitDone)
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fixing small issues.
    
    ---------
    
    Co-authored-by: alliscode <bentho@microsoft.com>
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Add Azure AI Foundry Responses hosting adapter
    
    Implement Microsoft.Agents.AI.Hosting.AzureAIResponses to host agent-framework
    AIAgents and workflows within Azure Foundry as hosted agents via the
    Azure.AI.AgentServer.Responses SDK.
    
    - AgentFrameworkResponseHandler: bridges ResponseHandler to AIAgent execution
    - InputConverter: converts Responses API inputs/history to MEAI ChatMessage
    - OutputConverter: converts agent response updates to SSE event stream
    - ServiceCollectionExtensions: DI registration helpers
    - 336 unit tests across net8.0/net9.0/net10.0 (112 per TFM)
    - ResponseStreamValidator: SSE protocol validation tool for samples
    - FoundryResponsesHosting sample app
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Bump System.ClientModel to 1.10.0 for Azure.Core 1.52.0 compat
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Clean up tests and sample formatting
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Update Azure.AI.AgentServer packages to 1.0.0-alpha.20260401.5
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Add hosted package version suffix (0.9.0-hosted) to distinguish from mainline
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Move Foundry Responses hosting into Microsoft.Agents.AI.Foundry package
    
    Move source and test files from the standalone Hosting.AzureAIResponses project
    into the Foundry package under a Hosting/ subfolder. This consolidates the
    Foundry-specific hosting adapter into the main Foundry package.
    
    - Source: Microsoft.Agents.AI.Foundry.Hosting namespace
    - Tests: merged into Foundry.UnitTests/Hosting/
    - Conditionally compiled for .NETCoreApp TFMs only (net8.0+)
    - Deleted standalone Hosting.AzureAIResponses project and test project
    - Updated sample and solution references
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Bump package version to 0.9.0-hosted.260402.2
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Bump OpenTelemetry packages to fix NU1109 downgrade errors
    
    - OpenTelemetry/Api/Exporter.Console/Exporter.InMemory: 1.13.1 -> 1.15.0
    - OpenTelemetry.Exporter.OpenTelemetryProtocol: already 1.15.0
    - OpenTelemetry.Extensions.Hosting: already 1.14.0
    - OpenTelemetry.Instrumentation.AspNetCore/Http: already 1.14.0
    - OpenTelemetry.Instrumentation.Runtime: 1.13.0 -> 1.14.0
    - Azure.Monitor.OpenTelemetry.Exporter: 1.4.0 -> 1.5.0
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fix CA1873: guard LogWarning with IsEnabled check
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fix model override bug and add client REPL sample
    
    - InputConverter: stop propagating request.Model to ChatOptions.ModelId
      Hosted agents use their own model; client-provided model values like
      'hosted-agent' were being passed through and causing server errors.
    - Add FoundryResponsesRepl sample: interactive CLI client that connects
      to a Foundry Responses endpoint using ResponsesClient.AsAIAgent()
    - Bump package version to 0.9.0-hosted.260403.1
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Catch agent errors and emit response.failed with real error message
    
    Previously, unhandled exceptions from agent execution would bubble up
    to the SDK orchestrator, which emits a generic 'An internal server
    error occurred.' message — hiding the actual cause (e.g., 401 auth
    failures, model not found, etc.).
    
    Now AgentFrameworkResponseHandler catches non-cancellation exceptions
    and emits a proper response.failed event containing the real error
    message, making it visible to clients and in logs.
    
    OperationCanceledException still propagates for proper cancellation
    handling by the SDK.
    
    Also bumps package version to 0.9.0-hosted.260403.2.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Renaming and merging hosting extensions. (#5091)
    
    * Rename AddAgentFrameworkHandler to AddFoundryResponses and add MapFoundryResponses
    
    - Rename extension methods: AddAgentFrameworkHandler -> AddFoundryResponses, MapAgentFrameworkHandler -> MapFoundryResponses
    - AddFoundryResponses now calls AddResponsesServer() internally
    - Add MapFoundryResponses() extension on IEndpointRouteBuilder
    - Update sample and tests to use new API names
    - Remove redundant AddResponsesServer() and /ready endpoint from sample
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fixing numbering in sample.
    
    ---------
    
    Co-authored-by: alliscode <bentho@microsoft.com>
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Address breaking changes in 260408
    
    * Bump hosted internal package version
    
    * Add UserAgent middleware tests for Foundry hosting
    
    * Hosting Samples update
    
    * Hosting Samples update
    
    * Hosting Samples update
    
    * Hosting Samples update
    
    * ChatClientAgent working
    
    * Adding SessionStorage and SessionManagement, improving samples to align Consumption vs Hosting
    
    * Using updates
    
    * Update chat client agent for contributor and devs
    
    * Foundry Agent Hosting
    
    * Address text rag sample working
    
    * Version bump
    
    * Adding LocalTools + Workflow samples
    
    * Removing extra using samples
    
    * Add Hosted-McpTools sample with dual MCP pattern
    
    Demonstrates two MCP integration layers in a single hosted agent:
    - Client-side MCP: McpClient connects to Microsoft Learn, agent handles
      tool invocations locally (docs_search, code_sample_search, docs_fetch)
    - Server-side MCP: HostedMcpServerTool delegates tool discovery and
      invocation to the LLM provider (Responses API), no local connection
    
    Includes DevTemporaryTokenCredential for Docker local debugging,
    Dockerfile.contributor for ProjectReference builds, and the openai/v1
    route mapping for AIProjectClient compatibility in Development mode.
    
    * Bump Azure.AI.AgentServer packages to 1.0.0-beta.1/beta.21 and fix breaking API changes
    
    - Azure.AI.AgentServer.Core: 1.0.0-beta.11 -> 1.0.0-beta.21
    - Azure.AI.AgentServer.Invocations: 1.0.0-alpha.20260408.4 -> 1.0.0-beta.1
    - Azure.AI.AgentServer.Responses: 1.0.0-alpha.20260408.4 -> 1.0.0-beta.1
    - Azure.Identity: 1.20.0 -> 1.21.0 (transitive requirement)
    - Azure.Core: 1.52.0 -> 1.53.0 (transitive requirement)
    - Remove azure-sdk-for-net dev feed (packages now on nuget.org)
    - Fix OutputConverter for new builder API (auto-tracked children, split EmitTextDone/EmitDone)
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fixing small issues.
    
    * Fix IDE0009: add 'this' qualification in DevTemporaryTokenCredential
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fix IDE0009: add 'this' qualification in all HostedAgentsV2 samples
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fix CHARSET: add UTF-8 BOM to Hosted-LocalTools and Hosted-Workflows
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fix dotnet format: add Async suffix to test methods (IDE1006), fix encoding and style
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Register AgentSessionStore in test DI setups
    
    Add InMemoryAgentSessionStore registration to all ServiceCollection
    setups in AgentFrameworkResponseHandlerTests and WorkflowIntegrationTests.
    This is needed after the AgentSessionStore infrastructure was introduced
    in the responses-hosting feature. Tests still have NotImplementedException
    stubs for CreateSessionCoreAsync which will be fixed when the session
    infrastructure is fully available.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Add Invocations protocol samples (hosted echo agent + client) (#5278)
    
    Add Hosted-Invocations-EchoAgent: a minimal echo agent hosted via the
    Invocations protocol (POST /invocations) using AddInvocationsServer and
    MapInvocationsServer, bridged to an Agent Framework AIAgent through a
    custom InvocationHandler.
    
    Add SimpleInvocationsAgent: a console REPL client that wraps HttpClient
    calls to the /invocations endpoint in a custom InvocationsAIAgent,
    demonstrating programmatic consumption of the Invocations protocol.
    
    Both samples default to port 8088 for consistency with other hosted
    agent samples.
    
    * Restructure FoundryHostedAgents samples into invocations/ and responses/
    
    Align dotnet hosted agent samples with the Python side (PR #5281) by
    reorganizing the directory structure:
    
    - Remove HostedAgentsV1 entirely (old API pattern)
    - Split HostedAgentsV2 into invocations/ and responses/ based on protocol
    - Move Using-Samples accordingly (SimpleAgent to responses, SimpleInvocationsAgent to invocations)
    - Update slnx with new project paths and add previously missing invocations projects
    - Update README cd paths from HostedAgentsV2 to invocations or responses
    - Rename .env.local to .env.example to match Python naming convention
    - Fix format violations in newly included invocations projects
    
    * Remove launchSettings, use .env for port configuration
    
    - Delete all launchSettings.json files (port 8088 now comes from ASPNETCORE_URLS in .env)
    - Add DotNetEnv to Hosted-Invocations-EchoAgent so it loads .env like the responses samples
    - Create .env.example for EchoAgent with ASPNETCORE_URLS and ASPNETCORE_ENVIRONMENT
    - Add AGENT_NAME to ChatClientAgent and FoundryAgent .env.example (required by those samples)
    - Add AZURE_BEARER_TOKEN=DefaultAzureCredential to all .env.example files
    - Update DevTemporaryTokenCredential in all 6 samples to treat the sentinel value
      as unavailable, allowing ChainedTokenCredential to fall through to DefaultAzureCredential
    - Update EchoAgent README with Configuration section
    
    * Use placeholder for AGENT_NAME in Hosted-FoundryAgent .env.example
    
    * Move FoundryResponsesHosting to responses/Hosted-WorkflowHandoff, use GetResponsesClient
    
    * Rename Hosted-Workflows to Hosted-Workflow-Simple, Hosted-WorkflowHandoff to Hosted-Workflow-Handoff
    
    * Remove FoundryResponsesRepl and empty FoundryResponsesHosting directory
    
    * Add Dockerfiles, README, agent yamls and bearer token support to Hosted-Workflow-Handoff
    
    - Add Dockerfile and Dockerfile.contributor for Docker-based testing
    - Add agent.yaml and agent.manifest.yaml with triage-workflow as primary agent
    - Add README.md following sibling pattern, noting Azure OpenAI vs Foundry endpoint
    - Add DevTemporaryTokenCredential and ChainedTokenCredential for Docker auth
    - Register triage-workflow as non-keyed default so azd invoke works without model
    - Update .env.example with AZURE_BEARER_TOKEN sentinel
    - Add .gitignore to 04-hosting to suppress VS-generated launchSettings.json
    - Fix docker run image name in Hosted-Workflow-Simple README
    
    * Fix AgentFrameworkResponseHandlerTests: implement session methods in test mock agents
    
    * .NET: Auto-instrument resolved AIAgents with OpenTelemetry for Foundry Hosted Agents (#5316)
    
    * Auto-instrument resolved AIAgents with OpenTelemetry using Core ResponsesSourceName
    
    * Add OTel telemetry capture tests for Foundry hosted agent handler
    
    * Net: Prepare Foundry Preview Release (#5336)
    
    * Prepare Foundry preview release 1.2.0-preview.*
    
    Bump VersionPrefix to 1.2.0 and update the preview stamp date. Invert packaging opt-in so only the Foundry preview set produces NuGet packages:
    
    - Microsoft.Agents.AI.Abstractions
    
    - Microsoft.Agents.AI
    
    - Microsoft.Agents.AI.Workflows
    
    - Microsoft.Agents.AI.Workflows.Generators
    
    - Microsoft.Agents.AI.Foundry
    
    Flip IsReleased=false on the preview set so they pick up the -preview.YYMMDD.N suffix. Gate GeneratePackageOnBuild on IsPackable=true. Remove the global IsPackable=true from nuget-package.props so the repo-level default (false) applies to everything else.
    
    * Lower preview VersionPrefix to 0.0.1
    
    Retroactive preview publish: bump VersionPrefix and GitTag from 1.2.0 to 0.0.1 so the 5 Foundry preview packages emit as 0.0.1-preview.260417.1.
    
    * Net: Publish all packages as 0.0.1-preview.260417.2 (#5341)
    
    Revises the Foundry pre-release approach to publish ALL normally packable src projects as preview packages stamped 0.0.1-preview.260417.2, including projects previously flagged IsReleased=true or with a non-default VersionSuffix (rc/alpha).
    
    nuget-package.props:
    
    - Collapse the four conditional PackageVersion expressions (IsReleaseCandidate, VersionSuffix, default preview, IsReleased stable) into a single unconditional 0.0.1-preview.260417.2. On this preview-only branch every package ships with the same pre-release stamp regardless of per-project flags.
    
    - Restore the global IsPackable=true default (offsetting the repo-wide IsPackable=false in Directory.Build.props). Projects that opt out (Mem0, Declarative) already set IsPackable=false AFTER importing this file so they remain non-packable.
    
    - Remove the IsReleased-gated EnablePackageValidation line. Package validation does not apply to a 0.0.1 preview.
    
    csproj reverts (Abstractions, Agents.AI, Workflows, Workflows.Generators, Foundry):
    
    - Revert the IsPackable=true opt-in block introduced in #5336 (now redundant since the props default is true again).
    
    - Restore IsReleased=true to its pre-PR value. The setting is now a no-op because the props no longer branches on it.
    
    * Bump preview version to 260420.1 and fix AgentServer package deps (#5367)
    
    - Bump PackageVersion to 0.0.1-preview.260420.1
    - Bump Azure.AI.AgentServer.Core beta.21 -> beta.22 (required by
      Azure.AI.AgentServer.Responses beta.3)
    - Replace AgentHostTelemetry.ResponsesSourceName with local constant
      (type made internal in AgentServer.Core beta.22)
    
    Co-authored-by: alliscode <bentho@microsoft.com>
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * .NET: Hosted agents toolbox support (#5368)
    
    * feat: Add Foundry Toolbox (MCP) support to AgentFrameworkResponseHandler
    
    Adds support for Foundry Toolsets MCP proxy integration in the hosted agent
    response handler. Toolsets connect at startup via IHostedService, gating the
    readiness probe per spec §3.1. MCP tools are injected into every request's
    ChatOptions and OAuth consent errors (-32006) are intercepted and surfaced as
    mcp_approval_request + incomplete SSE events.
    
    New files:
    - FoundryToolboxOptions.cs: configuration POCO for toolset names and API version
    - FoundryToolboxBearerTokenHandler.cs: DelegatingHandler with Azure Bearer token
      auth, Foundry-Features header injection, and 3x exponential backoff on 429/5xx
    - McpConsentContext.cs: AsyncLocal-based per-request consent state shared between
      the tool wrapper and the response handler
    - ConsentAwareMcpClientTool.cs: AIFunction wrapper that catches -32006 errors and
      signals consent via shared state and linked CancellationTokenSource
    - FoundryToolboxService.cs: IHostedService that creates McpClient per toolset at
      startup and exposes cached tools
    
    Modified files:
    - AgentFrameworkResponseHandler.cs: injects toolbox tools into ChatOptions, sets
      up linked CTS consent interception, emits mcp_approval_request on -32006
    - ServiceCollectionExtensions.cs: adds AddFoundryToolboxes(params string[]) extension
    - Microsoft.Agents.AI.Foundry.csproj: adds ModelContextProtocol and Azure.Identity
      dependencies under NETCoreApp condition
    
    Sample:
    - Hosted-Toolbox: minimal hosted agent sample using AddFoundryToolboxes
    
    * Rename toolset to toolbox in user-facing API; rename ConsentAwareMcpClientTool to ConsentAwareMcpClientAIFunction
    
    * Add HostedMcpToolboxAITool for client-selectable Foundry toolboxes
    
    Introduces HostedMcpToolboxAITool, a marker tool subclassing HostedMcpServerTool that rides the OpenAI Responses 'mcp' wire format to let clients request a specific Foundry toolbox per request.
    
    - New FoundryAITool.CreateHostedMcpToolbox(name, version?) factory.
    
    - FoundryToolboxOptions.StrictMode (default true) rejects unregistered toolboxes; set to false to allow lazy-open on first use.
    
    - FoundryToolboxService.GetToolboxToolsAsync(name, version?) resolves cached or lazy-opened MCP tools.
    
    - AgentFrameworkResponseHandler parses request.Tools for foundry-toolbox://name[?version=v] markers and injects resolved tools per request, merging with pre-registered ones.
    
    - Unit tests for marker parsing and strict-mode resolution.
    
    * Bump Azure.AI.Projects to 2.1.0-alpha; add ToolboxRecord/ToolboxVersion factory overloads + tests
    
    * Fix PR review issues: retry off-by-one, URI encoding, docs, tests, build
    
    - Fix off-by-one in FoundryToolboxBearerTokenHandler retry loop (4 attempts → 3)
    - URI-encode version parameter in HostedMcpToolboxAITool.BuildAddress
    - Add XML doc clarifying version pinning is reserved for future use
    - Add comment clarifying AddHostedService deduplication safety
    - Fix DevTemporaryTokenCredential expiry to use DateTimeOffset.MaxValue
    - Fix AgentCard ambiguity in A2AServer sample with using alias
    - Add 18 new unit tests for retry handler and ReadMcpToolboxMarkers
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Roger Barreto <19890735+rogerbarreto@users.noreply.github.com>
    Co-authored-by: alliscode <bentho@microsoft.com>
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * .NET: Hosted agent adapter (#5371)
    
    * Bump preview version to 260420.1 and fix AgentServer package deps
    
    - Bump PackageVersion to 0.0.1-preview.260420.1
    - Bump Azure.AI.AgentServer.Core beta.21 -> beta.22 (required by
      Azure.AI.AgentServer.Responses beta.3)
    - Replace AgentHostTelemetry.ResponsesSourceName with local constant
      (type made internal in AgentServer.Core beta.22)
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fix CA1873: guard LogError with IsEnabled check in FoundryToolboxService
    
    Wrap the LogError call with an IsEnabled(LogLevel.Error) guard to satisfy
    the CA1873 analyzer rule which flags potentially expensive argument
    evaluation when logging is disabled.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: alliscode <bentho@microsoft.com>
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * .NET: Hosted agent adapter (#5374)
    
    * Bump preview version to 260420.1 and fix AgentServer package deps
    
    - Bump PackageVersion to 0.0.1-preview.260420.1
    - Bump Azure.AI.AgentServer.Core beta.21 -> beta.22 (required by
      Azure.AI.AgentServer.Responses beta.3)
    - Replace AgentHostTelemetry.ResponsesSourceName with local constant
      (type made internal in AgentServer.Core beta.22)
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fix CA1873: guard LogError with IsEnabled check in FoundryToolboxService
    
    Wrap the LogError call with an IsEnabled(LogLevel.Error) guard to satisfy
    the CA1873 analyzer rule which flags potentially expensive argument
    evaluation when logging is disabled.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Bumping NuGet version
    
    ---------
    
    Co-authored-by: alliscode <bentho@microsoft.com>
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * .NET: Hosted agent adapter (#5406)
    
    * Bump preview version to 260420.1 and fix AgentServer package deps
    
    - Bump PackageVersion to 0.0.1-preview.260420.1
    - Bump Azure.AI.AgentServer.Core beta.21 -> beta.22 (required by
      Azure.AI.AgentServer.Responses beta.3)
    - Replace AgentHostTelemetry.ResponsesSourceName with local constant
      (type made internal in AgentServer.Core beta.22)
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fix CA1873: guard LogError with IsEnabled check in FoundryToolboxService
    
    Wrap the LogError call with an IsEnabled(LogLevel.Error) guard to satisfy
    the CA1873 analyzer rule which flags potentially expensive argument
    evaluation when logging is disabled.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Bumping NuGet version
    
    * Restore conditional versioning, remove dev feed, bump Azure.AI.Projects to beta.1
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: alliscode <bentho@microsoft.com>
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Hosted agent adapter (#5408)
    
    * Bump preview version to 260420.1 and fix AgentServer package deps
    
    - Bump PackageVersion to 0.0.1-preview.260420.1
    - Bump Azure.AI.AgentServer.Core beta.21 -> beta.22 (required by
      Azure.AI.AgentServer.Responses beta.3)
    - Replace AgentHostTelemetry.ResponsesSourceName with local constant
      (type made internal in AgentServer.Core beta.22)
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fix CA1873: guard LogError with IsEnabled check in FoundryToolboxService
    
    Wrap the LogError call with an IsEnabled(LogLevel.Error) guard to satisfy
    the CA1873 analyzer rule which flags potentially expensive argument
    evaluation when logging is disabled.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Bumping NuGet version
    
    * Restore conditional versioning, remove dev feed, bump Azure.AI.Projects to beta.1
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Address PR #5312 review comments
    
    - Add comment explaining NU1903 suppression (Microsoft.Bcl.Memory transitive vuln)
    - Remove NU1903 from sample/test projects where not needed
    - Fix Dockerfile ENTRYPOINT mismatch in Hosted-Workflow-Simple
    - Align agent name to 'hosted-workflow-simple' in agent.yaml and README
    - Fix Hosted-McpTools README: replace GitHub PAT refs with Microsoft Learn
    - Fix session persistence: only persist when client provides conversation ID
    - Upgrade IsNullOrEmpty to IsNullOrWhiteSpace for session ID checks
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: alliscode <bentho@microsoft.com>
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Split Foundry into stable V1 and preview Hosting package
    
    Extract hosted agent functionality from Microsoft.Agents.AI.Foundry into a
    new Microsoft.Agents.AI.Foundry.Hosting preview package. This resolves NU5104
    build errors caused by the stable Foundry package depending on prerelease
    Azure SDK packages (Azure.AI.AgentServer.Responses, Azure.AI.Projects beta).
    
    Changes:
    - Create Microsoft.Agents.AI.Foundry.Hosting with VersionSuffix=preview,
      targeting .NET Core only (net8.0/9.0/10.0)
    - Move all Hosting/ source files to the new project
    - Move ToolboxRecord/ToolboxVersion overloads to FoundryAIToolExtensions
    - Revert Azure.AI.Projects to 2.0.0 in Directory.Packages.props;
      Hosting uses VersionOverride for 2.1.0-beta.1
    - Clean V1 Foundry csproj: remove beta deps, ASP.NET Core ref, hosting conditionals
    - Update 8 hosted agent sample projects to reference Foundry.Hosting
    - Split unit tests: ToolboxRecord/ToolboxVersion tests moved to Hosting/
    - Add Foundry.Hosting to solution file
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Address PR review comments: experimental attrs, doc fixes, token propagation
    
    - Add [Experimental(OPENAI001)] to all 7 public Hosting types per reviewer request
    - Fix McpConsentContext XML doc: 'Thread-static' -> 'Async-local' (AsyncLocal
      flows with ExecutionContext, not thread-static)
    - Expand UserAgentMiddleware test regex to match prerelease versions (e.g. 1.0.0-rc.4)
    - Propagate CancellationToken in AgentFrameworkResponseHandler session save
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Remove unnecessary MEAI001 suppression from stable Foundry package
    
    MEAI001 was a leftover from when Hosting code lived in the same project.
    The stable V1 Foundry package builds clean without it, and suppressing
    experimental diagnostics in a released package can hide unintentional
    exposure of experimental APIs to consumers.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Add Foundry.Hosting to release solution filter
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: alliscode <bentho@microsoft.com>
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    Co-authored-by: Ben Thomas <ben.thomas@microsoft.com>
  • .NET: Features/3768-devui-aspire-integration (#3771)
    * adds devui integration and samples
    
    * adds unit tests for devui integration
    
    * fix: correct formatting of copyright notice in unit test files
    
    * fixes formatting issues
    
    * fixes build for net8 target
    
    * fixes formatting errors on test apphost
    
    * adds copyright notice to multiple files and removes unnecessary using directives
    
    * Update dotnet/aspire-integration/Aspire.Hosting.AgentFramework.DevUI/DevUIAggregatorHostedService.cs
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * Update dotnet/aspire-integration/Aspire.Hosting.AgentFramework.DevUI/DevUIAggregatorHostedService.cs
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * Update dotnet/tests/Aspire.Hosting.AgentFramework.DevUI.UnitTests/Aspire.Hosting.AgentFramework.DevUI.UnitTests.csproj
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * Update dotnet/samples/DevUIIntegration/DevUIIntegration.AppHost/DevUIIntegration.AppHost.csproj
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * Update dotnet/aspire-integration/Aspire.Hosting.AgentFramework.DevUI/DevUIAggregatorHostedService.cs
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * Refactor project files to use TargetFrameworks instead of TargetFramework for multi-targeting support; add optional port property to DevUIResource class.
    
    * Add unit tests for DevUIAggregatorHostedService; refactor project files for TargetFrameworks support
    
    * Refactor project files to use TargetFrameworks for multi-targeting support in DevUIIntegration samples
    
    * Remove unnecessary using directive for Aspire.Hosting in DevUIAggregatorHostedServiceTests
    
    * merge
    
    * fixes Conversation routing for non-first backends
    
    * add documentation for devui integration sample
    
    * update project references in solution file for improved integration
    
    * fixes package versions post merge
    
    * move Aspire.Hosting.AgentFramework.DevUI to dotnet/src
    
    Move the project from aspire-integration/ to src/ to be consistent
    with the location of all other projects in the repo.
    
    * move DevUI sample to samples/05-end-to-end/DevUIAspireIntegration
    
    Move the sample from samples/DevUIIntegration/ to
    samples/05-end-to-end/DevUIAspireIntegration/ to match the location
    of other end-to-end samples.
    
    * remove unnecessary net472 framework condition from sample csproj files
    
    These projects only target net10.0, so the
    Condition="'$(TargetFramework)' != 'net472'" on ItemGroup is unnecessary.
    
    * update sample model name from gpt-4.1 to gpt-5.4
    
    Use a more up-to-date model name in the DevUI integration samples.
    
    * Revert "remove unnecessary net472 framework condition from sample csproj files"
    
    This reverts commit 08cf41253b.
    
    * fix: use TargetFrameworks to override multi-targeting from Directory.Build.props
    
    The parent Directory.Build.props sets TargetFrameworks to net10.0;net472,
    which overrides the singular TargetFramework in each csproj. Use the plural
    TargetFrameworks property set to net10.0 only to properly override it, and
    remove the now-unnecessary net472 condition on ItemGroup.
    
    * fixes aspire config
    
    * fix: update Microsoft.Extensions packages to version 10.0.1
    
    * Address Copilot review feedback on DevUI Aspire integration
    
    - Fix request body dropping in ProxyConversationsAsync: always read the
      body when ContentLength > 0 before routing, then pass it through to
      all proxy calls (previously null was passed when backend was resolved
      from query param or conversation map)
    - Fix resource leak: dispose aggregator on startup failure in catch block
    - Fix XML docs: accurately describe embedded resource serving behavior
    - Remove reflection from DevUIResourceTests (InternalsVisibleTo already set)
    - Make sensitive telemetry conditional on Development environment in samples
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * fix: update chat client version to gpt41 in both EditorAgent and WriterAgent
    
    ---------
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    Co-authored-by: Roger Barreto <19890735+rogerbarreto@users.noreply.github.com>
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • .NET: Add Code Interpreter container file download samples (#5014)
    * Add Code Interpreter container file download samples (#3081)
    
    - Add Agent_OpenAI_Step06_CodeInterpreterFileDownload (Public OpenAI)
    - Add Agent_Step24_CodeInterpreterFileDownload (Microsoft Foundry)
    - Both samples demonstrate downloading cfile_/cntr_ container files
      via ContainerClient instead of the standard Files API
    - Update solution file and parent READMEs
    
    * Address review feedback: flatten nested foreach loops using SelectMany
    
    Addresses https://github.com/microsoft/agent-framework/pull/5014#discussion_r3046908449 and https://github.com/microsoft/agent-framework/pull/5014#discussion_r3046920209
    
    ---------
    
    Co-authored-by: Roger Barreto <19890735+rogerbarreto@users.noreply.github.com>
    Co-authored-by: rogerbarreto <rogerbarreto@users.noreply.github.com>
  • .NET: Add Handoff sample (#5245)
    * feat: Add Handoff sample
    
    * docs: Add Handoff sample to readme
  • .NET: Foundry Evals integration for .NET (#4914)
    * Foundry Evals integration for .NET
    
    - Core evaluation framework: EvalItem, LocalEvaluator, FunctionEvaluator, EvalChecks
    - IAgentEvaluator interface with MeaiEvaluatorAdapter bridge
    - AgentEvaluationExtensions for agent.EvaluateAsync() overloads
    - FoundryEvals wrapping MEAI quality/safety evaluators
    - ConversationSplitters (LastTurn, Full) and IConversationSplitter
    - EvalItem.PerTurnItems() for multi-turn decomposition
    - HasImageContent for multimodal content detection
    - WorkflowEvaluationExtensions for per-agent workflow evaluation
    - 7 eval samples mirroring Python parity:
      02-agents/Evaluation: SimpleEval, ExpectedOutputs, Multimodal
      03-workflows/Evaluation: WorkflowEval
      05-end-to-end/Evaluation: FoundryQuality, MixedProviders, ConversationSplits
    - Comprehensive unit tests (1958 passing)
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Rewrite FoundryEvals to use real Foundry Evals API
    
    Replace MEAI evaluator shim with actual OpenAI EvaluationClient protocol
    methods. FoundryEvals now creates eval definitions, submits runs, polls
    for completion, and fetches per-item results server-side.
    
    - New constructor: FoundryEvals(AIProjectClient, model, evaluators)
    - Add FoundryEvalConverter for MEAI ChatMessage -> Foundry JSON format
    - Add EvalId, RunId, ReportUrl to AgentEvaluationResults
    - All 20 built-in evaluator constants now work (agent, tool, quality, safety)
    - Remove Microsoft.Extensions.AI.Evaluation.Quality/Safety dependencies
    - Update all samples for new constructor (no more ChatConfiguration)
    - Replace BuildEvaluators tests with ResolveEvaluator tests
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Add response output to CustomEvals and ExpectedOutputs samples
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Address review: pagination, validation, error handling, tests
    
    FoundryEvals fixes:
    - Add pagination for output items (has_more/after cursor)
    - Add guard clauses for pollIntervalSeconds/timeoutSeconds <= 0
    - Fix double TryGetProperty for passed field parsing
    - Throw on all-tool-evaluators with no tool definitions
    - Fix XML doc (default 300s, not 180s)
    
    New tests (30 added, 1989 total):
    - EvalChecks: NonEmpty, ContainsExpected (pass/fail/skip/case),
      HasImageContent, ToolCallsPresent
    - FoundryEvalConverter: ConvertMessage (text, image, function call,
      function results fan-out, empty fallback, mixed content),
      ConvertEvalItem, BuildTestingCriteria (quality/agent/tool/groundedness
      data mappings), BuildItemSchema
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fix review: null-refs, Data.ToString() bug, ContainsExpected, add tests
    
    - Fix NullReferenceException in sample Response display (pattern matching)
    - Fix WorkflowEvaluationExtensions Data?.ToString() producing type names
      instead of message text (pattern-match ChatMessage/AgentResponse/list)
    - Change EvalChecks.ContainsExpected to return Passed=false when no
      ExpectedOutput (was silently passing, masking misconfiguration)
    - Add EvalItem constructor tests with LastTurn/Full/null splitters
    - Add FoundryEvalConverter.ConvertMessage DataContent (base64 image) test
    - Add ExtractAgentData tests with ChatMessage, list, and AgentResponse data
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fix review: conversation fidelity, eval caching, fallback tests
    
    - WorkflowEvaluationExtensions: preserve full response messages (tool calls,
      intermediate) instead of synthetic 2-message conversation. Cast completed
      Data to AgentResponse and use Messages when available, fallback to text.
    - FoundryEvals: cache evalId per schema shape (hasContext, hasTools) so
      subsequent EvaluateAsync calls create runs under the same eval definition.
    - MeaiEvaluatorAdapter: code already correctly passes queryMessages (not full
      conversation) to IEvaluator — no change needed, verified by inspection.
    - Add tests: AgentResponse full messages preservation, unknown object
      ToString() fallback for ExtractAgentData.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Rename AzureAI→Foundry: move eval files, update references
    
    - Move FoundryEvals.cs and FoundryEvalConverter.cs from
      Microsoft.Agents.AI.AzureAI to Microsoft.Agents.AI.Foundry
    - Update namespace from AzureAI to Foundry in both files
    - Add explicit usings required by Foundry project (no implicit usings)
    - Move FoundryEvalConverter tests to Foundry.UnitTests project
      (avoids ReplacingRedactor type conflict from dual project refs)
    - Update all sample csproj references and using statements
    - Remove Foundry project reference from AI UnitTests
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * PR review round 4: wire up tool extraction, remove eval cache, fix null safety
    
    - BuildEvalItem: extract tools from agent via GetService<ChatOptions>() into EvalItem.Tools (Python parity)
    - FoundryEvals: remove eval ID cache - each call creates fresh definition (matches Python behavior)
    - FoundryEvals: replace null-forgiving operators with descriptive InvalidOperationException
    - MixedProviders sample: remove unnecessary explicit PackageReferences (transitively provided)
    - FoundryEvalConverter: document that tool results take precedence over text content
    - Add LocalEvaluator zero-checks test documenting 0 metrics = failed behavior
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Python-dotnet parity: 9 feature gaps filled
    
    New checks:
    - ToolCallArgsMatch() — verify tool call names + argument subset match
    - ToolCalledCheck(ToolCalledMode.Any, ...) — match any of the specified tools
    - ToolCalledMode enum (All/Any)
    
    FoundryEvals enhancements:
    - Default evaluators now [Relevance, Coherence, TaskAdherence] (was Relevance, Coherence)
    - Auto-add ToolCallAccuracy when items have tool definitions
    - EvaluateTracesAsync — evaluate by response_ids, trace_ids, or agent_id
    - EvaluateFoundryTargetAsync — evaluate deployed Foundry targets
    
    Result type enrichment:
    - AgentEvaluationResults: added Status, Error, PerEvaluator, DetailedItems
    - New EvalItemResult/EvalScoreResult/PerEvaluatorResult types
    - FoundryEvals populates all new fields from API responses
    
    Workflow fix:
    - Skip internal executors (_*, input-conversation, end-conversation, end)
    
    Tests: 8 new tests covering ToolCallArgsMatch, ToolCalledMode.Any, internal executor filtering
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Add MeaiEvaluatorAdapter and PerTurnItems edge case tests
    
    - 3 tests for MeaiEvaluatorAdapter: query message forwarding, synthetic
      response fallback, multiple items aggregation
    - 3 tests for EvalItem.PerTurnItems: empty conversation, no user messages,
      system+assistant only
    - StubEvaluator and StubChatClient test helpers
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Blocking link check for outdated package in DevUI.
    
    * Replace Dictionary<string, object> payloads with typed wire models
    
    Introduce internal FoundryEvalWireModels.cs with compile-time-safe types
    for the OpenAI Evals API wire format. The OpenAI .NET SDK (2.9.1) only
    provides protocol-level methods with BinaryContent/ClientResult — no
    typed request models. These internal models replace scattered dictionary
    literals with [JsonPropertyName]-annotated classes, giving:
    
    - Compile-time safety (typos become build errors)
    - Single point of change when the API evolves
    - IntelliSense discoverability
    - Cleaner serialization via JsonPolymorphic for content items
    
    Models: WireContentItem hierarchy (text, image, tool_call, tool_result),
    WireMessage, WireEvalItemPayload, WireTestingCriterion, WireItemSchema,
    WireCreateEvalRequest, WireCreateRunRequest, and data source variants.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Skip metric when Foundry returns neither score nor passed
    
    When an evaluator returns no score and no passed value, the previous
    code created BooleanMetric(name, false), which falsely failed items
    via ItemPassed. Now we skip the MEAI metric entirely for indeterminate
    results — the raw data remains available in DetailedItems for diagnostics.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Address PR #4914 review comments: fix tool evaluator bug and add tests
    
    - Fix duplicate ToolCallAccuracy: resolve evaluator names before checking
      against ToolEvaluators set (Comment 2)
    - Make FilterToolEvaluators internal for testability; add tests for the
      ArgumentException edge case when all evaluators are tool-type (Comment 3)
    - Add CancellationToken test for LocalEvaluator (Comment 4)
    - Add EvaluateAsync integration test on Run with sequential workflow and
      per-agent SubResults verification (Comment 5)
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Address Peter's review comments on PR #4914
    
    - Add trailing newline to Evaluation_FoundryQuality.csproj (Comment 6)
    - Make evaluator name lookups case-insensitive: switch BuiltinEvaluators,
      ToolEvaluators, AgentEvaluators, and ResolveEvaluator's StartsWith check
      from Ordinal to OrdinalIgnoreCase (Comment 7)
    - Add Trace.TraceWarning when Foundry returns fewer results than submitted
      items, indicating expected vs actual count before padding (Comment 8)
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Add Microsoft.Extensions.AI.Evaluation packages to Directory.Packages.props
    
    These were removed in #5269 as unused, but are needed by the Foundry
    and core evaluation integration added in this PR.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: alliscode <bentho@microsoft.com>
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • .NET: skill as class (#5027)
    * add class-based skills
    
    * address formating issues
    
    * Remove generated filtered-unit.slnx and add to .gitignore
    
    The filtered solution file is generated dynamically by
    eng/scripts/New-FilteredSolution.ps1 during CI. Checking it in
    risks it becoming stale and out-of-sync with the real solution.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Remove generated filtered-unit.slnx and add to .gitignore
    
    The filtered solution file is generated dynamically by
    eng/scripts/New-FilteredSolution.ps1 during CI. Checking it in
    risks it becoming stale and out-of-sync with the real solution.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * consolidate DI samples into one
    
    * fix file encoding
    
    * suppress compatibility warning
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • .NET: Remove OpenAIAssistantClientExtensions class (#5058)
    * Remove OpenAIAssistantClientExtensions class
    
    Remove the deprecated OpenAI Assistants API extension methods, along with
    their unit tests, integration tests, sample project, and related references.
    
    - Delete OpenAIAssistantClientExtensions.cs (source)
    - Delete OpenAIAssistantClientExtensionsTests.cs (unit + integration tests)
    - Delete Agent_With_OpenAIAssistants sample project
    - Remove sample from solution file, README, and verify-samples definitions
    - Remove AIOpenAIAssistants diagnostic ID constant
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * add removed extension methods to the suppression file
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • Python: Move workflow-samples and agent-samples under declarative-agents directory (#5011)
    * Move workflow-samples and agent-samples under declarative-agents and update all references
    
    Agent-Logs-Url: https://github.com/microsoft/agent-framework/sessions/f70f7d19-9256-4eec-b7db-28007d74440c
    
    Co-authored-by: sphenry <6749825+sphenry@users.noreply.github.com>
    
    * Fix relative paths in README files inside moved directories
    
    Agent-Logs-Url: https://github.com/microsoft/agent-framework/sessions/f70f7d19-9256-4eec-b7db-28007d74440c
    
    Co-authored-by: sphenry <6749825+sphenry@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
    Co-authored-by: sphenry <6749825+sphenry@users.noreply.github.com>
    Co-authored-by: Shawn Henry <shahen@microsoft.com>
  • .NET: Rename Microsoft.Agents.AI.AzureAI to Microsoft.Agents.AI.Foundry and consolidate FoundryMemory (#5042)
    * Update Foundry Responses as ChatClientAgent
    
    * Migrate obsolete AzureAI integration tests to versioned agent pattern
    
    Replace obsolete CreateAIAgentAsync/GetAIAgentAsync calls with
    Agents.CreateAgentVersionAsync() + AsAIAgent(AgentVersion) in all
    AzureAI integration tests.
    
    - Rename AIProjectClient* test files to FoundryVersionedAgent*
    - Register AIFunction tools in PromptAgentDefinition.Tools for
      server-side visibility via AsOpenAIResponseTool()
    - Skip structured output tests (AzureAIProjectChatClient clears
      ResponseFormat for versioned agents)
    - Remove all [Obsolete] attributes and #pragma warning disable CS0618
    
    * Merge FoundryMemory package into AzureAI under Memory/ folder
    
    Move all FoundryMemory source, unit tests, and integration tests into
    the Microsoft.Agents.AI.AzureAI package. Change namespace from
    Microsoft.Agents.AI.FoundryMemory to Microsoft.Agents.AI.AzureAI.
    
    - Add [Experimental] to FoundryMemoryProviderOptions and Scope
    - Rename internal AIProjectClientExtensions to MemoryStoreExtensions
    - Update AzureAI .csproj with Compliance.Abstractions, Redaction
    - Remove FoundryMemory from solution and release filter
    - Update sample to reference AzureAI instead of FoundryMemory
    - Delete old Microsoft.Agents.AI.FoundryMemory project and tests
    
    * Add EnsureMemoryStoreCreatedAsync and memory existence checks to integration tests
    
    - Ensure memory store is created before testing memory operations
    - Add AZURE_AI_EMBEDDING_DEPLOYMENT_NAME config setting
    - Assert memories exist in store via SearchMemoriesAsync before cleanup
    - Verify scope isolation with direct memory store queries
    
    * Fix and rename AzureAI unit tests for RAPI vs Versioned clarity
    
    - Rename AsAIAgentAsync_* to AsAIAgent_* (drop Async from method group)
    - Add _Rapi_ prefix to non-versioned (Responses API) tests
    - Add _Versioned_ prefix to versioned agent tests where needed
    - Fix RAPI tests: assert GetService<AIProjectClient>() is null
    - Fix Versioned tests: assert IsType<FoundryAgent> and
      GetService<AIProjectClient>() returns the client instance
    - Fix UserAgent header tests: proper HTTP handler routing
    - Fix ChatClient_UsesDefaultConversationIdAsync test setup
    - All 153 unit tests pass with 0 failures
    
    * Rename Microsoft.Agents.AI.AzureAI to Microsoft.Agents.AI.Foundry
    
    Rename the project, namespace, folder, and all references from
    Microsoft.Agents.AI.AzureAI to Microsoft.Agents.AI.Foundry.
    Also rename Workflows.Declarative.AzureAI to .Foundry.
    
    - Rename src, unit test, integration test, and workflow folders
    - Update namespaces in all source and test .cs files
    - Update ProjectReferences in ~47 sample and test .csproj files
    - Update solution files (.slnx, .slnf)
    - Update sample using statements
    - Update READMEs, SKILL.md, ADRs in docs/
    - Disable package validation baseline for renamed packages
    - Fix UTF-8 BOM encoding on all affected .cs files
    - AzureAI.Persistent left completely unchanged
    
    * Fix format: remove ImplicitUsings, add explicit usings, fix BOM encoding
    
    - Remove ImplicitUsings=enable from Foundry csproj to resolve IDE0005
      on shared ReplacingRedactor.cs
    - Add explicit System usings to all source files that relied on them
    - Sort usings alphabetically per editorconfig rules
    - Fix UTF-8 BOM on 12 sample Program.cs files
    - Rename Azure AI Foundry Agents to Microsoft Foundry Agents in docs
  • .NET: Add a verify-samples tool and skill (#5005)
    * Add a verify-samples tool and skill
    
    * Address PR comments
    
    * Move verify-samples to eng folder and improve definitions
  • Add Neo4j GraphRAG samples (#4994)
    * Add Neo4j GraphRAG samples
    
    * Fix sample CI issues
    
    * Address sample review feedback
    
    * Move Neo4j Python sample to end-to-end
    
    * Make Neo4j GraphRAG sample self-contained
    
    * Remove unused central package versions
  • .NET: Add inline skills API (#4951)
    * add inline skills
    
    * Fix IDE1006 and IDE0004 formatting errors in test files
    
    - Add 'Async' suffix to async test methods in FilteringAgentSkillsSourceTests,
      DeduplicatingAgentSkillsSourceTests, and AgentInMemorySkillsSourceTests
    - Use pragma to suppress false-positive IDE0004 on casts needed for overload
      disambiguation in AgentInlineSkillTests and AgentInlineSkillResourceTests
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * address issues
    
    * address comments
    
    * make inline skills script and resource model classes internal
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • .NET: [Breaking] Update Foundry Agents for Responses API (#4502)
    * Stage
    
    * Add FoundryAgentClient, model param, chatClientFactory, and RAPI samples
    
    - Add model parameter to FoundryAgentClient simple constructor
    - Add chatClientFactory parameter to both constructors
    - Switch to OpenAI.GetProjectResponsesClientForModel for direct Responses API usage
    - Add FoundryAgents-RAPI samples (Step01 Basics, Step02 Multiturn, Step03 FunctionTools)
    - Add solution folder entry for FoundryAgents-RAPI samples
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Add auto-discovery constructor and simplify RAPI samples
    
    - Add FoundryAgentClient constructor that reads AZURE_AI_PROJECT_ENDPOINT and
      AZURE_AI_MODEL_DEPLOYMENT_NAME from environment variables with DefaultAzureCredential
    - Simplify RAPI samples to use auto-discovery (no env var or credential code)
    - Remove Azure.Identity direct references from sample csproj files
    - Update READMEs to document environment variable requirements
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Add remaining RAPI samples (Step04-Step12)
    
    - Step04: Function tools with human-in-the-loop approvals
    - Step05: Structured output with typed responses
    - Step06: Persisted conversations with session serialization
    - Step07: Observability with OpenTelemetry
    - Step08: Dependency injection with hosted service
    - Step10: Image multi-modality
    - Step11: Agent as function tool (agent composition)
    - Step12: Middleware (PII, guardrails, function logging, HITL approval)
    - Update solution file and folder README with all new samples
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Add all RAPI samples (Step09-Step23) and switch to AzureCliCredential
    
    - Step09: MCP client as tools (GitHub server via stdio)
    - Step13: Plugins with dependency injection
    - Step14: Code Interpreter tool
    - Step15: Computer Use tool with screenshot simulation
    - Step16: File Search with vector stores
    - Step17: OpenAPI tools (REST Countries API)
    - Step18: Bing Custom Search
    - Step19: SharePoint grounding
    - Step20: Microsoft Fabric
    - Step21: Web Search with citations
    - Step22: Memory Search with multi-turn conversations
    - Step23: Local MCP via HTTP (Microsoft Learn)
    - Switch all samples (Step04-Step12) to use AzureCliCredential with env vars
    - Update solution file and README with all 23 samples
    - All 23 samples build successfully, tested Step05/06/11/13/21
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Switch Step01-03 samples to AzureCliCredential for consistency
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Clarify connection ID format in SharePoint and Fabric READMEs
    
    Document that SHAREPOINT_PROJECT_CONNECTION_ID and FABRIC_PROJECT_CONNECTION_ID
    should use the connection name (e.g., 'SharepointTestTool'), not the full ARM
    resource URI.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Normalize env vars, fix structured output, update READMEs with connection ID formats
    
    - Normalize AZURE_FOUNDRY_PROJECT_* env vars to AZURE_AI_PROJECT_ENDPOINT / AZURE_AI_MODEL_DEPLOYMENT_NAME across all samples (Steps 18-22 READMEs + Steps 19-20 Program.cs)
    - Fix RAPI Step05 StructuredOutput to use full constructor with ResponseFormat for streaming JSON
    - Update Deep Research sample to use AzureCliCredential
    - Enrich Bing Grounding README with full ARM resource URI format
    - Fix Bing Custom Search README env var mismatch (BING_CUSTOM_SEARCH_* -> AZURE_AI_CUSTOM_SEARCH_*)
    - Add finding instructions for connection ID and instance name in Bing Custom Search READMEs
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Refactor memory samples and switch to DefaultAzureCredential
    
    - Refactor RAPI Step22 MemorySearch: extract store setup to EnsureMemoryStoreAsync local function
    - Refactor non-RAPI Step22 MemorySearch: same pattern with explicit memory lifecycle
    - Set UpdateDelay=0 on MemoryUpdateOptions and MemorySearchPreviewTool for faster ingestion
    - Use WaitForMemoriesUpdateAsync with 500ms polling interval
    - Switch Step19 SharePoint, Step20 Fabric, Step22 MemorySearch (both) to DefaultAzureCredential
    - Remove SearchOptions from MemorySearchPreviewTool (causes unknown parameter error)
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Switch all RAPI samples to DefaultAzureCredential and format
    
    - Replace AzureCliCredential with DefaultAzureCredential across all 20 RAPI samples
    - Run dotnet format on all RAPI and non-RAPI Foundry samples
    - AzureAI unit tests: 341 passed (net10.0 + net472)
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Rename to Microsoft Foundry, add metadata, rename RAPI folder
    
    - Replace 'Azure AI Foundry' / 'Azure Foundry' with 'Microsoft Foundry' in all docs, comments, and XML docs
    - Update FoundryAgentClient metadata provider name to 'microsoft.foundry'
    - Rename FoundryAgents-RAPI folder to FoundryResponseAgents
    - Rewrite FoundryResponseAgents README with comparison table vs Foundry Agents
    - Update slnx and parent README with new folder references
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Address PR review: simplify sample comments and fix DeepResearch credential
    
    - Remove 'no server-side agent' and 'Responses API directly' phrasing from comments
    - Simplify to 'Create a FoundryAgentClient' per review feedback
    - Switch Agent_Step15_DeepResearch to DefaultAzureCredential
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Restore full DefaultAzureCredential warning comment in DeepResearch sample
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Add ADR 0020: Foundry agent type naming convention
    
    Proposes naming options for a new MAF type wrapping versioned
    Foundry agents (Prompt, ContainerApp, Hosted, Workflow) to
    distinguish from the existing FoundryResponsesAgent (RAPI path).
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Simplify FoundryResponsesAgent samples with env-var constructors and rename folders
    
    - Add env-var constructors to FoundryResponsesAgent (simple + options-based)
    - Fix Constructor 1 model optionality (no longer throws on missing AZURE_AI_MODEL_DEPLOYMENT_NAME)
    - Add ApplyModelDeploymentFallback helper for options-based constructor
    - Update all 23 FoundryResponseAgents samples to remove Environment.GetEnvironmentVariable boilerplate
    - Condense 6 simple samples to one-liner constructor calls
    - Add XML doc remarks about auto-resolved parameters on all constructors
    - Rename FoundryAgents -> FoundryVersionedAgents (server-side, versioned)
    - Rename FoundryResponseAgents -> FoundryAgents (now the default path forward)
    - Update .slnx and README cross-references for new folder names
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Add FoundryAITool factory, rename RAPI folders, and clean up references
    
    - Create FoundryAITool static factory class with 17 methods wrapping AgentTool.Create* and ResponseTool.Create* into AITool returns
    - Rename 23 FoundryAgentsRAPI_* subfolders to FoundryAgents_* (drop RAPI prefix)
    - Rename .csproj files and update .slnx references accordingly
    - Update 12 samples (6 FoundryAgents + 6 FoundryVersionedAgents) to use FoundryAITool
    - Replace all FoundryResponsesAgent references with FoundryAgent in comments and READMEs
    - Update sample READMEs to reference FoundryAITool methods
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Rename FoundryVersionedAgents subfolders from FoundryAgents_* to FoundryVersionedAgents_*
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Add FoundryVersionedAgent class and refactor extension method internals
    
    - Create FoundryVersionedAgent with private ctor and async static factory methods
      (CreateAIAgentAsync/GetAIAgentAsync) with env-var and explicit endpoint tiers
    - Extract shared internal helpers from AzureAIProjectChatClientExtensions:
      CreateChatClientAgent, CreateAgentVersionFromOptionsAsync,
      CreateAgentVersionWithProtocolAsync (tools overload),
      CreateChatClientAgentOptions, GetAgentRecordByNameAsync, ThrowIfInvalidAgentName
    - Extension methods now delegate to shared internal helpers
    - All 49 existing samples continue to build successfully
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Add CreateConversationSessionAsync, DeleteAIAgentAsync, auto-resolve model, simplify samples
    
    - Add CreateConversationSessionAsync to FoundryAgent and FoundryVersionedAgent
      (returns ChatClientAgentSession, creates server-side conversation + session in one call)
    - Add DeleteAIAgentAsync static method to FoundryVersionedAgent
    - Make model parameter optional in env-var factory overloads (auto-resolves from
      AZURE_AI_MODEL_DEPLOYMENT_NAME)
    - Update all FoundryVersionedAgents samples to use DeleteAIAgentAsync
    - Remove deploymentName env var from samples where only used for model parameter
    - Use CreateConversationSessionAsync in Step02_MultiturnConversation
    - Use explicit types instead of var for agent/session variables
    - All 49 samples build successfully
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Remove manual AIProjectClient construction from FoundryVersionedAgents samples
    
    - Replace manual AIProjectClient construction with GetService<AIProjectClient>()
      from the FoundryVersionedAgent in all dual-option and tool-specific samples
    - Remove AZURE_AI_PROJECT_ENDPOINT env var reads from updated samples
    - Remove Azure.Identity usings where no longer needed
    - Only Step01.1, Step01.2, Eval_Step01 retain manual construction (pedagogical samples)
    - All 49 samples build successfully
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Replace aiProjectClient extension calls with FoundryVersionedAgent factories in all samples
    
    - Replace aiProjectClient.CreateAIAgentAsync with FoundryVersionedAgent.CreateAIAgentAsync
      in Option 2 (Native SDK) paths across Steps 14-21
    - Replace aiProjectClient.Agents.DeleteAgentAsync with FoundryVersionedAgent.DeleteAIAgentAsync
    - Remove unused AIProjectClient variables and using directives
    - Only Step01.1, Step01.2, Eval_Step01 retain direct AIProjectClient usage (pedagogical)
    - Step16, Step22 use GetService<AIProjectClient>() for file/memory operations
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Remove unused using directives from Step01.2, Step09, Eval_Step02
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Update ADR 0020 with accepted decision: Option 6
    
    - Add Option 6 detailing FoundryAgent, FoundryVersionedAgent, FoundryAITool,
      env-var auto-discovery, and self-contained factory patterns
    - Mark decision as accepted with rationale
    - Update current state and metadata sections
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Update Step01 basics samples to use FoundryVersionedAgent factories
    
    - Step01.1: Replace manual AIProjectClient/AsAIAgent with FoundryVersionedAgent.CreateAIAgentAsync/GetAIAgentAsync/DeleteAIAgentAsync
    - Step01.2: Replace manual AIProjectClient with FoundryVersionedAgent.CreateAIAgentAsync/DeleteAIAgentAsync
    - Remove env var boilerplate and Azure.Identity dependency
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Add DeleteAIAgentVersionAsync to FoundryVersionedAgent
    
    - DeleteAIAgentAsync: deletes the agent and all its versions (existing)
    - DeleteAIAgentVersionAsync: deletes only the specific version associated with the agent instance
    - Internally delegates to Agents.DeleteAgentAsync vs Agents.DeleteAgentVersionAsync
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fix cleanup comments: DeleteAIAgentAsync deletes the agent and all its versions
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Update all FoundryVersionedAgents READMEs for FoundryVersionedAgent and auto-discovery
    
    - Rewrite main README with FoundryVersionedAgent usage, auto-discovery table, code example
    - Fix sample table links from FoundryAgents_Step* to FoundryVersionedAgents_Step*
    - Add FoundryAITool references in tool-specific sample descriptions
    - Update individual READMEs: fix stale paths, add auto-discovery note after env var blocks
    - Update tool references: AgentTool/ResponseTool -> FoundryAITool
    - Update parent 02-agents/README.md with FoundryVersionedAgent description
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Revert unrelated AGUI and Hosting.OpenAI formatting changes to main
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Remove env-var auto-discovery, add AsAIAgent, mark extensions Obsolete
    
    - Remove 2 env-var constructors from FoundryAgent (keep explicit endpoint ctors)
    - Remove 5 env-var factory methods from FoundryVersionedAgent (keep explicit ones)
    - Add 3 AsAIAgent static methods to FoundryVersionedAgent (AgentVersion/AgentRecord/AgentReference)
    - Mark all 8 AIProjectClient extension methods as [Obsolete] pointing to FoundryVersionedAgent
    - Remove ApplyModelDeploymentFallback, env var constants, Azure.Identity usings from source
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Update all samples to use explicit endpoint, credential, and model parameters
    
    - Add explicit Environment.GetEnvironmentVariable reads for AZURE_AI_PROJECT_ENDPOINT
      and AZURE_AI_MODEL_DEPLOYMENT_NAME to all 48 sample files
    - Pass new Uri(endpoint), new DefaultAzureCredential(), deploymentName to
      FoundryAgent constructors and FoundryVersionedAgent factory methods
    - Add using Azure.Identity where missing
    - Matches repo-wide pattern used by other non-Foundry samples
    - All 49 samples build successfully
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Migrate remaining samples and source from obsoleted extension methods
    
    - Migrate AgentProviders, AgentWithRAG, AgentWithMemory, HostedWorkflow samples to FoundryVersionedAgent
    - Migrate AzureAgentProvider.cs to FoundryVersionedAgent.AsAIAgent
    - Migrate AzureAIProjectChatClientTests.cs to FoundryVersionedAgent.GetAIAgentAsync
    - Remove pragma suppressions from migrated files
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Add unit tests for FoundryAgent and FoundryVersionedAgent
    
    - FoundryAgentTests.cs: 14 tests covering constructors, validation,
      properties, metadata, GetService, chat client factory, user-agent header
    - FoundryVersionedAgentTests.cs: 31 tests covering CreateAIAgentAsync,
      GetAIAgentAsync, AsAIAgent (3 overloads), DeleteAIAgentAsync,
      DeleteAIAgentVersionAsync, validation, invalid names, metadata, GetService
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Finalize Foundry agent migration
    
    Align FoundryAgent and FoundryVersionedAgent samples, docs, and tests with the explicit configuration model, clean up stale README guidance, and fix AzureAI unit test validation/build issues.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Apply formatter cleanup after validation
    
    Capture the dotnet format follow-up changes produced during branch validation so the committed state matches the successfully built and tested branch.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Add integration tests for FoundryAgent and FoundryVersionedAgent
    
    Mark old AIProjectClient extension-method integration tests as obsolete and add new integration test suites for both FoundryAgent (Responses API) and FoundryVersionedAgent (versioned agents). All 71 non-skipped tests pass against the live Foundry service.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Update ADR 0020 with test coverage details
    
    Add integration test coverage note to the Current State section of ADR 0020.
    
    * Simplify Foundry agents and validate moved samples
    
    * Rename FoundryAgent integration tests to ResponsesAgent
    
    The test classes exercise the non-versioned Responses path via
    AIProjectClient.AsAIAgent(), not the removed FoundryAgent wrapper type.
    Rename files and class names to reflect the actual test surface.
    
    * Update documentation for ChatClientAgent usage
    
    Added example usage of ChatClientAgent with JokerAgent.
    
    * Refactor ChatClientAgent instantiation for clarity
    
    * Revise agent type naming and usage examples
    
    Updated documentation to reflect changes in agent creation methods and added examples for using `ChatClientAgent`.
    
    * Fix Azure SDK namespace migration after rebase
    
    Update Azure.AI.Projects.OpenAI references to Azure.AI.Projects.Agents
    and Azure.AI.Extensions.OpenAI to match Azure.AI.Projects 2.0.0-beta.2.
    
    - Replace deprecated namespace across samples, tests, and src
    - Fix renamed types: OpenAPIFunctionDefinition -> OpenApiFunctionDefinition,
      BingCustomSearchToolParameters -> BingCustomSearchToolOptions,
      BrowserAutomationToolParameters -> BrowserAutomationToolOptions
    - Fix API changes: AgentRecord.Versions -> GetLatestVersion(),
      ResponsesClient constructor, FunctionApprovalRequestContent ->
      ToolApprovalRequestContent
    - Apply dotnet format
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Address merge markers
    
    * Replace obsolete GetAIAgentAsync with AsAIAgent in samples
    
    Switch Agent_Step07_AsMcpTool and A2AServer to use the non-obsolete
    PersistentAgentsClient.AsAIAgent(PersistentAgent) extension instead
    of the deprecated GetAIAgentAsync, fixing CS0618 build errors.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fix broken markdown links in Responses sample READMEs
    
    Replace stale ChatClientAgents_Step* folder references with the
    correct Agent_Step* names across all Responses sample READMEs.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fix format errors and address PR review comments
    
    - Fix charset and remove unused using in AzureAIProjectResponsesChatClient
    - Fix doc comment tags (code -> c) in FoundryAITool
    - Fix stray period in LocalMCP sample comment
    - Fix grammar in FoundryMemoryProvider xmldoc
    - Fix AIProjectClientAgentRunStreamingConversationTests base class
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Apply dotnet format fixes to PR-changed files
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fix build errors from format pass and apply naming conventions
    
    - Fix static call to CreateSessionAsync in Step02 samples and extension tests
    - Use expression-bodied lambda in FoundryMemoryProvider (RCS1021)
    - Apply PascalCase naming to const fields in ResponsesAgentExtensionCreateTests (IDE1006)
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Introduce FoundryAgent sealed type and update AsAIAgent extensions
    
    - Add FoundryAgent sealed class wrapping ChatClientAgent with:
      - Public ctors: (projectEndpoint, credential, model, instructions) and (agentEndpoint, credential)
      - Internal ctor: (AIProjectClient, ChatClientAgent) for extension use
      - CreateConversationSessionAsync() for server-side conversations
      - GetService<ChatClientAgent>() and GetService<AIProjectClient>()
      - MEAI user-agent policy on internally-created AIProjectClient
    - Change all AsAIAgent extension return types from ChatClientAgent to FoundryAgent
    - Update all samples and tests to use FoundryAgent type
    - Add 16 FoundryAgentTests covering ctors, GetService, UserAgent, RunAsync
    - Fix pre-existing Agent_Step12_Plugins build error
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Collapse sample folders and add FoundryAgent_Step01 sample
    
    - Move all Responses/* samples up to AgentsWithFoundry/ (flat structure)
    - Remove entire Versioned/ folder (26 samples)
    - Add FoundryAgent_Step01 sample showing direct FoundryAgent ctor usage
    - Update slnx to reflect flat folder structure
    - Fix csproj ProjectReference paths for new depth
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Update READMEs for flat AgentsWithFoundry structure
    
    - Rewrite AgentsWithFoundry/README.md with FoundryAgent quick start
    - Fix cd commands and paths in 11 sample READMEs
    - Update 02-agents/README.md to single Foundry link
    - Update AGENTS.md tree to flat structure
    - Fix AgentWithMemory cross-reference
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fix FoundryAgent_Step01 sample with full create/run/delete lifecycle
    
    Show the complete server-side agent lifecycle: create version with
    native SDK, wrap as FoundryAgent via AsAIAgent, run, then delete.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Revert RAPI samples to use AIAgent instead of FoundryAgent
    
    RAPI samples should not reference FoundryAgent directly. Restored
    original sample code with only ChatClientAgent -> AIAgent type change
    to accommodate the AsAIAgent return type.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Convert versioned-pattern samples to pure RAPI
    
    Step09, Step13, Step17, Step22 were using CreateAgentVersionAsync +
    PromptAgentDefinition which is the versioned pattern. Converted to
    use AsAIAgent(model, instructions, tools) which is the RAPI path.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fix format issues from Docker CI check
    
    - FoundryAgent_Step01: CRLF -> LF
    - Agent_Step09: missing final newline
    - Agent_Step11_Middleware: add internal modifier, final newline
    - Agent_Step02: remove redundant cast (IDE0004)
    - Agent_Step08: simplify name (IDE0001)
    - FoundryAgentTests: s_ prefix, Async suffix naming conventions
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Switch Step09 MCP sample to Microsoft Learn HTTP endpoint
    
    Replace npx stdio GitHub MCP server with the public Microsoft Learn
    MCP endpoint (https://learn.microsoft.com/api/mcp) using HTTP transport.
    No external tooling required to run.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fix missing final newline in Step09 MCP sample
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Address PR review: use DelegatingAIAgent, clean up Step01 sample
    
    - FoundryAgent now inherits DelegatingAIAgent instead of AIAgent,
      removing manual delegation boilerplate (westey-m feedback)
    - Simplified Agent_Step01_Basics to single agent creation path,
      moved composable IChatClient approach to README (westey-m feedback)
    - Fixed FoundryAgentTests param name assertion
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Update sample using Project specialized type instead
    
    * Address PR review feedback: DefaultAzureCredential warnings, sample simplifications, format fixes
    
    - Add DefaultAzureCredential production warning comments to ~25 samples
    - Simplify Anthropic and OpenAI Step01 samples to single agent
    - Convert Step11 Middleware regex patterns to [GeneratedRegex]
    - Remove unnecessary cleanup comment from Step06
    - Fix Step09 README MCP transport description
    - Enhance FoundryAgent xmldoc with non-persistent agent comparison
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Split Step02, simplify RAG Step04, sharpen Step23 differentiation
    
    - Split Step02 into 02.1 (simple multi-turn via sessions) and 02.2 (server-side conversations via CreateConversationSessionAsync)
    - RAG Step04: replace HostedFileSearchTool + MEAI wrapping with native OpenAI FileSearchTool
    - Step23: clarify DelegatingAIFunction wrapping pattern vs Step09 basic MCP
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fix Hosted MCP sample: use ResponseTool.CreateMcpTool and move tool to PromptAgentDefinition
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fix broken README link after Step02 split
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Address Sergey round 3 feedback: branding, README nav, sample rename
    
    - Replace 'Azure AI Foundry' with 'Microsoft Foundry' in ADR 0020
    - Fix 3 READMEs: 'ChatClientAgents' → 'AgentsWithFoundry' sample directory
    - Rename FoundryAgent_Step01 → Agent_Step00_FoundryAgentLifecycle for naming consistency
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • .NET: [Breaking] Restructure agent skills to use multi-source architecture (#4871)
    * initial commit
    
    * address comments
    
    * address comments
    
    * address comments
    
    * address  comments
    
    * rename executor to runner to align naming with python implementation
    
    * rename runner execute method to run method
    
    * remove poc leftovers and fix compilation issues
    
    * make script runner optional
    
    * remove unnecessary pragmas
    
    * make resources and scripts props virtual
    
    * address comments
    
    * update comment for name validation regex
    
    * address comments