504 Commits

  • Python: Azure AI Search provider improvements - EmbeddingGenerator, async context manager, KB message handling (#4212)
    * small updates and improvements in the azure AISearch provider
    
    * Fix mypy errors and embedding function test
    
    - Use separate variable for embeddings result to avoid mypy type reassignment error
    - Fix test_vectorized_query_with_embedding_function: use real async function
      instead of AsyncMock which falsely matches SupportsGetEmbeddings protocol
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * fixes from feedback
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • [BREAKING] Python: Add InvokeFunctionTool action for declarative workflows (#3716)
    * add(declarative): Declarative workflow InvokeFunctionTool feature
    
    * Cleanup
    
    * Address PR feedback
    
    * Remove InvokeTool kind, consolidate to InvokeFunctionTool
    
    * Fix sample locations
    
    * pin azure-ai-projects to 2.0.0b3 due to breaking changes
  • Bump esbuild and vite (#4178)
    Bumps [esbuild](https://github.com/evanw/esbuild) to 0.27.3 and updates ancestor dependency [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite). These dependencies need to be updated together.
    
    
    Updates `esbuild` from 0.21.5 to 0.27.3
    - [Release notes](https://github.com/evanw/esbuild/releases)
    - [Changelog](https://github.com/evanw/esbuild/blob/main/CHANGELOG-2024.md)
    - [Commits](https://github.com/evanw/esbuild/compare/v0.21.5...v0.27.3)
    
    Updates `vite` from 5.4.21 to 7.3.1
    - [Release notes](https://github.com/vitejs/vite/releases)
    - [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
    - [Commits](https://github.com/vitejs/vite/commits/v7.3.1/packages/vite)
    
    ---
    updated-dependencies:
    - dependency-name: esbuild
      dependency-version: 0.27.3
      dependency-type: indirect
    - dependency-name: vite
      dependency-version: 7.3.1
      dependency-type: direct:development
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Python: docs(observability): add Comet Opik setup example (#3940)
    * docs(observability): add Comet Opik setup example
    
    * Update README.md
  • Python: feat(python): Add embedding abstractions and OpenAI implementation (Phase 1) (#4153)
    * feat(python): Add embedding abstractions and OpenAI implementation (Phase 1)
    
    This PR contains two parts:
    
    1. **Overall migration plan** for porting vector stores and embeddings from
       Semantic Kernel to Agent Framework (docs/features/vector-stores-and-embeddings/README.md)
       covering all 10 phases from core abstractions through connectors and TextSearch.
    
    2. **Phase 1 implementation** — core embedding abstractions and OpenAI/Azure OpenAI
       embedding clients:
    
       Core types (_types.py):
       - EmbeddingGenerationOptions TypedDict (total=False)
       - Embedding[EmbeddingT] generic class with model_id, dimensions, created_at
       - GeneratedEmbeddings[EmbeddingT, EmbeddingOptionsT] list container with options, usage
       - EmbeddingInputT (default str) and EmbeddingT (default list[float]) TypeVars
    
       Protocol + base class (_clients.py):
       - SupportsGetEmbeddings protocol — Generic[EmbeddingInputT, EmbeddingT, OptionsContraT]
       - BaseEmbeddingClient ABC — Generic[EmbeddingInputT, EmbeddingT, OptionsCoT]
    
       Telemetry (observability.py):
       - EmbeddingTelemetryLayer with gen_ai.operation.name = "embeddings"
    
       OpenAI implementation (openai/_embedding_client.py):
       - RawOpenAIEmbeddingClient, OpenAIEmbeddingClient, OpenAIEmbeddingOptions
       - Uses _ensure_client() factory pattern
    
       Azure OpenAI implementation (azure/_embedding_client.py):
       - AzureOpenAIEmbeddingClient following AzureOpenAIChatClient pattern
       - Supports API key, Entra ID credentials, env var configuration
    
       Tests:
       - 47 unit tests for types, protocol, base class, OpenAI, and Azure clients
       - 6 integration tests (gated behind RUN_INTEGRATION_TESTS + credentials)
    
       Samples:
       - samples/02-agents/embeddings/openai_embeddings.py
       - samples/02-agents/embeddings/azure_openai_embeddings.py
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * fix: Add AzureOpenAIEmbeddingClient to azure __init__.pyi stub
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * ci: Add embedding env vars to Python integration tests
    
    Map OPENAI_EMBEDDING_MODEL_ID and AZURE_OPENAI_EMBEDDING_DEPLOYMENT_NAME
    from GitHub vars to the integration test environment.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * fix: Handle base64 encoding_format in OpenAI embedding client
    
    When encoding_format='base64' is used, the OpenAI API returns base64-encoded
    floats instead of a JSON array. Decode these automatically to list[float]
    so the return type stays consistent regardless of encoding format.
    
    Also adds a unit test for base64 decoding and fixes minor docstring/import issues.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * fix: Only record INPUT_TOKENS for embedding telemetry
    
    Embeddings have no output/completion tokens. Remove OUTPUT_TOKENS recording
    which was double-counting prompt_tokens via the total_tokens fallback.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * fix: Resolve mypy variance error and lint warning
    
    Use contravariant/covariant TypeVars for SupportsGetEmbeddings Protocol.
    Combine nested if into single statement in telemetry layer.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * fix: Make EmbeddingCoT invariant for mypy compatibility
    
    GeneratedEmbeddings is invariant in its type param, so the Protocol
    TypeVar cannot be covariant.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * fix: Address PR review - empty values guard, service_url for telemetry
    
    - Add early return for empty values in get_embeddings to avoid unnecessary API calls
    - Add service_url() method to RawOpenAIEmbeddingClient for proper telemetry endpoint reporting
    - Add test for empty values behavior
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Python: Fix OpenAI chat client compatibility with third-party endpoints and OTel 0.4.14 (#4161)
    
    * Fix system message content sent as list instead of string
    
    Some OpenAI-compatible endpoints (e.g. NVIDIA NIM) reject system messages
    when content is a list of content parts. This change flattens system and
    developer message content to a plain string in the Chat Completions client.
    
    Fixes https://github.com/microsoft/agent-framework/issues/1407
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fix compatibility with opentelemetry-semantic-conventions-ai 0.4.14
    
    Version 0.4.14 removed several LLM_* attributes from SpanAttributes
    (LLM_SYSTEM, LLM_REQUEST_MODEL, LLM_RESPONSE_MODEL, LLM_REQUEST_MAX_TOKENS,
    LLM_REQUEST_TEMPERATURE, LLM_REQUEST_TOP_P, LLM_TOKEN_TYPE).
    
    Move these to the OtelAttr enum with their well-known gen_ai.* string values
    and update all references in observability.py and tests.
    
    Fixes https://github.com/microsoft/agent-framework/issues/4160
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Flatten text-only message content to string for all roles
    
    Extend the system/developer fix to all message roles. Text-only content
    lists are now post-processed into plain strings, while multimodal content
    (text + images/audio) remains as a list. This fixes compatibility with
    OpenAI-like endpoints that cannot deserialize list content (e.g. Foundry
    Local's Neutron backend).
    
    Partially fixes https://github.com/microsoft/agent-framework/issues/4084
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fix streaming text lost when usage data in same chunk
    
    Some providers (e.g. Gemini) include both usage data and text content
    in the same streaming chunk. The early return on chunk.usage caused
    text and tool call parsing to be skipped entirely. Remove the early
    return and process usage alongside text/tool calls.
    
    Fixes https://github.com/microsoft/agent-framework/issues/3434
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fix mypy errors in _chat_client.py
    
    Rename shadowed variable 'args' in system/developer branch to 'sys_args'
    and rename loop variable 'content' to 'msg_content' to avoid type conflict.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * reorder imports
    
    * fix: Use OtelAttr.REQUEST_MODEL instead of removed SpanAttributes.LLM_REQUEST_MODEL
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * docs: Add score_threshold to vector store plan
    
    Reference SK .NET PR #13501 for score threshold filtering semantics.
    Include score_threshold in SearchOptions from Phase 3.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * docs: Add reference to roji's SK .NET MEVD work for SQL connectors
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * fix: Clear env vars in construction tests to avoid CI leakage
    
    Tests for missing API key / model ID now use monkeypatch.delenv to ensure
    env vars from the integration test environment don't prevent the expected
    ValueError from being raised.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • Python: Add Foundry Memory Context Provider (#3943)
    * Initial plan
    
    * Add FoundryMemoryProvider and tests
    
    Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>
    
    * Add sample and documentation for FoundryMemoryProvider
    
    Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>
    
    * Address code review feedback for FoundryMemoryProvider
    
    Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>
    
    * Address PR review comments: Add DEFAULT_SOURCE_ID, use logging.getLogger, move state to session.state
    
    Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>
    
    * Fix Foundry memory ItemParam usage and exports
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Refactor provider hook state and standardize source IDs
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Support endpoint-based Foundry memory init
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * updated implementation and sample
    
    * updated code and samples
    
    * Fix foundry memory provider tests: mock structure and field names
    
    - Use Mock objects with memory_item.content for memory mocks
    - Assert 'content' instead of 'text' on SDK message items
    - Update exception types from ServiceInitializationError to ValueError
    - Remove unused ServiceInitializationError import
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fix mypy errors in foundry memory provider
    
    Add type: ignore[arg-type] for scope (str | None vs str) and items
    (list variance) passed to Azure SDK methods.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * fix import
    
    ---------
    
    Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
    Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>
    Co-authored-by: eavanvalkenburg <github@vanvalkenburg.eu>
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • Python: Add CreateConversationExecutor, fix input routing, remove unused handler layer (#4159)
    * Fixed declarative deep research sample
    
    * Small fix
    
    * Resolved comment
    
    * Add CreateConversationExecutor, fix input routing, remove unused handler layer
    
    * Address Copilot feedback
    
    * Fix System.ConversationId
    
    ---------
    
    Co-authored-by: Dmytro Struk <13853051+dmytrostruk@users.noreply.github.com>
  • Python: Enhance Azure AI Search Citations with Document URLs in Foundry V2 (#4028)
    * Python: Enhance Azure AI Search citations with document URLs in Foundry V2 (Responses API)
    
    Override _parse_response_from_openai and _parse_chunk_from_openai in
    RawAzureAIClient to extract get_urls from azure_ai_search_call_output
    items and enrich url_citation annotations with document-specific URLs.
    
    - Non-streaming: first pass collects get_urls, post-processes annotations
    - Streaming: captures search output state, enriches url_citation events
      (also handles url_citation annotation type not handled by base class)
    - Updated V2 sample to demonstrate citation URL extraction
    - Added 14 unit tests covering extraction, enrichment, and edge cases
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * refactor: rework search citation enrichment to override _inner_get_response
    
    - Remove all direct openai/pydantic imports from _client.py
    - Override _inner_get_response instead of _parse_response_from_openai/_parse_chunk_from_openai
    - Use closure-local state for streaming instead of instance-level _streaming_search_get_urls
    - Add _build_url_citation_content helper for streaming url_citation handling
    - Fix mypy errors by using str(value or '') for Annotation TypedDict fields
    - Fix docstring to say 'citation' instead of 'url_citation'
    - Update tests to match new approach
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * fix: handle streaming search citations from output_item.done events
    
    The azure_ai_search_call_output item only has populated output data
    (including get_urls) in the response.output_item.done event, not in
    the response.output_item.added event. Also removed the search_get_urls
    guard on url_citation handling so annotations are always produced even
    if get_urls haven't been captured yet.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * addressed comments
    
    * refactor: address PR review - eliminate type: ignore[assignment] pattern
    
    Call super()._inner_get_response() independently in each branch instead
    of once at the top with union type reassignment. Non-streaming uses
    two-arg super() in the closure; streaming uses cast() for type narrowing.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * refactor: remove defensive patterns per PR review
    
    - Replace all getattr() with direct attribute access
    - Remove cast() for streaming branch, use type: ignore[assignment]
    - Simplify _build_url_citation_content to use dict access directly
    - Simplify _extract_azure_search_urls to use item.type/item.output
    - Handle empty list output from streaming 'added' events
    - Update tests to match actual runtime types (objects, not dicts)
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * mypy fix
    
    * small fixes
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • Python: Automate sample validation (#4193)
    * Automate sample validation: part 1
    
    * Automate sample validation: part 2
    
    * Create GH workflow
    
    * comments
    
    * Fix mypy
  • Python: Add max_function_calls to FunctionInvocationConfiguration (#2329) (#4175)
    * Add max_function_calls to FunctionInvocationConfiguration (#2329)
    
    Add a new per-request max_function_calls setting to FunctionInvocationConfiguration
    that limits the total number of individual function invocations across all iterations
    within a single get_response call. This complements max_iterations (which limits LLM
    roundtrips) by providing a hard cap on actual tool executions regardless of parallelism.
    
    - Add max_function_calls field to FunctionInvocationConfiguration (default: None/unlimited)
    - Track cumulative function call count in both streaming and non-streaming tool loops
    - Force tool_choice='none' when the limit is reached
    - Add validation in normalize_function_invocation_configuration
    - Improve docstrings for FunctionInvocationConfiguration, FunctionTool, and @tool
      to clarify semantics of max_iterations vs max_function_calls vs max_invocations
    - Add tests for parallel calls, single calls, unlimited mode, and config validation
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Add sample for controlling total tool executions
    
    Showcases all three mechanisms for limiting tool executions:
    1. max_iterations — caps LLM roundtrips
    2. max_function_calls — caps total individual function invocations per request
    3. max_invocations — lifetime cap on a specific tool instance
    Plus a combined scenario demonstrating defense in depth.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Suppress ruff E305/fmt in hosting sample to preserve XML doc tags
    
    The XML snippet tags (# <create_agent> / # </create_agent>) are used for
    docs extraction and must stay adjacent to the code they wrap. Both ruff
    check (E305) and ruff format add blank lines after the function definition,
    pushing the closing tag away. Suppress with ruff: noqa: E305 and fmt: off.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Add per-agent tool wrapping scenario to control_total_tool_executions sample
    
    Show that wrapping the same callable with @tool multiple times creates
    independent FunctionTool instances with separate invocation counters,
    enabling per-agent max_invocations budgets for shared functions.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Clarify max_function_calls is a best-effort limit
    
    The limit is checked after each batch of parallel calls completes, so the
    current batch always runs to completion even if it overshoots the limit.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Address PR review: fix docstring reference, clarify best-effort in sample
    
    - Fix malformed Sphinx :attr: role in FunctionTool docstring — use plain
      backtick reference instead
    - Update sample to say 'best-effort cap' instead of 'hard cap' for
      max_function_calls, noting it's checked between iterations
    - Parametrize pattern is correct (fixture override, matching existing tests)
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * clarify max_invocations limits
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • Python: (ag-ui): Add Workflow Support, Harden Streaming Semantics, and add Dynamic Handoff Demo (#3911)
    * fix Workflow.as_agent() streaming regression in ag-ui
    
    * Address PR feedback
    
    * workflows wip
    
    * wip
    
    * wip
    
    * Workflow AG-UI demo
    
    * Fixes for handoff workflow demo
    
    * Fixes to workflows support in AG-UI
    
    * Fixes
    
    * Add headers to some demo files
    
    * Fix comment
    
    * Fixes for store
    
    * Make _input_schema lazy-loaded
    
    * fix mypy
    
    * revert session change to handoff only for now
    
    ---------
    
    Co-authored-by: Eduard van Valkenburg <eavanvalkenburg@users.noreply.github.com>
  • Python: fix reasoning model workflow handoff and history serialization (#4083)
    * fix: strip function_call and text_reasoning from cross-agent workflow handoff
    
    When a reasoning model (e.g. gpt-5-mini) runs as Agent 1 in a workflow, its
    response includes text_reasoning items (with server-scoped IDs like rs_XXXX)
    and function_call items. Forwarding these to Agent 2 in a fresh conversation
    caused API errors because the reasoning/call IDs are scoped to the original
    stored response context.
    
    Changes:
    - Strip 'function_call', 'text_reasoning', 'function_approval_request', and
      'function_approval_response' from handoff messages in _agent_executor.py
    - Keep 'function_result' so the actual tool output content is preserved for
      the next agent's context
    - Update unit tests to reflect that function_result messages survive handoff
      (messages grow from 2→3: user, tool(result), assistant(summary))
    - Fix incorrect test assertions in test_function_invocation_stop_clears_*
      that assumed the client layer updates session.service_session_id
    - Also fixed _extract_function_calls to search all messages with call_id
      deduplication, and the error-limit stop path to submit function_call_output
      items before halting (via tool_choice=none cleanup call)
    
    Relates to: https://github.com/microsoft/agent-framework/issues/4047
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * fix: reasoning model workflow handoff and history serialization
    
    Fixes multiple related issues when using reasoning models (gpt-5-mini,
    gpt-5.2) in multi-agent workflows that chain agents via from_response
    or replay full conversation history via AgentExecutorRequest.
    
    ## Reasoning items always emitted on output_item.added
    
    When a reasoning model produces encrypted or hidden reasoning (no
    visible text), the Responses API still fires a reasoning output item
    without any reasoning_text.delta events. Previously no text_reasoning
    Content was emitted in that case, making it invisible to downstream
    logic. Both the non-streaming (_parse_response_from_openai) and
    streaming (output_item.added) paths now always emit at least one
    text_reasoning Content — with empty text if no content is available —
    so co-occurrence detection and serialization guards work reliably.
    
    ## Reasoning items only serialized when paired with a function_call
    
    The Responses API only accepts reasoning items in input when they
    directly preceded a function_call in the original response. Sending a
    reasoning item that preceded a text response (no tool call) causes:
      "reasoning was provided without its required following item"
    _prepare_message_for_openai now checks has_function_call per message
    and skips text_reasoning serialization when there is no accompanying
    function_call.
    
    ## summary field is an array, not an object
    
    The reasoning item summary field sent to the Responses API must be an
    array of objects ([{"type": "summary_text", "text": ...}]), not a
    single object. Fixed _prepare_content_for_openai accordingly.
    
    ## service_session_id cleared when explicit history is provided
    
    When a workflow coordinator replays a full conversation (including
    function calls from a previous agent run) back to an executor via
    AgentExecutorRequest or from_response, the executor's session still
    held a service_session_id (previous_response_id) from the prior run.
    The API then received the same function-call items twice — once from
    previous_response_id (server-stored) and once from the explicit input —
    causing: "Duplicate item found with id fc_...".
    
    AgentExecutor.run (when should_respond=True) and from_response now
    reset self._session.service_session_id = None before running so that
    explicit input is the sole source of conversation context.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * small improvements in text reasoning
    
    * refactor: add reset_service_session to AgentExecutorRequest for explicit history replay
    
    Replace the implicit 'always clear service_session_id when should_respond=True'
    with an explicit opt-in field on AgentExecutorRequest.
    
    The old approach used should_respond=True as a proxy for 'full history replay',
    but that conflates two distinct intents:
    - Orchestrations group chat sends should_respond=True with an empty/single-message
      list (not a full replay) — unnecessarily clearing service_session_id.
    - HITL / feedback coordinators send the full prior conversation and truly need
      a fresh service session ID to avoid duplicate-item API errors.
    
    Changes:
    - Add AgentExecutorRequest.reset_service_session: bool = False
    - AgentExecutor.run only clears service_session_id when this flag is True
    - AgentExecutor.from_response unchanged (always clears; always full conversation)
    - Set reset_service_session=True in all full-history-replay call sites:
      agents_with_HITL.py, azure_chat_agents_tool_calls_with_feedback.py,
      autogen-migration round-robin coordinator, tau2 runner
    - Update _FullHistoryReplayCoordinator test helper to pass the flag
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * comment update
    
    * fixes from feedback
    
    * fix test
    
    * reverted changes to agent executor
    
    * fix: remove reset_service_session from tau2 runner
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * two other reverts
    
    * fix sample
    
    ---------
    
    Co-authored-by: Giles Odigwe <79032838+giles17@users.noreply.github.com>
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • Simplify memory sample to use session state (#4085)
    - Rename UserNameProvider → UserMemoryProvider
    - Use session state (state dict) instead of instance variables
    - Use context.extend_instructions() instead of context.instructions.append()
    - Use DEFAULT_SOURCE_ID class attribute
    - Fix imports to use public agent_framework API
    - Add session state inspection at end of sample
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • Python: Add load_dotenv() to samples for .env file support (#4043)
    * Initial plan
    
    * Add load_dotenv() to 303 Python samples for environment variable loading
    
    Co-authored-by: TaoChenOSU <12570346+TaoChenOSU@users.noreply.github.com>
    
    * Update SAMPLE_GUIDELINES.md to document load_dotenv() requirement
    
    Co-authored-by: TaoChenOSU <12570346+TaoChenOSU@users.noreply.github.com>
    
    * Update samples README.md to document .env file usage
    
    Co-authored-by: TaoChenOSU <12570346+TaoChenOSU@users.noreply.github.com>
    
    * Run ruff format on all changed sample files
    
    Co-authored-by: TaoChenOSU <12570346+TaoChenOSU@users.noreply.github.com>
    
    * Clarify load_dotenv() usage in README - local dev vs production
    
    Co-authored-by: TaoChenOSU <12570346+TaoChenOSU@users.noreply.github.com>
    
    * Remove deprecated getting_started folder as requested
    
    Co-authored-by: TaoChenOSU <12570346+TaoChenOSU@users.noreply.github.com>
    
    * Document env_file_path parameter for per-client configuration
    
    Co-authored-by: TaoChenOSU <12570346+TaoChenOSU@users.noreply.github.com>
    
    * Merge main branch to resolve conflicts
    
    Co-authored-by: TaoChenOSU <12570346+TaoChenOSU@users.noreply.github.com>
    
    * Fix run_evaluation.py file that was empty in merge commit
    
    Co-authored-by: TaoChenOSU <12570346+TaoChenOSU@users.noreply.github.com>
    
    * Remove dotnet changes from merge - out of scope for this PR
    
    Co-authored-by: TaoChenOSU <12570346+TaoChenOSU@users.noreply.github.com>
    
    * Remove package and test changes from merge - only sample changes needed
    
    Co-authored-by: TaoChenOSU <12570346+TaoChenOSU@users.noreply.github.com>
    
    * Remove test_func_utils.py - only sample changes needed
    
    Co-authored-by: TaoChenOSU <12570346+TaoChenOSU@users.noreply.github.com>
    
    * Revert sample files not in original changeset - keep only load_dotenv additions
    
    Co-authored-by: TaoChenOSU <12570346+TaoChenOSU@users.noreply.github.com>
    
    * Move load_dotenv() outside snippet tag in 06_host_your_agent.py
    
    Co-authored-by: TaoChenOSU <12570346+TaoChenOSU@users.noreply.github.com>
    
    * Fix comment placement - move load_dotenv before code comments
    
    Co-authored-by: TaoChenOSU <12570346+TaoChenOSU@users.noreply.github.com>
    
    * Fix load_dotenv() placement across all samples - after docstring, before code comments
    
    Co-authored-by: TaoChenOSU <12570346+TaoChenOSU@users.noreply.github.com>
    
    * Merge latest main branch with load_dotenv changes
    
    Co-authored-by: TaoChenOSU <12570346+TaoChenOSU@users.noreply.github.com>
    
    * Remove non-sample changes from merge - keep only load_dotenv additions
    
    Co-authored-by: TaoChenOSU <12570346+TaoChenOSU@users.noreply.github.com>
    
    * Revert non-load_dotenv sample changes from merge
    
    Co-authored-by: TaoChenOSU <12570346+TaoChenOSU@users.noreply.github.com>
    
    * Fix run_evaluation.py - use main's improved version (file already had load_dotenv)
    
    Co-authored-by: TaoChenOSU <12570346+TaoChenOSU@users.noreply.github.com>
    
    * Manual update
    
    * Manual update 2
    
    * Fix Role usage and load_dotenv placement per PR review feedback
    
    Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>
    
    * Fix Role usage - use string literals not enum attributes
    
    Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>
    
    * Fix SAMPLE_GUIDELINES.md example - load_dotenv before docstring per guidance
    
    Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>
    
    * Move load_dotenv() before docstrings in all samples per SAMPLE_GUIDELINES ordering
    
    Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>
    
    * Address PR review: rename files, fix placement, add session usage, remove note
    
    Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>
    
    * Update Redis README to reference renamed file redis_history_provider.py
    
    Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
    Co-authored-by: TaoChenOSU <12570346+TaoChenOSU@users.noreply.github.com>
    Co-authored-by: Tao Chen <taochen@microsoft.com>
    Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>
    Co-authored-by: Eduard van Valkenburg <eavanvalkenburg@users.noreply.github.com>
  • Python: Quick Redis sample fix (#4066)
    * REDIS URL fix
    
    * copilot fix
  • Python: Fix Redis samples for session migration and configurable REDIS_URL (#4060)
    * fix: update Redis samples for session migration and configurable REDIS_URL
    
    - Replace hardcoded redis://localhost:6379 with configurable REDIS_URL env var
    - Fix SessionContext usage: use input_messages kwarg instead of removed extend_messages
    - Remove obsolete scope_to_per_operation_thread_id parameter
    - Remove stale commented-out overwrite_redis_index/drop_redis_index params
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Remove docker commands from comments to avoid security scan flags
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • Python: Fix hosted MCP tool approval flow for all session/streaming combinations (#4054)
    * fix openai hosted mcp samples
    
    * addressed copilot comments
    
    * Update python/samples/02-agents/providers/azure_openai/azure_responses_client_with_hosted_mcp.py
    
    Co-authored-by: Dmytro Struk <13853051+dmytrostruk@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Dmytro Struk <13853051+dmytrostruk@users.noreply.github.com>
  • Python: Fix workflow samples for bugbash: part 1 (#4055)
    * Fix workflow samples for bugbash: part 1
    
    * Fix mypy
    
    * Fix tests
  • Python: Fixed declarative samples (#4051)
    * Updated declarative kind mapping
    
    * Fixed required property handling
    
    * Updated inline yaml sample
    
    * Fixed remaining declarative samples
    
    * Added lazy initialization for PowerFx engine
    
    * Small fix
  • Python: Fix sample bugs in file search and web search samples (#4049)
    - Fix file search samples: return vector_store.id string instead of
      Content object to avoid JSON serialization error
    - Fix web search sample: use correct web_search_options parameter for
      ChatClient instead of ResponsesClient's user_location parameter
    - Fix assistants client: pass tool_resources from options to run_options
      so vector store IDs reach thread creation
    - Add error handling for cleanup in Azure file search sample
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • Python: Fixed SK migration samples (#4046)
    * Fixed sk migration provider samples
    
    * Fixes to SK migration samples
  • Python: Fix Eval samples (#4033)
    * fix red team sample
    
    * Updated self-reflection
    
    * fix for workflow eval sample
    
    * fix test
  • Python: Fixed Redis context provider and samples (#4030)
    * Removed session_id filtering in Mem0 implementation
    
    * Fixed redis samples
    
    * Resolved comments
  • Python: Fixed AutoGen migration and tool samples (#4027)
    * Fixed ollama_chat_client sample
    
    * Fixed ollama_chat_multimodal sample
    
    * Fixed function_tool_with_approval_and_sessions sample
    
    * Updated function_tool_with_session_injection sample
    
    * Small clean-up
    
    * Update 01_round_robin_group_chat.py
    
    * Update 02_selector_group_chat.py
    
    * Update 03_swarm.py
    
    * Update 03_assistant_agent_thread_and_stream.py
    
    * Update 04_agent_as_tool.py
    
    * Resolved comments
  • Python: improve .env handling and observability samples (#4032)
    * Python: improve .env precedence and observability samples
    
    - Switch load_settings to explicit precedence: overrides -> explicit .env -> environment -> defaults\n- Raise when env_file_path is provided but missing\n- Update settings docs and tests for new behavior\n- Refresh observability samples and README guidance for env loading options\n\nCloses #3864\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * fixed some imports
    
    * Fix load_settings CI regressions
    
    Allow explicit env_file_path values that exist but are not regular files (for example /dev/null) by checking path existence before dotenv parsing, and restore a dict accumulator with typed return cast to satisfy mypy.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Avoid implicit dotenv in observability
    
    Only load dotenv in observability helpers when env_file_path is explicitly provided, and remove test os.devnull workarounds that are no longer necessary.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • Python: Fixed Anthropic and GitHub Copilot samples (#4025)
    * Fixed Anthropic advanced example
    
    * Small improvement
    
    * Simplified skills sample
    
    * Fixed custom agent sample
    
    * Added service_session_id parameter
    
    * Added tests
    
    * Resolved comments
  • Python: Fix Azure AI sample errors (#4021)
    * Python: Fix Azure AI sample errors
    
    - azure_ai_with_application_endpoint: Add missing name to Agent constructor
    - azure_ai_with_file_search: Fix resource path (parents[2] -> parents[3])
    - azure_ai_with_openapi: Fix resource path (parents[2] -> parents[3])
    - azure_ai_with_session: Use get_agent/get_session to reuse existing agent
      version and preserve conversation context across agent instances
    
    * Python: Fix resource paths in azure_ai_agent samples
    
    - azure_ai_with_file_search: Fix path to employees.pdf (parent.parent -> parents[3]/shared)
    - azure_ai_with_openapi_tools: Fix path to weather.json/countries.json (parents[2] -> parents[3])
    
    * fix V1 SDK hosted tools (FileSearchTool, etc.) silently dropped during agent creation
    
    * fix: V2 file search sample uses correct SDK (AIProjectClient instead of AgentsClient)
    
    The azure_ai/azure_ai_with_file_search.py sample incorrectly used the V1
    AgentsClient for file/vector store operations. Replaced with V2 pattern:
    AIProjectClient + get_openai_client() for file upload and vector store
    management, matching the official Azure AI Projects SDK samples.
    
    * fix: use context manager for file open in V2 file search sample
  • Python: Fixed middleware and multimodal input samples (#4022)
    * Fix streaming branch in weather override middleware sample
    
    The streaming branch of weather_override_middleware only prefixed the
    original weather data via a transform hook instead of replacing the
    content with the 'perfect weather' override like the non-streaming
    branch does. Replace with a new ResponseStream that yields the override
    content as ChatResponseUpdate chunks.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fixed exception handling middleware sample
    
    * Fixed runtime context delegation middleware example
    
    * Fixed multimodal input examples
    
    * Small update
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • Python: Durable Support for Workflows (#3630)
    * Add workflow support for Azure Functions
    
    * fix compatability with latest framework changes and add integration tests
    
    * refactor code
    
    * remove white space
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * align help text with actual port used
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * replace instance id with a place holder
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * remove unused import
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * remove redundant typing import and fix SIM115
    
    * fix latest breaking changes
    
    * fix mypy issues
    
    * clean up imports
    
    * define source marker strings as constants
    
    * fix json module name
    
    * refactor _extract_message_content_from_dict
    
    * refactor serialization
    
    * add helper method for error response construction and remove _extract_message_content_from_dict since it is not needed
    
    * use strict tpe checking for edges
    
    * change how duplicate agent registrations are handled
    
    * cancel approval_task on HITL timeout
    
    * update docstring
    
    * fix: align azurefunctions package with core API changes after rebase
    
    - State.import_state/export_state are now sync (removed await)
    - Add State.commit() before export_state() in activity execution
    - Rename executor parameter shared_state -> state
    - Rename ctx.set_shared_state/get_shared_state -> set_state/get_state (sync)
    - WorkflowBuilder now takes start_executor as constructor kwarg
    - Update WorkflowOutputEvent -> WorkflowEvent with type='output'
    - Update RequestInfoEvent -> WorkflowEvent[Any]
    - Update SharedState -> State in test imports
    - Update duplicate agent name tests to match new warning behavior
    - Update sample README API references
    
    * fix sample check errors
    
    * fix mypy issues
    
    * fix trailing white spaces
    
    * fix test imports
    
    * feat: add durable workflow samples and adapt to main branch changes
    
    - Add workflow samples 09-12 to 04-hosting/azure_functions/
    - Adapt to ChatMessage -> Message rename from main
    - Adapt to pickle-based checkpoint encoding from main
    - Simplify _serialization.py to delegate to core encode/decode
    - Fix Message -> WorkflowMessage disambiguation in _context.py
    - Remove non-existent _checkpoint_summary import
    
    * fix: update create_checkpoint signature to match superclass
    
    * fix: correct relative link in HITL sample README
    
    * fix: resolve import breakage after rebase (State, DurableAgentThread, get_logger)
    
    ---------
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    Co-authored-by: Dmytro Struk <13853051+dmytrostruk@users.noreply.github.com>
  • Python: Add missing system instruction attr to invoke_agent span (#4012)
    * Add missing sysmte instruction attr to invoke_agent span
    
    * Temp remove azure search gate
    
    * fix pipeline error
  • Python: MCP sample bugbash fixes (#4001)
    * MCP sample bugbash fixes
    
    * import fix
  • Python: [BREAKING] Scope provider state by source_id and standardize source IDs (#3995)
    * Initial plan
    
    * Add FoundryMemoryProvider and tests
    
    Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>
    
    * Add sample and documentation for FoundryMemoryProvider
    
    Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>
    
    * Address code review feedback for FoundryMemoryProvider
    
    Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>
    
    * Address PR review comments: Add DEFAULT_SOURCE_ID, use logging.getLogger, move state to session.state
    
    Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>
    
    * Fix Foundry memory ItemParam usage and exports
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Refactor provider hook state and standardize source IDs
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Support endpoint-based Foundry memory init
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fix core README workflows link
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * updated implementation and sample
    
    * Split out Foundry memory provider changes
    
    Remove FoundryMemoryProvider implementation/tests/sample plus export and docs mentions from this branch so only non-Foundry changes remain.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Trigger CI rerun for PR #3995
    
    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: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • Python: feature: Inject OpenTelemetry trace context into MCP requests and update… (#3780)
    * feat: Inject OpenTelemetry trace context into MCP requests and update documentation
    
    * Update python/samples/getting_started/observability/README.md
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * Update python/packages/core/tests/core/test_mcp.py
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * refactor: move opentelemetry import to module level
    
    OpenTelemetry is a hard dependency of agent-framework-core (per
    pyproject.toml), so the try/except ImportError guard was dead code.
    Move the import to the top of the file to fail fast on missing
    dependencies instead of silently hiding installation issues.
    
    ---------
    
    Co-authored-by: Pete Roden <Pete.Roden@microsoft.com>
    Co-authored-by: Mark Wallace <127216156+markwallace-microsoft@users.noreply.github.com>
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
  • Python: Fix tool normalization and provider sample consolidation (#3953)
    * Fix tool normalization and provider samples
    
    - restore callable/single-tool normalization paths and unset tool-choice behavior\n- consolidate and expand chat/provider samples (OpenAI/Azure/Anthropic/Ollama/Bedrock)\n- migrate Bedrock lazy import surface to agent_framework.amazon and move provider samples
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * small fix in sample
    
    * Finalize provider, samples, and core cleanup
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Fix CopilotTool passthrough in agent
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * fix link
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • Python: [BREAKING] Fix #3613 chat/agent message typing alignment (#3920)
    * Fix #3613 message typing across chat and agents
    
    * Address #3613 review feedback and sample input style
    
    * refactor: use shared AgentRunMessages aliases (#3613)
    
    * refactor: rename agent run input aliases for #3613
    
    * samples: inline image content in run calls
    
    * core: export AgentRunInputs from package init
    
    * core: use explicit init re-exports without __all__
    
    * updated logging and inits
    
    * Fix core mypy export and samples XML note
    
    * Remove AgentRunInputsOrNone and dedupe loggers
    
    * Remove prepare_messages helper
    
    * fix integration tests
  • Python: Remove duplicate samples (#3899)
    * Remove duplicate samples
    
    * Correct paths
    
    * Update readme
    
    * Update readme
    
    * Fix ruff
    
    ---------
    
    Co-authored-by: Evan Mattson <35585003+moonbox3@users.noreply.github.com>
  • Python: Fix streamed workflow agent continuation context by finalizing AgentExecutor streams (#3882)
    * Fix streamed workflow agent continuation context by finalizing AgentExecutor streams
    
    * Fix stream handling
    
    * Fixes
    
    * Fix DevUI and tests
  • Python: [BREAKING] PR2 — Wire context provider pipeline, remove old types, update all consumers (#3850)
    * PR2: Wire context provider pipeline and update all internal consumers
    
    - Replace AgentThread with AgentSession across all packages
    - Replace ContextProvider with BaseContextProvider across all packages
    - Replace context_provider param with context_providers (Sequence)
    - Replace thread= with session= in run() signatures
    - Replace get_new_thread() with create_session()
    - Add get_session(service_session_id) to agent interface
    - DurableAgentThread -> DurableAgentSession
    - Remove _notify_thread_of_new_messages from WorkflowAgent
    - Wire before_run/after_run context provider pipeline in RawAgent
    - Auto-inject InMemoryHistoryProvider when no providers configured
    
    * fix: update all tests for context provider pipeline, fix lazy-loaders, remove old test files
    
    * refactor: update all sample files for context provider pipeline (AgentThread→AgentSession, ContextProvider→BaseContextProvider)
    
    * fix: update remaining ag-ui references (client docstring, getting_started sample)
    
    * fix: make get_session service_session_id keyword-only to avoid confusion with session_id
    
    * refactor: rename _RunContext.thread_messages to session_messages
    
    * refactor: remove _threads.py, _memory.py, and old provider files; migrate devui to use plain message lists
    
    * rename: remove _new_ prefix from test files
    
    * refactor: rewrite SlidingWindowChatMessageStore as SlidingWindowHistoryProvider(InMemoryHistoryProvider)
    
    * fix: read full history from session state directly instead of reaching into provider internals
    
    * fix: update stale .pyi stubs, sample imports, and README references for new provider types
    
    * fix: remove stale message_store, _notify_thread_of_new_messages, and session_id.key references in samples
    
    * refactor: merge context_providers and sessions sample folders into sessions, remove aggregate_context_provider
    
    * refactor: UserInfoMemory stores state in session.state instead of instance attributes
    
    * feat: add Pydantic BaseModel support to session state serialization
    
    Pydantic models stored in session.state are now automatically serialized
    via model_dump() and restored via model_validate() during to_dict()/from_dict()
    round-trips. Models are auto-registered on first serialization; use
    register_state_type() for cold-start deserialization.
    
    Also export register_state_type as a public API.
    
    * fix mem0
    
    * Update sample README links and descriptions for session terminology
    
    - Replace 'thread' with 'session' in sample descriptions across all READMEs
    - Update file links for renamed samples (mem0_sessions, redis_sessions, etc.)
    - Fix Threads section → Sessions section in main samples/README.md
    - Update tools, middleware, workflows, durabletask, azure_functions READMEs
    - Update architecture diagrams in concepts/tools/README.md
    - Update migration guides (autogen, semantic-kernel)
    
    * Fix broken Redis README link to renamed sample
    
    * Fix Mem0 OSS client search: pass scoping params as direct kwargs
    
    AsyncMemory (OSS) expects user_id/agent_id/run_id as direct kwargs,
    while AsyncMemoryClient (Platform) expects them in a filters dict.
    Adds tests for both client types.
    
    Port of fix from #3844 to new Mem0ContextProvider.
    
    * Fix rebase issues: restore missing _conversation_state.py and checkpoint decode logic
    
    - Add back _conversation_state.py (encode/decode_chat_messages) lost in rebase
    - Fix on_checkpoint_restore to decode cache/conversation with decode_chat_messages
    - Fix on_checkpoint_restore to use decode_checkpoint_value for pending requests
    - Add tests/workflow/__init__.py for relative import support
    - Fix test_agent_executor checkpoint selection (checkpoints[1] not superstep)
    
    * Add STORES_BY_DEFAULT ClassVar to skip redundant InMemoryHistoryProvider injection
    
    Chat clients that store history server-side by default (OpenAI Responses API,
    Azure AI Agent) now declare STORES_BY_DEFAULT = True. The agent checks this
    during auto-injection and skips InMemoryHistoryProvider unless the user
    explicitly sets store=False.
    
    * Fix broken markdown links in azure_ai and redis READMEs
    
    * Fix getting-started samples to use session API instead of removed thread/ContextProvider API
    
    * updates to workflow as agent
    
    * fix group chat import
    
    * Rename Thread→Session throughout, fix service_session_id propagation, remove stale AGUIThread
    
    - Fix: Propagate conversation_id from ChatResponse back to session.service_session_id
      in both streaming and non-streaming paths in _agents.py
    - Rename AgentThreadException → AgentSessionException
    - Remove stale AGUIThread from ag_ui lazy-loader
    - Rename use_service_thread → use_service_session in ag-ui package
    - Rename test functions from *_thread_* to *_session_*
    - Rename sample files from *_thread* to *_session*
    - Update docstrings and comments: thread → session
    - Update _mcp.py kwargs filter: add 'session' alongside 'thread'
    - Fix ContinuationToken docstring example: thread=thread → session=session
    - Fix _clients.py docstring: 'Agent threads' → 'Agent sessions'
    
    * Fix broken markdown links after thread→session file renames
    
    * fix azure ai test
  • Python: restructure: Python samples into progressive 01-05 layout (#3862)
    * restructure: Python samples into progressive 01-05 layout
    
    - 01-get-started/: 6 numbered steps (hello agent → hosting)
    - 02-agents/: all agent concept samples (tools, middleware, providers, etc.)
    - 03-workflows/: ALL existing workflow samples preserved as-is
    - 04-hosting/: azure-functions, durabletask, a2a
    - 05-end-to-end/: demos, evaluation, hosted agents
    - Old files moved to _to_delete/ for review
    - Added AGENTS.md with structure documentation
    - autogen-migration/ and semantic-kernel-migration/ preserved at root
    
    * fix: switch to AzureOpenAI Foundry, fix CI failures
    
    - Switch all 01-get-started samples to AzureOpenAIResponsesClient with
      Azure AI Foundry project endpoint (AZURE_AI_PROJECT_ENDPOINT +
      AZURE_OPENAI_RESPONSES_DEPLOYMENT_NAME + AzureCliCredential)
    - Add _to_delete/ and 05-end-to-end/ to pyrightconfig.samples.json excludes
    - Fix test paths in packages/ that referenced old getting_started/ dirs:
      durabletask conftest + streaming test, azurefunctions conftest,
      devui conftest + capture_messages + openai_sdk_integration
    - Fix workflow_as_agent_human_in_the_loop.py import (sibling import)
    - Update hosting READMEs and tool comment paths
    - Replace root README.md with new structure overview
    - Update AGENTS.md to document Azure OpenAI Foundry as default provider
    
    * cleanup: remove _to_delete folder, copy resource files to active dirs
    
    All files in _to_delete/ were either:
    - Exact duplicates of files in the new structure (240 files)
    - Same file with only comment path updates (100 files)
    - One import-fix diff (workflow_as_agent_human_in_the_loop.py)
    - One superseded minimal_sample.py
    
    Resource files (sample.pdf, countries.json, employees.pdf, weather.json)
    copied to 02-agents/sample_assets/ and 02-agents/resources/ since active
    samples reference them.
    
    * fix: address PR review comments, centralize resources, remove root duplicates
    
    - Fix type annotation in 04_memory.py (string union -> proper types)
    - Fix old sample paths in observability files
    - Fix grammar/spelling in observability samples
    - Move sample_assets/ and resources/ to shared/ folder
    - Remove 8 duplicate observability files from 02-agents root
    - Update resource path references in multimodal_input and provider samples
    
    * fix: update broken links from old getting_started paths to new structure
    
    - Update relative paths in READMEs: getting_started/ → 01-get-started/,
      02-agents/, 03-workflows/, 04-hosting/, 05-end-to-end/
    - Fix absolute GitHub URLs in package READMEs
    - Fix broken link in ollama package README
    
    * fix: convert absolute GitHub URLs to relative paths for link checker
    
    Absolute URLs to python/samples/ on main branch 404 until PR merges.
    Converted to relative paths that linkspector can verify locally.
    
    * fix: update link for handoff sample moved to orchestrations/
    
    * fix: update chatkit-integration README path from demos/ to 05-end-to-end/
    
    * fix: update broken links in orchestrations README to match flat directory structure
  • Python: (samples): adopt AzureOpenAIResponsesClient, reorganize orchestration examples, and fix workflow/orchestration bugs (#3873)
    * adopt AzureOpenAIResponsesClient, reorganize orchestration examples, and fix workflow/orchestration bugs
    
    * Updates
    
    * add comment
  • [BREAKING] Python: Checkpoint refactor: encode/decode, checkpoint format, etc (#3744)
    * WIP: Checkpoint refactor: encode/decode, checkpoint format, etc
    
    * WIP: Remove workflow ID in checkpoints
    
    * Refactor checkpointing
    
    * Add get_latest tests
    
    * Increase test coverage
    
    * Fix formatting
    
    * Fix unit tests
    
    * Fix samples
    
    * fix unit tests
    
    * fix pipeline
    
    * Copilot comments
    
    * Fix tests
    
    * Fix more tests
    
    * Address comments part 1
    
    * Address comments part 2
    
    * Comments
  • Python: Allow AzureOpenAIResponsesClient creation with Foundry project endpoint (#3814)
    * Initial plan
    
    * feat: extend AzureOpenAIResponsesClient to support Foundry project endpoints
    
    Add project_client and project_endpoint parameters to allow creating
    the client via an Azure AI Foundry project. When provided, the client
    uses AIProjectClient.get_openai_client() to obtain the OpenAI client.
    The azure-ai-projects package is imported lazily and only required
    when using the project endpoint path.
    
    Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>
    
    * fix: address code review - remove duplicate MagicMock imports in tests
    
    Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>
    
    * fix: add type field to Responses API input items and add Foundry sample
    
    - Add 'type: message' to input items in _prepare_message_for_openai
      to comply with the Responses API schema requirement
    - Filter out empty dicts from unsupported content types to prevent
      sending items with invalid empty type values
    - Add azure_responses_client_with_foundry.py sample demonstrating
      AzureOpenAIResponsesClient with project_endpoint
    - Update README and pyrightconfig.samples.json accordingly
    
    * updates to response format and setup
    
    * fix: patch AIProjectClient at correct module path in test
    
    Patch agent_framework.azure._responses_client.AIProjectClient instead of
    azure.ai.projects.aio.AIProjectClient since the import is at module level.
    
    * docs: add Foundry sample to READMEs and document AZURE_AI_PROJECT_ENDPOINT env var
    
    ---------
    
    Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
    Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>
    Co-authored-by: eavanvalkenburg <github@vanvalkenburg.eu>
  • Python: [BREAKING] Replace Hosted*Tool classes with tool methods (#3634)
    * Replace Hosted*Tool classes with client static factory methods
    
    * fixed failing test
    
    * mypy fix
    
    * mypy fix 2
    
    * declarative mypy fix
    
    * addressed comments
    
    * ToolProtocol removal
    
    * fixed test
    
    * agents mypy fix
    
    * fix failing tests
    
    * mypy fix
    
    * addressed comments
    
    * fixed tests
    
    * addressed comments + added factory method overrides for azureai v2 client
    
    * mypy fix
    
    * added kwargs to azureai tool methods
    
    * fixed in test
    
    * _sessions fix
    
    * test fix
  • Python: [BREAKING] Simplify API: ChatAgent -> Agent, ChatMessage -> Message (#3747)
    * [BREAKING] Rename ChatAgent -> Agent, ChatMessage -> Message, ChatClientProtocol -> SupportsChatGetResponse
    
    Simplify the public API by removing redundant 'Chat' prefix from core types:
    - ChatAgent -> Agent
    - RawChatAgent -> RawAgent
    - ChatMessage -> Message
    - ChatClientProtocol -> SupportsChatGetResponse
    
    Also renamed internal WorkflowMessage (was Message in _runner_context) to avoid collision.
    
    No backward compatibility aliases - this is a clean breaking change.
    
    * [BREAKING] Rename Agent chat_client parameter to client
    
    * Fix rebase issues: WorkflowMessage references and broken markdown links
    
    * Fix formatting and lint issues from code quality checks
    
    * Fix import ordering in workflow sample files
    
    * fixed rebase
    
    * Fix test failures: use WorkflowMessage and A2AMessage after ChatMessage→Message rename
    
    - Replace Message(data=..., source_id=...) with WorkflowMessage(...) in workflow tests
    - Fix isinstance check in A2A agent to use A2AMessage instead of Message
    - Fix import in test_workflow_observability.py (Message→WorkflowMessage)
    
    * Fix lint, fmt, and sample errors after ChatMessage→Message rename
    
    - Auto-fix 70+ ruff lint issues across samples (ChatMessage→Message refs)
    - Fix HostedVectorStoreContent→Content.from_hosted_vector_store in file search sample
    - Fix _normalize_messages→normalize_messages in custom agent sample
    - Fix context.terminate→raise MiddlewareTermination in middleware samples
    - Fix with_update_hook→with_transform_hook in override middleware sample
    - Add TOptions_co import back to custom_chat_client sample
    - Add noqa for FastAPI File() default in chatkit sample
    - Fix B023 loop variable capture in weather agent sample
    
    * fix: update Agent constructor calls from chat_client to client in declaration-only tool tests
    
    * fix: add register_cleanup to devui lazy-loading proxy and type stub
    
    * fixed tests and updated new pieces
    
    * fix agui typevar
    
    * fix merge errors
    
    * fix merge conflicts
    
    * fiux merge
    
    * Remove unused links
    
    ---------
    
    Co-authored-by: Evan Mattson <evan.mattson@microsoft.com>
  • [BREAKING] Python: Remove workflow register factory methods. Update tests and samples (#3781)
    * Remove workflow register factory methods. Update tests and samples
    
    * Address Copilot feedback