Commit Graph

20 Commits

  • .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: Add IChatMessageInjector for message injection during function loop (#5679)
    * Adding the ability to inject messages during the function call loop
    
    * Split message injection functionality
    
    * Remove interface, since it is not required not that we split the chat client.
    
    * Address conversation id propogation
    
    * Fix formatting issue
  • .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 models used in dotnet samples to gpt-5.4-mini (#5080)
    * Update models used in dotnet samples to gpt-5.4-mini
    
    * Fix additional missed sample
  • .NET: Bump Azure.AI.Projects to 2.0.0 GA (#5060)
    * Bump Azure.AI.Projects to 2.0.0 GA
    
    - Update Azure.AI.Projects from 2.0.0-beta.2 to 2.0.0 in CPM
    - Update Azure.Identity from 1.19.0 to 1.20.0 (transitive dep)
    - Update System.ClientModel from 1.9.0 to 1.10.0 (transitive dep)
    - Rename types per Azure.AI.Projects.Agents 2.0.0 breaking changes:
      - AgentVersion -> ProjectsAgentVersion
      - AgentRecord -> ProjectsAgentRecord
      - AgentDefinition -> ProjectsAgentDefinition
      - AgentVersionCreationOptions -> ProjectsAgentVersionCreationOptions
      - PromptAgentDefinition -> DeclarativeAgentDefinition
      - AgentTool -> ProjectsAgentTool
      - AgentsClient -> AgentAdministrationClient
      - .Agents property -> .AgentAdministrationClient
    - Add using Azure.AI.Projects.Memory namespace (types moved)
    - Update AGENTS.md with BOM and output capture conventions
    
    * Address PR review feedback
    
    - Rename AIProjectClient parameter to aiProjectClient in AsChatClientAgent overloads
    - Fix XML doc: ProjectsAgentTool namespace from Azure.AI.Projects.OpenAI to Azure.AI.Projects.Agents
    - Rename test method to reflect DeclarativeAgentDefinition terminology
  • .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: Replace Azure Foundry/Azure AI Foundry with Microsoft Foundry in .NET samples (#5032)
    * Replace Azure Foundry/Azure AI Foundry with Microsoft Foundry in samples
    
    Update all .cs, .md, and .yaml files in dotnet/samples/ to use
    'Microsoft Foundry' instead of 'Azure Foundry' and 'Azure AI Foundry'.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Update dotnet/samples/02-agents/AgentWithMemory/AgentWithMemory_Step04_MemoryUsingFoundry/Program.cs
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * Update dotnet/samples/02-agents/Agents/Agent_Step15_DeepResearch/Program.cs
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * Update dotnet/samples/05-end-to-end/A2AClientServer/README.md
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * Update dotnet/samples/02-agents/Agents/Agent_Step15_DeepResearch/README.md
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * Update dotnet/samples/03-workflows/Agents/FoundryAgent/Program.cs
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * Update dotnet/samples/02-agents/AgentProviders/Agent_With_AzureAIProject/Program.cs
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * Fix grammar: 'an Microsoft' -> 'a Microsoft', 'agents ids' -> 'agent IDs'
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
  • .NET: [BREAKING] Rename from ServiceStoredSimulatingChatClient to PerServiceCallChatHistoryPersistingChatClient (#4993)
    * Rename from ServiceStoredSimulatingChatClient to PerServiceCallChatHistoryPersistingChatClient
    
    * Address PR comment
  • .NET: Allow Simulating service stored ChatHistory to improve consistency (#4974)
    * Allow Simulating service stored ChatHistory to improve consistency
    
    * Fixing bug in ServiceStoredSimulatingChatClient
    
    * Addressing PR comments.
    
    * Address PR comments
    
    * Apply suggestion from @SergeyMenshykh
    
    Co-authored-by: SergeyMenshykh <68852919+SergeyMenshykh@users.noreply.github.com>
    
    * Fix bug
    
    ---------
    
    Co-authored-by: SergeyMenshykh <68852919+SergeyMenshykh@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: Persist messages during function call loop (#4762)
    * Persist messages during the Function Call Loop
    
    * Revert version reset
    
    * Fix bugs and improve sample
    
    * Fix formatting issues
    
    * Also updating conversation id during run
    
    * Update based on ADR feedback
  • .NET: Obsolete the V1 helper methods and migrate samples using it where possible (#4795)
    * Obsolete the V1 helper methods and migrate samples using it where possible
    
    * Address PR comments
  • .NET: Update to OpenAI 2.9.1, Azure.AI.OpenAI 2.9.0-beta.1, Microsoft.Extensions.AI 10.4.0, and Azure.AI.Projects 2.0.0-beta.2 (#4613)
    * Initial plan
    
    * Update code for Microsoft.Extensions.AI.Abstractions 10.4.0 breaking changes
    
    - Rename FunctionApprovalRequestContent → ToolApprovalRequestContent
    - Rename FunctionApprovalResponseContent → ToolApprovalResponseContent
    - Rename UserInputRequestContent → ToolApprovalRequestContent
    - Rename UserInputResponseContent → ToolApprovalResponseContent
    - Update .FunctionCall property → .ToolCall with FunctionCallContent casts where needed
    - Update .Id property → .RequestId on the renamed types
    - Rename FunctionApprovalRequestEventGenerator → ToolApprovalRequestEventGenerator
    - Rename FunctionApprovalResponseEventGenerator → ToolApprovalResponseEventGenerator
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Update OpenAI 2.9.1, ME.AI 10.4.0, fix breaking API changes
    
    Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
    
    * Fix remaining ME.AI 10.4.0 breaking changes: MCP approval types, .Output→.Outputs
    
    Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
    
    * Use pattern matching with `when` for ToolApprovalRequestContent/FunctionCallContent
    
    Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
    
    * Update Azure.AI.OpenAI to 2.9.0-beta.1
    
    Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
    
    * Fix remaining GetResponsesClient(model) build failures for Azure.AI.OpenAI 2.9.0-beta.1
    
    Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
    
    * Address review feedback: remove redundant type checks in TestRequestAgent.cs and fix error message in AIAgentHostExecutor.cs
    
    Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
    
    * Update Azure.AI.Projects to 2.0.0-beta.2 with namespace migration
    
    - Azure.AI.Projects 2.0.0-beta.1 → 2.0.0-beta.2
    - Azure.AI.Projects.OpenAI → Azure.AI.Extensions.OpenAI (transitive)
    - Agent types moved to Azure.AI.Projects.Agents namespace
    - AgentRecord.Versions.Latest → AgentRecord.GetLatestVersion()
    - OpenAPIFunctionDefinition → OpenApiFunctionDefinition
    - BingCustomSearchToolParameters → BingCustomSearchToolOptions
    - MemorySearchPreviewTool.UpdateDelay → UpdateDelayInSecs
    - Azure.Identity 1.17.1 → 1.19.0
    - Microsoft.Identity.Client.Extensions.Msal 4.78.0 → 4.83.1
    
    Co-authored-by: rogerbarreto <19890735+rogerbarreto@users.noreply.github.com>
    
    * Fix remaining type renames for Azure.AI.Projects 2.0.0-beta.2
    
    - BrowserAutomationToolParameters → BrowserAutomationToolOptions
    - MemoryUpdateOptions.UpdateDelay stays as UpdateDelay (not renamed)
    - WaitForMemoriesUpdateAsync parameter order: pollingInterval before options
    - AIProjectAgentsOperations → AgentsClient
    
    Co-authored-by: rogerbarreto <19890735+rogerbarreto@users.noreply.github.com>
    
    * Fix format errors and OpenTelemetry test for ME.AI 10.4.0
    
    - Remove unused 'using Azure.AI.Extensions.OpenAI' and fix import ordering
      in Agent_With_AzureAIProject/Program.cs
    - Update OpenTelemetryAgentTests: gen_ai.tool.definitions is now always
      emitted regardless of EnableSensitiveData per ME.AI 10.4.0 change
      (dotnet/extensions#7346). Tool definitions are not considered sensitive.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fix GetRepoFolder() to work in git worktrees
    
    Use 'workflow-samples' directory as repo root marker instead of '.git',
    which fails in worktrees (.git is a file) and also matches too early
    when a '.github' folder exists in subdirectories.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fix formatting: remove unused usings and fix import ordering
    
    dotnet format applied across 59 impacted projects. Primarily removes
    unnecessary 'using Azure.AI.Projects' where Azure.AI.Projects.Agents
    provides all needed types, and fixes import ordering per editorconfig.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Disable AzureAIAgentsPersistent integration tests (#4769)
    
    Azure.AI.Agents.Persistent 1.2.0-beta.9 references McpServerToolApprovalResponseContent
    which was removed in ME.AI 10.4.0 (renamed to ToolApprovalResponseContent), causing
    TypeLoadException at runtime. Mark all 6 test classes with IntegrationDisabled trait
    until Persistent ships a version targeting ME.AI 10.4.0+.
    
    Upstream fix: https://github.com/Azure/azure-sdk-for-net/pull/56929
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Add README with compatibility note for AzureAI.Persistent (#4769)
    
    Documents that Azure.AI.Agents.Persistent 1.2.0-beta.9 is only compatible
    with ME.AI ≤10.3.0 and OpenAI ≤2.8.0 due to type renames in ME.AI 10.4.0.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fix file encoding: restore UTF-8 BOM on Persistent test files
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Mark AzureAI.Persistent as IsPackable=false (#4769)
    
    Prevent shipping until Azure.AI.Agents.Persistent targets ME.AI 10.4.0+.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Moving IsPackable after import
    
    ---------
    
    Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
    Co-authored-by: rogerbarreto <19890735+rogerbarreto@users.noreply.github.com>
  • .NET: Trim src references and add utility to enforce (#4693)
    * Trim src references and add utility to enforce
    
    * Potential fix for pull request finding
    
    Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
  • .NET Compaction - Introducing compaction strategies and pipeline (#4533)
    * Checkpoint
    
    * Checkpoint
    
    * Stable
    
    * Strategies
    
    * Updated
    
    * Encoding
    
    * Formatting
    
    * Cleanup
    
    * Formatting
    
    * Tests
    
    * Tuning
    
    * Update tests
    
    * Test update
    
    * Remove working solution
    
    * Add sample to solution
    
    * Sample readyme
    
    * Experimental
    
    * Format
    
    * Formatting
    
    * Encoding
    
    * Support IChatReducer
    
    * Sample output formatting
    
    * Initial plan
    
    * Replace CompactingChatClient with MessageCompactionContextProvider
    
    Co-authored-by: crickman <66376200+crickman@users.noreply.github.com>
    
    * Boundary condition
    
    * Fix encoding
    
    * Fix cast
    
    * Test coverage
    
    * Namespace
    
    * Improvements
    
    * Efficiency
    
    * Cleanup
    
    * Detect service managed conversation
    
    * Fix namespace
    
    * Fix merge
    
    * Fix test expectation
    
    * Update dotnet/src/Microsoft.Agents.AI.Abstractions/InMemoryChatHistoryProvider.cs
    
    Co-authored-by: westey <164392973+westey-m@users.noreply.github.com>
    
    * Address PR comments (x1)
    
    * Update comment
    
    * Update comments
    
    * Clean-up
    
    * Format output
    
    * Sync sample comment
    
    * Fix condition
    
    * Adjust data-flow
    
    * Address comments (x2)
    
    * Direct compaction
    
    * Fix summarization content
    
    * Argument check / fix count calculation
    
    * Minor follow-up
    
    * Diagnostics
    
    * Minor updates
    
    * Fix state test
    
    * Fix sliding window perf
    
    * Stable state keys
    
    * Increase size computation
    
    * Formatting
    
    * Add README.md for Agent_Step18_CompactionPipeline sample (#4574)
    
    * Sample comments
    
    * Updated
    
    * Update dotnet/src/Microsoft.Agents.AI/Compaction/MessageIndex.cs
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * Update dotnet/tests/Microsoft.Agents.AI.UnitTests/Compaction/CompactionProviderTests.cs
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * Update dotnet/src/Microsoft.Agents.AI/Compaction/MessageIndex.cs
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * Address copilot comments
    
    * Fix namespace
    
    * Comments / convensions
    
    * Prefix `MessageGroup` and `MessageIndex`
    
    * Fix sliding window
    
    * Update dotnet/src/Microsoft.Agents.AI/Compaction/SummarizationCompactionStrategy.cs
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * Update dotnet/src/Microsoft.Agents.AI.Abstractions/InMemoryChatHistoryProvider.cs
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * Python alignment
    
    * Fix merge
    
    * Fix equality, readme, and sample
    
    * Readme update and ToolResult fix
    
    * Update dotnet/src/Microsoft.Agents.AI/Compaction/SummarizationCompactionStrategy.cs
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * Update dotnet/samples/02-agents/Agents/Agent_Step18_CompactionPipeline/README.md
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * Simplify readme
    
    * Update dotnet/samples/02-agents/Agents/Agent_Step18_CompactionPipeline/README.md
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * Remove example
    
    * Remove unused
    
    ---------
    
    Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
    Co-authored-by: westey <164392973+westey-m@users.noreply.github.com>
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
  • .NET: [BREAKING] Change *Provider StateKey to list of StateKeys (#4395)
    * Change *Provider StateKey to list of StateKeys
    
    * Add more statekey validation tests
    
    * Address PR comments
  • [BREAKING] Add response filter for store input in *Providers (#4327)
    * Add response filter for store input for *Providers
    
    * Apply suggestions from code review
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * Address feedback
    
    * Apply suggestions from code review
    
    Co-authored-by: SergeyMenshykh <68852919+SergeyMenshykh@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    Co-authored-by: SergeyMenshykh <68852919+SergeyMenshykh@users.noreply.github.com>
  • .NET: Add helpers to more easily access in-memory ChatHistory and make ChatHistoryProvider management more configurable. (#4224)
    * Add helpers to more easily access in-memory ChatHistory and make ChatHistoryProvider management more configurable.
    
    * Apply suggestion from @Copilot
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
  • Python / .NET Samples - Restructure and Improve Samples (Feature Branc… (#4092)
    * Python: .NET Samples - Restructure and Improve Samples (Feature Branch) (#4091)
    
    * Moved by agent (#4094)
    
    * Fix readme links
    
    * .NET Samples - Create `04-hosting` learning path step (#4098)
    
    * Agent move
    
    * Agent reorderd
    
    * Remove A2A section from README 
    
    Removed A2A section from the Getting Started README.
    
    * Agent fixed links
    
    * Fix broken sample links in durable-agents README (#4101)
    
    * Initial plan
    
    * Fix broken internal links in documentation
    
    Co-authored-by: crickman <66376200+crickman@users.noreply.github.com>
    
    * Revert template link changes; keep only durable-agents README fix
    
    Co-authored-by: crickman <66376200+crickman@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
    Co-authored-by: crickman <66376200+crickman@users.noreply.github.com>
    
    * .NET Samples - Create `03-workflows` learning path step (#4102)
    
    * Fix solution project path
    
    * Python: Fix broken markdown links to repo resources (outside /docs) (#4105)
    
    * Initial plan
    
    * Fix broken markdown links to repo resources
    
    Co-authored-by: crickman <66376200+crickman@users.noreply.github.com>
    
    * Update README to rename .NET Workflows Samples section
    
    ---------
    
    Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
    Co-authored-by: crickman <66376200+crickman@users.noreply.github.com>
    
    * .NET Samples - Create `02-agents` learning path step (#4107)
    
    * .NET: Fix broken relative link in GroupChatToolApproval README (#4108)
    
    * Initial plan
    
    * Fix broken link in GroupChatToolApproval README
    
    Co-authored-by: crickman <66376200+crickman@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
    Co-authored-by: crickman <66376200+crickman@users.noreply.github.com>
    
    * Update labeler configuration for workflow samples
    
    * .NET - Reorder Agents samples to start from Step01 instead of Step04 (#4110)
    
    * Fix solution
    
    * Resolve new sample paths
    
    * Move new AgentSkills and AgentWithMemory_Step04 samples
    
    * Fix link
    
    * Fix readme path
    
    * fix: update stale dotnet/samples/Durable path reference in AGENTS.md
    
    Co-authored-by: crickman <66376200+crickman@users.noreply.github.com>
    
    * Moved new sample
    
    * Update solution
    
    * Resolve merge (new sample)
    
    * Sync to new sample - FoundryAgents_Step21_BingCustomSearch
    
    * Updated README
    
    * .NET Samples - Configuration Naming Update (#4149)
    
    * .NET: Restore AzureFunctions index parity with ConsoleApps under DurableAgents samples (#4221)
    
    * Clean-up `05_host_your_agent`
    
    * Config setting consistency
    
    * Refine samples
    
    * AGENTS.md
    
    * Move new samples
    
    * Re-order samples
    
    * Move new project and fixup solution
    
    * Fixup model config
    
    * Fix up new UT project
    
    ---------
    
    Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>