Commit Graph

1661 Commits

  • Python: Fix function_approval_response extraction in AG-UI workflow path (#4550)
    * Extract function_approval_response from workflow messages (#4546)
    
    _extract_responses_from_messages now handles function_approval_response
    content in addition to function_result content. Previously, approval
    responses sent via the messages field were silently dropped because the
    function only checked for content.type == "function_result".
    
    The approval response is keyed by content.id and includes the approved
    status, id, and serialized function_call — consistent with how
    _coerce_content identifies approval response payloads.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Apply pre-commit auto-fixes
    
    * Fix #4546: Update docstring and add integration tests for message-based approvals
    
    - Update _extract_responses_from_messages docstring to reflect that it
      now handles function_approval_response content in addition to
      function_result content.
    - Add integration tests for run_workflow_stream across two turns with
      approval responses provided via messages (function_approvals) rather
      than resume.interrupts, covering both approved and denied scenarios.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Address PR review feedback for #4546
    
    - Use safer 'not .get("interrupt")' assertion instead of 'not in'
      to handle Pydantic v2 model_dump() including keys with None values
    - Add unit test for mixed function_result and function_approval_response
      in the same message to TestExtractResponsesFromMessages
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • Python: Fix missing status input for OpenAI responses API (#4626)
    * Fix missing status input for OpenAI responses API
    
    * Fix mypy
    
    * Address comments
    
    * Remove raw_rep restore
    
    * Do not set status if it's None
  • Python: Implement annotation-based context compaction (#4469)
    * Implement annotation-based context compaction
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Handle missing compaction attributes in BaseChatClient
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fix CI typing and bandit issues
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Optimize incremental compaction annotation pass
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * refinement
    
    * Python: add ToolResultCompactionStrategy and CompactionProvider
    
    Add ToolResultCompactionStrategy that collapses older tool-call groups
    into short summary messages (e.g. [Tool calls: get_weather]) while
    keeping the most recent groups verbatim. This mirrors the .NET
    ToolResultCompactionStrategy from PR #4533.
    
    Add CompactionProvider as a context-provider that auto-applies compaction
    before each agent turn and stores compacted history in session state
    after each turn.
    
    Includes tests and samples for both features.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * refinement and alignment with dotnet PR
    
    * updated tool result compaction
    
    * updated tool result compaction
    
    * Python: add ToolResultCompactionStrategy, CompactionProvider, and skip_excluded
    
    - ToolResultCompactionStrategy collapses older tool-call groups into
      [Tool results: func_name: result] summaries with bidirectional tracing
      (same pattern as SummarizationStrategy).
    - CompactionProvider as BaseContextProvider with separate before_strategy
      and after_strategy parameters. before_strategy compacts loaded context;
      after_strategy compacts stored history via history_source_id.
    - InMemoryHistoryProvider gains skip_excluded flag to filter out messages
      marked as excluded by compaction strategies.
    - Tests, samples, and exports updated.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * fixed checks
    
    * fix mypy
    
    * Fix: ensure summary messages from both strategies get full compaction annotations
    
    SummarizationStrategy was not calling annotate_message_groups after
    inserting its summary message, so the summary lacked core group
    annotations (id, kind, index, has_reasoning, _excluded). Added the
    missing call. ToolResultCompactionStrategy already had it.
    
    Added tests verifying both strategies produce fully annotated summaries.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * updated propagation
    
    * fix mypy
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • Python: Support skill scripts execution (#4558)
    * support skill scripts execution
    
    * fix mixed line endings
    
    * address comments and fix syntax issues
    
    * use few try/except instead of one
    
    * change samples
    
    * validate either script path or script resource is set not both
    
    * fix: separate LLM args from runtime kwargs in skill script execution
    
    * address pr review comments
    
    * address PR review comments
    
    * Update python/packages/core/agent_framework/_skills.py
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * Update python/packages/core/agent_framework/_skills.py
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * Update python/packages/core/agent_framework/_skills.py
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * 1. Fixing the caching bug where parameters_schema would re-inspect on every call when the result was None
       2. Updating the arguments tool description to be more generic (not CLI-specific)
    
    * fix failing tests
    
    * address pr review comments
    
    * address pr review comments
    
    * allow resource function returning any instead of sting
    
    * address PR review comments
    
    ---------
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
  • .NET: Add FinishReason to AgentResponses (#4617)
    * Add FinishReason to AgentResponses
    
    * Address PR comments
  • .NET: SDK Patch Bump (10.0.200) - Address false positive trigger of IL2026/IL3050 diagnostics in hosting projects (#4586)
    * Suppress IL2026/IL3050 with targeted pragmas on affected methods
    
    Add #pragma warning disable/restore for IL2026 and IL3050 only around
    the specific methods where dotnet format incorrectly adds
    [RequiresUnreferencedCode] and [RequiresDynamicCode] attributes despite
    proper interceptors configuration in the csproj.
    
    See https://github.com/dotnet/sdk/issues/51136
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Upgrade to .NET SDK 10.0.200 and remove IL2026/IL3050 workarounds
    
    Bump global.json to SDK 10.0.200 which fixes the dotnet format bug
    that incorrectly added [RequiresUnreferencedCode] and
    [RequiresDynamicCode] attributes (https://github.com/dotnet/sdk/issues/51136).
    
    Remove all #pragma warning disable IL2026/IL3050 workarounds from
    source files and the --exclude-diagnostics flag from the CI format
    workflow.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Copilot <223556219+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>
  • Python: Fix broken link in purview README (504 on Microsoft 365 Dev Program URL) (#4610)
    * Initial plan
    
    * Fix broken link in purview README: replace 504-returning dev-program URL with stable learn.microsoft.com URL
    
    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>
  • Python: Fix executor_completed event with non-copyable raw_representation in mixed workflows (#4493)
    * Python: Fix `executor_completed` event with non-copyable raw_representation in mixed workflows
    
    Fixes #4455
    
    * fix(#4455): use class-level sets for deepcopy field exclusion
    
    - SerializationMixin.__deepcopy__: check type(self).DEFAULT_EXCLUDE
      instead of hardcoding 'raw_representation'
    - Content.__deepcopy__: add _SHALLOW_COPY_FIELDS class variable and
      check against it instead of hardcoding
    - Fix tautological assertion in test (was always True)
    - Add second excluded field to test to verify DEFAULT_EXCLUDE is
      respected generically
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Decouple __deepcopy__ from DEFAULT_EXCLUDE in SerializationMixin (#4455)
    
    Introduce _SHALLOW_COPY_FIELDS class variable in SerializationMixin to
    separate deep-copy semantics from serialization semantics. Previously,
    __deepcopy__ used DEFAULT_EXCLUDE to decide which fields to shallow-copy,
    conflating 'not serialized' with 'not safe to deep-copy'. A field added
    to DEFAULT_EXCLUDE purely for serialization (e.g. additional_properties)
    would be silently shared between original and copy.
    
    - Add _SHALLOW_COPY_FIELDS (default {'raw_representation'}) to
      SerializationMixin, matching the pattern already used by Content
    - Update __deepcopy__ to read from _SHALLOW_COPY_FIELDS instead of
      DEFAULT_EXCLUDE
    - Add test verifying DEFAULT_EXCLUDE fields are deep-copied unless
      also in _SHALLOW_COPY_FIELDS
    - Add test for Content._SHALLOW_COPY_FIELDS identity preservation
    - Add test for ChatResponse deep-copying additional_properties
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Add test for _SHALLOW_COPY_FIELDS and DEFAULT_EXCLUDE independence
    
    Add test_deepcopy_shallow_copy_fields_override_default_exclude to verify
    that a field in both DEFAULT_EXCLUDE and _SHALLOW_COPY_FIELDS is
    shallow-copied (controlled by _SHALLOW_COPY_FIELDS), while a field in
    DEFAULT_EXCLUDE only is still deep-copied. This addresses review comment
    #11 ensuring the two class variables control independent concerns.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Remove unnecessary local variable in __deepcopy__
    
    Inline cls._SHALLOW_COPY_FIELDS directly in the loop check instead of
    assigning to a local variable first, per review feedback.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Apply pre-commit auto-fixes
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • .NET: Added support for polymorphic type as workflow output (#4485)
    * Added support for polymorphic type as workflow output
    
    * Update Linq expression to avoid unnecessary allocations.
    
    * Added caching as per PR comment
  • Python: Prevent pickle deserialization of untrusted HITL HTTP input (#4566)
    * fix: prevent pickle deserialization of untrusted HITL input
    
    Add strip_pickle_markers() to sanitize HTTP input before it reaches
    pickle.loads() via the checkpoint decoding path. Applied as a 3-layer
    defence-in-depth:
    
    1. _app.py: sanitize req.get_json() at the HTTP boundary
    2. _workflow.py: sanitize in _deserialize_hitl_response() before decode
    3. _serialization.py: sanitize in reconstruct_to_type() as final guard
    
    Any dict containing __pickled__ or __type__ markers from untrusted
    sources is replaced with None, blocking arbitrary code execution via
    crafted payloads to POST /workflow/respond/{instanceId}/{requestId}.
    
    Includes 12 new unit tests covering the sanitizer and end-to-end
    attack prevention.
    
    * refactor: address review concerns for pickle fix
    
    1. Remove deserialize_value() fallback in _deserialize_hitl_response
       untrusted HITL data now returns as-is when no type hint is available,
       never flowing into pickle.loads().
    
    2. Move strip_pickle_markers() out of reconstruct_to_type()  the function
       is general-purpose again; untrusted-data callers are responsible for
       sanitizing first (documented with NOTE comment).
    
    3. Define _PICKLE_MARKER/_TYPE_MARKER as local constants with import-time
       assertions against core's values  decouples from private names while
       failing loudly if core ever changes them.
    
    4. Update tests to reflect new responsibility boundaries.
    
    * fix: simplify warning message and fix ruff RUF001 lint
    
    * fix: suppress pyright reportPrivateUsage on core marker imports
    
    * Lower marker-strip log from warning to debug to avoid log flooding
    
    * Replace assert with RuntimeError for marker sync checks (ruff S101)
    
    * Fix pyright and ruff CI errors in security fix
    
    - Use cast() for dict/list comprehensions in strip_pickle_markers (pyright)
    - type: ignore for narrowed dict return in _workflow.py (pyright)
    - Simplify marker imports: use core constants directly, remove local copies
    - Remove duplicate pyright ignore comment
    
    * Remove duplicate end-to-end test in TestStripPickleMarkers
    
    * Suppress mypy redundant-cast on list cast needed by pyright
  • Python: Fix store=False not overriding client default (#4569)
    * Fix store=False not overriding client default
    
    * Address comments
    
    * Fix unit tests
    
    * Fix integration tests
    
    * Fix tests
  • Fix Strands Agents documentation links in ADR (#4584)
    * Initial plan
    
    * Fix broken Strands Agents documentation links in ADR 0001
    
    Replace 5 broken strandsagents.com URLs (returning 404) with stable
    GitHub source code links in docs/decisions/0001-agent-run-response.md.
    
    The Strands Agents docs site restructured from /api-reference/python/
    to /api/python/, breaking the old links.
    
    Co-authored-by: SergeyMenshykh <68852919+SergeyMenshykh@users.noreply.github.com>
    
    * Update Strands Agents links to use official documentation site
    
    Replace GitHub source links with official strandsagents.com/docs/api/python/
    documentation URLs in docs/decisions/0001-agent-run-response.md.
    
    Co-authored-by: SergeyMenshykh <68852919+SergeyMenshykh@users.noreply.github.com>
    
    * Update Strands Agents links to use specific documentation URLs
    
    - Streaming: strandsagents.com/docs/user-guide/concepts/streaming/
    - Structured output: strandsagents.com/docs/user-guide/concepts/agents/structured-output/
    - AgentResult/stop_reason: strandsagents.com/docs/api/python/strands.agent.agent_result/#agentresult
    
    Co-authored-by: SergeyMenshykh <68852919+SergeyMenshykh@users.noreply.github.com>
    
    * Deduplicate Strands AgentResult link in stop-reason row
    
    Replaced the duplicate hyperlink on `stop_reason` with inline code,
    keeping a single AgentResult link to the same URL.
    
    Co-authored-by: SergeyMenshykh <68852919+SergeyMenshykh@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
    Co-authored-by: SergeyMenshykh <68852919+SergeyMenshykh@users.noreply.github.com>
  • .NET: Enable Microsoft.Agents.AI.FoundryMemory for NuGet release (#4559)
    * Enable Microsoft.Agents.AI.FoundryMemory for NuGet release
    
    - Remove IsPackable=false override from .csproj to inherit IsPackable=true from nuget-package.props
    - Add project to agent-framework-release.slnf for inclusion in build/sign/publish pipeline
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Update FoundryMemoryProvider and MemorySearch sample
    
    - StoreAIContextAsync fires UpdateMemoriesAsync immediately (non-accumulation)
    - WhenUpdatesCompletedAsync polls last updateId via GetUpdateResultAsync
    - Updated FoundryAgents_Step22_MemorySearch sample to create/destroy memory store
      (matching features/foundry-agent-client pattern)
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Update FoundryAgents_Step22_MemorySearch sample
    
    - Sample now creates/destroys memory store (self-contained lifecycle)
    - Uses WaitForMemoriesUpdateAsync for seeding memories
    - Cleanup in finally block deletes both agent and memory store
    - Matches features/foundry-agent-client pattern
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • .NET: Skip Azure Persistent (V1) flaky CodeInterpreter integration tests (#4583)
    * Skip flaky CodeInterpreter integration tests in CI
    
    The CreateAgent_CreatesAgentWithCodeInterpreter tests fail intermittently
    because the Azure AI Code Interpreter service sometimes fails to read/execute
    uploaded Python files. This causes all 4 integration test jobs to fail
    consistently across both platforms (ubuntu/windows) and TFMs (net10.0/net472).
    
    Mark both test variants with Skip to match the convention used by other
    flaky tests in the suite (e.g., AzureAIAgentsPersistentStructuredOutputRunTests).
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Skip flaky CodeInterpreter integration tests in CI
    
    The CreateAgent_CreatesAgentWithCodeInterpreter tests fail intermittently
    because the Azure AI Code Interpreter service sometimes fails to read/execute
    uploaded Python files. This causes all 4 integration test jobs to fail
    consistently across both platforms (ubuntu/windows) and TFMs (net10.0/net472).
    
    Mark both test variants with Skip to match the convention used by other
    flaky tests in the suite (e.g., AzureAIAgentsPersistentStructuredOutputRunTests).
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • Python: Add A2A server sample (#4528)
    * Python: Add A2A server sample and fix client streaming bug
    
    Add a pure Python A2A server sample so testing the A2A client no longer
    requires running the .NET server. The server uses the a2a-sdk's
    A2AStarletteApplication with uvicorn and supports three agent types
    (invoice, policy, logistics) backed by AzureOpenAIResponsesClient.
    
    New files:
    - a2a_server.py: Main server entry point with CLI args
    - agent_executor.py: Bridges a2a-sdk AgentExecutor to Agent Framework
    - agent_definitions.py: Agent and AgentCard factory definitions
    - invoice_data.py: Mock invoice data and query tool functions
    - a2a_server.http: REST Client requests for testing
    
    Also fixes a streaming bug in agent_with_a2a.py where async with was
    used on ResponseStream which does not support the async context manager
    protocol. Changed to async for to match all other samples.
    
    Closes #4045
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Address PR review: handle CancelledError and fix end_date filtering
    
    - Re-raise asyncio.CancelledError before the broad exception handler
      so cooperative cancellation is not swallowed.
    - Make end_date filter inclusive of the full day by comparing with
      < end + timedelta(days=1) instead of <= midnight.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • Fix chat_response_cancellation sample to use Message objects (#4532)
    The sample was passing raw strings in a list to get_response(), which
    expects Message objects. This caused an AttributeError since strings
    don't have a 'role' attribute.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • Auto-finalize ResponseStream on iteration completion (#4478)
    * Add multi-turn streaming sample and rename multi-turn samples
    
    - Rename 03_multi_turn.py to 03a_multi_turn.py
    - Add 03b_multi_turn_streaming.py showing streaming with session history
    - The new sample demonstrates calling get_final_response() after
      iterating the stream to persist conversation history
    - Update READMEs to reflect the new file names
    
    Closes #4447
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Auto-finalize ResponseStream on iteration completion
    
    When a ResponseStream is fully consumed via async iteration,
    automatically trigger finalization (finalizer + result hooks).
    This ensures session history is persisted in streaming multi-turn
    conversations without requiring an explicit get_final_response() call.
    
    - Add auto-finalize call in __anext__ on StopAsyncIteration
    - Guard inner stream finalization to prevent double-execution
    - Re-check _finalized after iteration in get_final_response()
    - Add tests for auto-finalization and streaming session history
    - Revert sample file renames from previous commit
    
    Closes #4447
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * README fix
    
    * Fix SIM102 lint: combine nested if statements
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • Python: Exclude conversation_id from chat completions API options (#4517)
    * Python: Exclude conversation_id from chat completions options (#4315)
    
    When a session with service_session_id is passed to an agent using the
    Chat Completions client, conversation_id leaked through _prepare_options()
    into AsyncCompletions.create(), causing an 'unexpected keyword argument'
    error. The Responses client already excluded conversation_id but the Chat
    Completions client did not.
    
    Added conversation_id to the exclusion set in _prepare_options().
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Apply pre-commit auto-fixes
    
    * Remove reproduction report artifact
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • Python: Fix conversation-id propagation when chat_options is a dict (#4340)
    * Fix #4305: Handle dict chat_options in _update_conversation_id
    
    _update_conversation_id assumed chat_options had attribute access, but
    ChatOptions is a TypedDict (dict). When a dict was passed, setting
    .conversation_id raised AttributeError. Now checks isinstance(dict) and
    uses key access for dicts, falling back to attribute access for objects.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Address PR feedback: use Mapping ABC and add missing tests (#4305)
    
    - Use collections.abc.Mapping instead of dict for isinstance check in
      _update_conversation_id, making it more robust for non-dict mapping types.
    - Add test for object-style chat_options with optional options dict parameter.
    - Add test verifying existing conversation_id gets overwritten (idempotent).
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Remove unnecessary Mapping check in _update_conversation_id (#4305)
    
    chat_options is always a dict, so the isinstance(chat_opts, Mapping)
    check and the else branch for attribute-style access are dead code.
    Simplify to direct dict key assignment and remove object-style tests.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • Python: [Breaking] Upgrade to azure-ai-projects 2.0+ (#4536)
    * Prepare azure-ai-projects 2.0 GA compatibility
    
    Add allow_preview support for internal AIProjectClient creation, keep backward compatibility for renamed SDK model classes, and align Azure AI/core paths and tests for GA validation workflows.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * upgrade to ai-project==2.0.0
    
    * Python: remove azure-ai-projects keyword-guard paths
    
    Assume azure-ai-projects 2.0+ in Azure AI client/provider/responses code paths by removing _supports_keyword_argument gating and related fallback branching.
    
    Also fix pyright typing in FoundryMemoryProvider memory store calls by using ResponseInputItemParam-typed items.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * check fixes
    
    * Python: remove unsupported foundry_features option
    
    Drop foundry_features from Azure AI client and provider surfaces because azure-ai-projects 2.0.0 does not expose that create_version parameter.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Python: add allow_preview to Foundry memory provider
    
    Propagate allow_preview when FoundryMemoryProvider constructs an AIProjectClient and update tests accordingly.
    
    Also finish wiring allow_preview through AzureAIClient-facing surfaces and related docs.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * aligning docstrings
    
    * udpated lock
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • [BREAKING] Python: Update github-copilot-sdk integration to use ToolInvocation/ToolResult types (#4551)
    * Update github_copilot package for github-copilot-sdk>=0.1.32 (#4549)
    
    - Update requires-python from >=3.10 to >=3.11
    - Remove Python 3.10 classifier
    - Update mypy python_version to 3.11
    - Update dependency to github-copilot-sdk>=0.1.32
    - Fix ToolResult API: use snake_case kwargs (text_result_for_llm,
      result_type) instead of camelCase (textResultForLlm, resultType)
    - Update test assertions to use attribute access on ToolResult
    - Add ToolResult type assertions to tool handler tests
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fix tests to use ToolInvocation dataclass instead of plain dict (#4549)
    
    Update test_github_copilot_agent.py to pass ToolInvocation objects to tool
    handlers instead of plain dicts, matching the github-copilot-sdk>=0.1.32 API
    where ToolInvocation is a dataclass with an .arguments attribute.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Add regression tests for ToolInvocation contract (#4549)
    
    Add tests to lock in the new ToolInvocation-based calling convention:
    - test_tool_handler_rejects_raw_dict_invocation: verifies passing a raw
      dict (old calling convention) raises TypeError/AttributeError
    - test_tool_handler_with_empty_arguments: verifies ToolInvocation with
      empty arguments works correctly for no-arg tools
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Revert requires-python to >=3.10 to avoid breaking CI (#4549)
    
    The repo CI runs with Python 3.10 (uv sync --all-packages) and all other
    packages require >=3.10. Raising this package to >=3.11 would break the
    shared install flow. The SDK dependency version constraint (>=0.1.32) will
    enforce any Python version requirement from the SDK itself.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fix min Python version for github_copilot package to >=3.11
    
    github-copilot-sdk>=0.1.32 requires Python>=3.11, which conflicts
    with the package's declared >=3.10 minimum, breaking uv sync.
    
    * Bump py version for GH workflows to 3.11, exclude GHCP sdk from 3.10 items
    
    * Fix uv command
    
    * Fixes
    
    * Update samples
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • .NET: Add security warnings to xml comments for core components (#4527)
    * Add security warnings to xml comments for core components
    
    * Address build errors.
    
    * Fix formatting issue
    
    * Fix formatting issue
    
    * Supress formatting warning
    
    * Supress format issue in ChatHistoryMemoryProvider
    
    * Fix remarks paragraphs
  • .NET: Update Anthropic to 12.8.0 and Anthropic.Foundry to 0.4.2 (#4475)
    * Initial plan
    
    * Update Anthropic to 12.8.0 and Anthropic.Foundry to 0.4.2
    
    Co-authored-by: rogerbarreto <19890735+rogerbarreto@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
    Co-authored-by: rogerbarreto <19890735+rogerbarreto@users.noreply.github.com>
  • .NET: Create a sample to show bounded chat history with overflow into chat history memory (#4136)
    * Create a sample to show bounded chat history with overflow into chat history memory
    
    * Address PR comments.
    
    * Address PR comment and fix bug
  • .NET: Update HostedAgents samples to Azure.AI.AgentServer.AgentFramework 1.0.0-beta.9 and MEAI 10.3.0 (#4477)
    * Initial plan
    
    * Update HostedAgents samples to Azure.AI.AgentServer.AgentFramework 1.0.0-beta.9 and MEAI 10.3.0
    
    Co-authored-by: rogerbarreto <19890735+rogerbarreto@users.noreply.github.com>
    
    * Fix HostedAgents samples for Microsoft.Agents.AI 1.0.0-rc2 API changes
    
    - Rename CreateAIAgent -> AsAIAgent (AgentThreadAndHITL, AgentWithHostedMCP, AgentWithTextSearchRag)
    - Rename AsAgent -> AsAIAgent (AgentsInWorkflows)
    - Replace AIContextProviderFactory with AIContextProviders and simplified TextSearchProvider ctor (AgentWithTextSearchRag)
    - Update Microsoft.Agents.AI.OpenAI to 1.0.0-rc2 (AgentThreadAndHITL, AgentWithTextSearchRag, AgentWithTools)
    - Update Microsoft.Agents.AI.Workflows to 1.0.0-rc2 (AgentsInWorkflows)
    - Add Microsoft.Agents.AI 1.0.0-rc2 reference (AgentWithHostedMCP)
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Update HostedAgents samples for beta.9 API changes and add missing projects to slnx
    
    - Use DefaultAzureCredential consistently across all samples
    - Add AgentThreadAndHITL, AgentWithLocalTools, AgentWithTools to slnx
    - Apply dotnet format
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Remove unnecessary Microsoft.Agents.AI.* package references (transitive from AgentFramework)
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Add DefaultAzureCredential production warning comments to all HostedAgents samples
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Update HostedAgents READMEs to reflect DefaultAzureCredential usage
    
    Replace AzureCliCredential references with DefaultAzureCredential in all
    HostedAgents README files to match the actual sample code.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Replace Microsoft.Extensions.AI.OpenAI with Microsoft.Agents.AI.OpenAI and remove AsIChatClient()
    
    Swap package references from Microsoft.Extensions.AI.OpenAI to
    Microsoft.Agents.AI.OpenAI across all 6 HostedAgents samples. This enables
    using the AsAIAgent() extension directly on ChatClient/ResponsesClient
    (from OpenAI.Chat/OpenAI.Responses namespaces), removing the intermediate
    AsIChatClient() call in 3 samples where it was unnecessary.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Use explicit types and AsAIAgent() extensions across all HostedAgents samples
    
    Replace var with explicit types for clarity in all 6 samples. Replace
    new ChatClientAgent() constructor calls with chatClient.AsAIAgent()
    extension method in AgentWithLocalTools and AgentsInWorkflows.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
    Co-authored-by: rogerbarreto <19890735+rogerbarreto@users.noreply.github.com>
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • .NET: Fix filter combine logic for ChatHistoryMemoryProvider (#4501)
    * Fix filter combine logic for ChatHistoryMemoryProvider
    
    * Replace var with explicit types in filter building code and test
    
    Address PR review nit: use explicit types instead of var for better
    readability in the filter-building logic and the new combined filter
    compilation test.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fix style issues
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • Python: Improve ag-ui tests and coverage (#4442)
    * Improve ag-ui tests and coverage
    
    * fix tests paths
    
    * Fixes
    
    * Improve AG-UI test robustness and correctness
    
    - Map toolName → tool_call_name in SSE helpers for TOOL_CALL_START events
    - Fail loudly on malformed SSE JSON in parse_sse_response() instead of silently dropping
    - Detect duplicate TOOL_CALL_START/TOOL_CALL_END in assert_tool_calls_balanced()
    - Remove fragile source line reference from test docstring
    - Add found guard in test_client_tool_sets_additional_properties to prevent vacuous pass
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • Python: Fix RedisContextProvider for redisvl 0.14.0 by using AggregateHybridQuery (#3954)
    * Initial plan
    
    * Fix: Replace alpha with linear_alpha in HybridQuery for redisvl 0.14.0 compatibility
    
    Co-authored-by: markwallace-microsoft <127216156+markwallace-microsoft@users.noreply.github.com>
    
    * Address code review: Improve test readability and add explanatory comment
    
    Co-authored-by: markwallace-microsoft <127216156+markwallace-microsoft@users.noreply.github.com>
    
    * Add CHANGELOG entry for redisvl 0.14.0 compatibility fix
    
    Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>
    
    * Use AggregateHybridQuery instead of HybridQuery for backward compatibility
    
    Replace HybridQuery with AggregateHybridQuery to preserve existing functionality that works with older Redis versions. The new HybridQuery in redisvl 0.14.0 requires Redis 8.4.0+ and uses a different API, while AggregateHybridQuery maintains compatibility with the original implementation.
    
    Co-authored-by: TaoChenOSU <12570346+TaoChenOSU@users.noreply.github.com>
    
    * Fix test to use linear_alpha parameter matching _redis_search implementation
    
    The test was passing alpha as a keyword argument to _redis_search(), but the
    method uses linear_alpha to match the redisvl 0.14.0 AggregateHybridQuery API.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fix pyright error: use alpha parameter matching AggregateHybridQuery API
    
    AggregateHybridQuery expects 'alpha', not 'linear_alpha'. Updated the
    _redis_search method parameter and the test accordingly.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
    Co-authored-by: markwallace-microsoft <127216156+markwallace-microsoft@users.noreply.github.com>
    Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>
    Co-authored-by: TaoChenOSU <12570346+TaoChenOSU@users.noreply.github.com>
    Co-authored-by: Ben Thomas <ben.thomas@microsoft.com>
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • Python: Propagated MCP isError flag through function middleware pipeline (#4511)
    * Propagated MCP isError flag through function middleware pipeline
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Small update
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fix CI
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • Python: Fix as_agent() not defaulting name/description from client properties (#4484)
    * Fix as_agent() not defaulting name/description from client properties
    
    AzureAIClient.as_agent() and AzureAIAgentClient.as_agent() now fall back
    to self.agent_name and self.agent_description when name/description are
    not explicitly passed. This ensures Agent.name is populated for
    telemetry spans without requiring callers to repeat the name.
    
    Fixes #4471
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Address review: use is None checks instead of truthiness
    
    Switch from name or self.agent_name to explicit is None checks so
    that callers can intentionally pass empty strings without them being
    replaced by client defaults. Added edge-case tests for empty strings.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Update docstrings to document name/description defaulting behavior
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • Python: Forward runtime kwargs to skill resource functions (#4417)
    * support code skills
    
    * address pr review comments
    
    * address package and syntax checks
    
    * address pr review comments
    
    * address pr review comment
    
    * address failed check
    
    * rename agentskill and agetnskillprovider
    
    * move agent skills related assets to _skills.py
    
    * address pr review comments
    
    * address review comments
    
    * support kwargs
    
    * address pr review feedback
  • Python: Fix Python pyright package scoping and typing remediation (#4426)
    * Fix Python pyright package scoping and typing remediation
    
    Implements issue #4407 by removing the root pyright include, adding package-level pyright includes, and resolving pyright/mypy typing issues across Python packages. Also cleans unnecessary casts and applies line-level, rule-specific ignores where external libraries are too dynamic.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Reduce pyright cost in handoff cloning
    
    Simplify cloned_options construction in HandoffAgentExecutor to avoid expensive TypedDict narrowing/inference in _handoff.py, which was causing pyright to spend a long time in orchestrations.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * fix types
    
    * Fix lint and type-check regressions
    
    Resolve current Python package check failures across lint, pyright, and mypy after recent code changes, including purview/declarative pyright issues and multiple ruff simplification findings.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * fixed hooks
    
    * Stabilize package tests and test tasks
    
    Resolve cross-package non-integration test failures, simplify streaming type flow, harden locale/culture handling, and standardize package test poe tasks to exclude integration tests where applicable.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * lots of small fixes
    
    * Fix current Python test regressions
    
    Address current failing unit tests in azure-ai, bedrock, and azure-cosmos while keeping Bedrock parsing logic inline (no new static helper methods).
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * small fixes
    
    * small fixes
    
    * removed pydantic from json
    
    * final updates
    
    * fix core
    
    * fix tests
    
    * fix obser
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • .NET: Switch auth sample to use Singletons (#4454)
    * Switch auth sample to use Singletons
    
    * Address PR comments
    
    * Add comment to warn users to choose the appropriate lifetime for their service
  • .NET: CI Build time end to end improvement (#4208)
    * .NET: Upgrade to XUnit 3 and Microsoft Testing Platform (#4176)
    
    * Fix copilot studio integration tests failure (#4209)
    
    * Fix anthropic integration tests and skip reason (#4211)
    
    * Remove accidental add of code coverage for integration tests (#4219)
    
    * Add solution filtered parallel test run (#4226)
    
    * Fix build paths (#4228)
    
    * Fix coverage settings path and trait filter (#4229)
    
    * Add project name filter to solution (#4231)
    
    * Increase Integration Test Parallelism (#4241)
    
    * Increase integration tests threads to 4x (#4242)
    
    * Separate build and test into parallel jobs (#4243)
    
    * Filter src by framework for tests build (#4244)
    
    * Separate build and test into parallel jobs
    
    * Filter source projects by framework for tests build
    
    * Pre-build samples via tests to avoid timeouts (#4245)
    
    * Separate build from run for console sample validation (#4251)
    
    * Address PR comments (#4255)
    
    * Merge and move scripts (#4308)
    
    * .NET: Add Microsoft Fabric sample #3674 (#4230)
    
    Co-authored-by: Chris <66376200+crickman@users.noreply.github.com>
    
    * Python: Phase 2: Embedding clients for Ollama, Bedrock, and Azure AI Inference (#4207)
    
    * Phase 2: Embedding clients for Ollama, Bedrock, and Azure AI Inference
    
    Add embedding client implementations to existing provider packages:
    
    - OllamaEmbeddingClient: Text embeddings via Ollama's embed API
    - BedrockEmbeddingClient: Text embeddings via Amazon Titan on Bedrock
    - AzureAIInferenceEmbeddingClient: Text and image embeddings via Azure AI
      Inference, supporting Content | str input with separate model IDs for
      text (AZURE_AI_INFERENCE_EMBEDDING_MODEL_ID) and image
      (AZURE_AI_INFERENCE_IMAGE_EMBEDDING_MODEL_ID) endpoints
    
    Additional changes:
    - Rename EmbeddingCoT -> EmbeddingT, EmbeddingOptionsCoT -> EmbeddingOptionsT
    - Add otel_provider_name passthrough to all embedding clients
    - Register integration pytest marker in all packages
    - Add lazy-loading namespace exports for Ollama and Bedrock embeddings
    - Add image embedding sample using Cohere-embed-v3-english
    - Add azure-ai-inference dependency to azure-ai package
    
    Part of #1188
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fix mypy duplicate name and ruff lint issues
    
    - Rename second 'vector' variable to 'img_vector' in image embedding loop
    - Combine nested with statements in tests
    - Remove unused result assignments in tests
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * updates from feedback
    
    * Fix CI failures in embedding usage handling
    
    - Fix Azure AI embedding mypy issues by normalizing vectors to list[float],
      safely accumulating optional usage token fields, and filtering None entries
      before constructing GeneratedEmbeddings
    - Avoid Bandit false positive by initializing usage details as an empty dict
    - Update OpenAI embedding tests to assert canonical usage keys
      (input_token_count/total_token_count)
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * [Purview] Mark responses as responses and fix epoch bug for python long overflow (#4225)
    
    * .NET: Support InvokeMcpTool for declarative workflows (#4204)
    
    * Initial implementation of InvokeMcpTool in declarative workflow
    
    * Cleaned up sample implementation
    
    * Updated sample comments.
    
    * Added missing executor routing attribute
    
    * Fix PR comments.
    
    * Updated based on PR comments.
    
    * Updated based on PR comments.
    
    * Removed unnecessary using statement.
    
    * Update Python package versions to rc2 (#4258)
    
    - Bump core and azure-ai to 1.0.0rc2
    - Bump preview packages to 1.0.0b260225
    - Update dependencies to >=1.0.0rc2
    - Add CHANGELOG entries for changes since rc1
    - Update uv.lock
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * .NET: Fixing issue where OpenTelemetry span is never exported in .NET in-process workflow execution (#4196)
    
    * 1. Add reproduction test for issue #4155: workflow.run Activity never stopped in streaming OffThread path
    
    The WorkflowRunActivity_IsStopped_Streaming_OffThread test demonstrates that
    the workflow.run OpenTelemetry Activity created in StreamingRunEventStream.RunLoopAsync
    is started but never stopped when using the OffThread/Default streaming execution.
    The background run loop keeps running after event consumption completes, so the
    using Activity? declaration never disposes until explicit StopAsync() is called.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    2. Fix workflow.run Activity never stopped in streaming OffThread execution (#4155)
    
    The workflow.run OpenTelemetry Activity in StreamingRunEventStream.RunLoopAsync
    was scoped to the method lifetime via 'using'. Since the run loop only exits on
    cancellation, the Activity was never stopped/exported until explicit disposal.
    
    Fix: Remove 'using' and explicitly dispose the Activity when the workflow reaches
    Idle status (all supersteps complete). A safety-net disposal in the finally block
    handles cancellation and error paths.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Add root-level workflow.session activity spanning run loop lifetime\n\nImplements two-level telemetry hierarchy per PR feedback from lokitoth:\n- workflow.session: spans the entire run loop / stream lifetime\n- workflow_invoke: per input-to-halt cycle, nested within the session\n\nThis ensures the session activity stays open across multiple turns,\nwhile individual run activities are created and disposed per cycle.\n\nAlso fixes linkedSource CancellationTokenSource disposal leak in\nStreamingRunEventStream (added using declaration)."
    
    * Address Copilot review: fix Activity/CTS disposal, rename activity, add error tag\n\n1. LockstepRunEventStream: Remove 'using' from Activity in async iterator\n   and manually dispose in finally block (fixes #4155 pattern). Also dispose\n   linkedSource CTS in finally to prevent leak.\n2. Tags.cs: Add ErrorMessage (\"error.message\") tag for runtime errors,\n   distinct from BuildErrorMessage (\"build.error.message\").\n3. ActivityNames: Rename WorkflowRun from \"workflow_invoke\" to \"workflow.run\"\n   for cross-language consistency.\n4. WorkflowTelemetryContext: Fix XML doc to say \"outer/parent span\" instead\n   of \"root-level span\".\n5. ObservabilityTests: Assert WorkflowSession absence when DisableWorkflowRun\n   is true.\n6. WorkflowRunActivityStopTests: Fix streaming test race by disposing\n   StreamingRun before asserting activities are stopped.\n7. StreamingRunEventStream/LockstepRunEventStream: Use Tags.ErrorMessage\n   instead of Tags.BuildErrorMessage for runtime error events."
    
    * Review fixes: revert workflow_invoke rename, use 'using' for linkedSource, move SessionStarted earlier\n\n- Revert ActivityNames.WorkflowRun back to \"workflow_invoke\" (OTEL semantic convention contract)\n- Use 'using' declaration for linkedSource CTS in LockstepRunEventStream (no timing sensitivity)\n- Move SessionStarted event before WaitForInputAsync in StreamingRunEventStream to match Lockstep behavior"
    
    * Improve naming and comments in WorkflowRunActivityStopTests"
    
    * Prevent session Activity.Current leak in lockstep mode, add nesting test
    
    Save and restore Activity.Current in LockstepRunEventStream.Start() so the
    session activity doesn't leak into caller code via AsyncLocal. Re-establish
    Activity.Current = sessionActivity before creating the run activity in
    TakeEventStreamAsync to preserve parent-child nesting.
    
    Add test verifying app activities after RunAsync are not parented under the
    session, and that the workflow_invoke activity nests under the session."
    
    * Fix stale XML doc: WorkflowRun -> WorkflowInvoke in ObservabilityTests
    
    ---------
    
    Co-authored-by: alliscode <bentho@microsoft.com>
    Co-authored-by: Copilot <223556219+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>
    
    * Python: Fix Bedrock embedding test stub missing meta attribute (#4287)
    
    * Fix Bedrock embedding test stub missing meta attribute
    
    * Increase test coverage so gate passes
    
    * Python: (ag-ui): fix approval payloads being re-processed on subsequent conversation turns (#4232)
    
    * Fix ag-ui tool call issue
    
    * Safe json fix
    
    * Python: Update workflow orchestration samples to use AzureOpenAIResponsesClient (#4285)
    
    * Update workflow orchestration samples to use AzureOpenAIResponsesClient
    
    * Fix broken link
    
    * Move scripts to scripts folder
    
    ---------
    
    Co-authored-by: Roger Barreto <19890735+rogerbarreto@users.noreply.github.com>
    Co-authored-by: Chris <66376200+crickman@users.noreply.github.com>
    Co-authored-by: Eduard van Valkenburg <eavanvalkenburg@users.noreply.github.com>
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    Co-authored-by: Rishabh Chawla <rishabhchawla1995@gmail.com>
    Co-authored-by: Peter Ibekwe <109177538+peibekwe@users.noreply.github.com>
    Co-authored-by: Dmytro Struk <13853051+dmytrostruk@users.noreply.github.com>
    Co-authored-by: Ben Thomas <ben.thomas@microsoft.com>
    Co-authored-by: alliscode <bentho@microsoft.com>
    Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
    Co-authored-by: Evan Mattson <35585003+moonbox3@users.noreply.github.com>
    
    * Fix encoding (#4309)
    
    * Disable Parallelization for WorkflowRunActivityStopTests (#4313)
    
    * Revert parallel disable (#4324)
    
    * .NET: Disable flakey Workflow Observability tests (#4416)
    
    * Disable flakey OffThread test
    
    * Disable additional OffThread test
    
    * Disable a further test
    
    * Disable all observability tests
    
    ---------
    
    Co-authored-by: Roger Barreto <19890735+rogerbarreto@users.noreply.github.com>
    Co-authored-by: Chris <66376200+crickman@users.noreply.github.com>
    Co-authored-by: Eduard van Valkenburg <eavanvalkenburg@users.noreply.github.com>
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    Co-authored-by: Rishabh Chawla <rishabhchawla1995@gmail.com>
    Co-authored-by: Peter Ibekwe <109177538+peibekwe@users.noreply.github.com>
    Co-authored-by: Dmytro Struk <13853051+dmytrostruk@users.noreply.github.com>
    Co-authored-by: Ben Thomas <ben.thomas@microsoft.com>
    Co-authored-by: alliscode <bentho@microsoft.com>
    Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
    Co-authored-by: Evan Mattson <35585003+moonbox3@users.noreply.github.com>
  • .NET: Add foundry extension samples for python and dotnet (#4359)
    * Add foundry extension samples for python and dotnet
    
    * Align foundry extension samples with existing hosted agent patterns
    
    - Fix Python multiagent indentation bug (from_agent_framework ran in both modes)
    - Remove hardcoded personal endpoint from appsettings.Development.json
    - Rename .NET folders/projects to PascalCase (FoundryMultiAgent, FoundrySingleAgent)
    - Upgrade .NET multiagent from net9.0 to net10.0
    - Add ManagePackageVersionsCentrally=false and analyzer blocks to .csproj files
    - Replace wildcard package versions with fixed versions
    - Use alpine Docker images and standard build pattern
    - Align agent.yaml structure (template nesting, displayName, resources, authors)
    - Convert .NET multiagent from namespace/class to top-level statements
    - Add run-requests.http for multiagent sample
    - Fix Python requirements.txt (remove dev deps, add agent-framework)
    - Add proper copyright headers
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Align foundry samples: fix builds, upgrade AgentServer to beta.8
    
    - Fix TargetFrameworks (plural) to override inherited net472 from Directory.Build.props
    - Upgrade Azure.AI.AgentServer.AgentFramework to 1.0.0-beta.8 (latest)
    - Bump OpenTelemetry packages to 1.12.0 (required by beta.8)
    - Fix Roslynator/format errors (imports ordering, BOM, sealed record, target-typed new)
    - Verified with docker dotnet format (matching CI pipeline)
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Refactor hosted samples to use AIProjectClient.CreateAIAgentAsync
    
    Replace PersistentAgentsClient and manual AzureOpenAIClient setup with
    AIProjectClient.CreateAIAgentAsync() from Microsoft.Agents.AI.AzureAI.
    
    - FoundryMultiAgent: Remove Azure.AI.Agents.Persistent, use CreateAIAgentAsync
      for Writer and Reviewer agents with cleanup in finally block
    - FoundrySingleAgent: Remove manual GetConnection/AzureOpenAIClient chain,
      use CreateAIAgentAsync with hotel search tool
    - Update csproj: add Microsoft.Agents.AI.AzureAI, remove unused packages
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Update READMEs to reflect AIProjectClient.CreateAIAgentAsync usage
    
    - Reference Microsoft.Agents.AI.AzureAI and Microsoft.Agents.AI.Workflows packages
    - Add Azure AI Developer role requirement for agents/write data action
    - Replace PersistentAgentsClient references
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Add HostedAgents READMEs and Foundry samples to solution
    
    - Create dotnet/samples/05-end-to-end/HostedAgents/README.md with sample index
    - Create python/samples/05-end-to-end/hosted_agents/README.md with sample index
    - Add FoundryMultiAgent and FoundrySingleAgent to agent-framework-dotnet.slnx
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fix Python linting: reorder imports before load_dotenv, remove trailing whitespace
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Update uv.lock to match latest package versions
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fix trailing whitespace in foundry_single_agent agent.yaml
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Exclude dotnet.microsoft.com from link checker
    
    This domain intermittently times out in CI, causing flaky markdown
    link check failures unrelated to PR changes.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Align env vars to AZURE_AI_PROJECT_ENDPOINT and default model to gpt-4o-mini
    
    Addresses PR review feedback:
    - Rename PROJECT_ENDPOINT to AZURE_AI_PROJECT_ENDPOINT across all
      Foundry samples (dotnet + python) to match existing samples
    - Change default model from gpt-4.1-mini to gpt-4o-mini consistently
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Skip flaky test CreatesWorkflowEndToEndActivities_WithCorrectName_DefaultAsync
    
    Tracked in #4398
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Remove Python foundry samples from PR scope
    
    Python hosted agent samples need further alignment with the azure-ai
    package conventions. Removing from this PR to ship .NET samples first.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Narrow linkspector exclusion to dotnet.microsoft.com/download only
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Leo Yao <leoyao@Leos-MacBook-Pro.local>
    Co-authored-by: Roger Barreto <19890735+rogerbarreto@users.noreply.github.com>
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • .NET: Increase credential timeout for Integration Tests (#4472)
    * Increase credential timeout for Integration Tests
    
    * Fix format error.
    
    * Update further tests
    
    * Fix comment
    
    * Rename credentials file and class.
    
    * Fix broken reference.
  • Python: Add propagate_session to as_tool() for session sharing in agent-as-tool scenarios (#4439)
    * Python: Add propagate_session parameter to as_tool() for session sharing
    
    Add opt-in session propagation in agent-as-tool scenarios. When
    propagate_session=True, the parent agent's AgentSession is forwarded
    to the sub-agent's run() call, allowing both agents to share session
    state (history, metadata, session_id).
    
    - Add propagate_session parameter to BaseAgent.as_tool() (default False)
    - Include session in additional_function_arguments so it flows to tools
    - Add 3 tests for propagation on/off and shared state verification
    - Add sample showing session propagation with observability middleware
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Clarify propagate_session docstring per review feedback
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • .NET: bug fix for duplicate output on GitHubCopilotAgent (#3981)
    * bug fix for duplicate output on GitHubCopilotAgent
    
    * Add Test code for bug fix of duplicate output on GitHubCopilotAgenttT
    
    * update Test code for bug fix of duplicate output on GitHubCopilotAgenttT
    
    * update Test for duplicate output of GitHubCopilotAgent
    
    ---------
    
    Co-authored-by: Mark Wallace <127216156+markwallace-microsoft@users.noreply.github.com>
    Co-authored-by: Dmytro Struk <13853051+dmytrostruk@users.noreply.github.com>
  • .NET: Discover skill resources from directory instead of markdown links (#4401)
    * discover resources in skills folder
    
    * address pr review comments
    
    * change type of AllowedResourceExtensions
    
    * address pr review comment
  • Python: [BREAKING] Support code-defined agent skills (#4387)
    * support code skills
    
    * address pr review comments
    
    * address package and syntax checks
    
    * address pr review comments
    
    * address pr review comment
    
    * address failed check
    
    * rename agentskill and agetnskillprovider
    
    * move agent skills related assets to _skills.py
    
    * address pr review comments
    
    * address review comments
  • Python: feat(claude): add plugins, setting_sources, thinking, and effort options to ClaudeAgentOptions (#4425)
    * feat(claude): add plugins, setting_sources, thinking, and effort options
    
    Add four Claude Agent SDK options to ClaudeAgentOptions that are clean
    passthroughs with no abstraction conflicts:
    
    - plugins: load Claude Code plugins programmatically via SdkPluginConfig
    - setting_sources: control which .claude settings files are loaded
    - thinking: modern extended thinking config (adaptive/enabled/disabled)
    - effort: control thinking depth (low/medium/high/max)
    
    * feat(claude): remove max_thinking_tokens, add plugins/setting_sources/thinking/effort
    
    Remove the deprecated max_thinking_tokens field from ClaudeAgentOptions
    in favor of the new thinking field (ThinkingConfig).
    
    Add four Claude Agent SDK options as clean passthroughs:
    - plugins: load Claude Code plugins via SdkPluginConfig
    - setting_sources: control which .claude settings files are loaded
    - thinking: extended thinking config (adaptive/enabled/disabled)
    - effort: thinking depth control (low/medium/high/max)