13 Commits

  • Python: Fix AzureAIClient tool call bug for AG-UI use (#3148)
    * Fiz AzureAIClient tool call bug
    
    * Address copilot feedback
  • Python: fix(ag-ui): Execute tools with approval_mode, fix shared state, code cleanup (#3079)
    * fix(ag-ui): execute tools after approval in human-in-the-loop flow
    
    * Fix shared state bug
    
    * Bug fix finalized
    
    * Refactoring to clean up code
    
    * Code cleanup
    
    * More fixes
    
    * More code cleanup
    
    * Add version detection in __init__.py to ruff ignore list
  • Python: Fix MCP tool result serialization for list[TextContent] (#2523)
    * Fix MCP tool result serialization for list[TextContent]
    
    When MCP tools return results containing list[TextContent], they were
    incorrectly serialized to object repr strings like:
    '[<agent_framework._types.TextContent object at 0x...>]'
    
    This fix properly extracts text content from list items by:
    1. Checking if items have a 'text' attribute (TextContent)
    2. Using model_dump() for items that support it
    3. Falling back to str() for other types
    4. Joining single items as plain text, multiple items as JSON array
    
    Fixes #2509
    
    * Address PR review feedback for MCP tool result serialization
    
    - Extract serialize_content_result() to shared _utils.py
    - Fix logic: use texts[0] instead of join for single item
    - Add type annotation: texts: list[str] = []
    - Return empty string for empty list instead of '[]'
    - Move import json to file top level
    - Add comprehensive unit tests for serialization
    
    * Address PR review feedback: fix type checking and double serialization
    
    - Add isinstance(item.text, str) check to ensure text attribute is a string
    - Fix double-serialization issue by keeping model_dump results as dicts
      until final json.dumps (removes escaped JSON strings in arrays)
    - Improve docstring with detailed return value documentation
    - Add test for non-string text attribute handling
    - Add tests for list type tool results in _events.py path
    
    * Simplify PR: minimal changes to fix MCP tool result serialization
    
    Addresses reviewer feedback about excessive refactoring:
    - Reset _events.py to original structure
    - Only add import and use serialize_content_result in one location
    - All review comments addressed in serialize_content_result():
      - Added isinstance(item.text, str) check
      - Use model_dump(mode="json") to avoid double-serialization
      - Improved docstring with explicit return value documentation
      - Empty list returns "" instead of "[]"
    
    * Refactor: Move MCP TextContent serialization to core prepare_function_call_results
    
    Per reviewer feedback, moved the TextContent serialization logic from
    ag-ui's serialize_content_result to the core package's
    prepare_function_call_results function.
    
    Changes:
    - Added handling for objects with 'text' attribute (like MCP TextContent)
      in _prepare_function_call_results_as_dumpable
    - Removed serialize_content_result from ag-ui/_utils.py
    - Updated _events.py and _message_adapters.py to use
      prepare_function_call_results from core package
    - Updated tests to match the core function's behavior
    
    * Fix failing tests for prepare_function_call_results behavior
    
    - test_tool_result_with_none: Update expected value to 'null' (JSON serialization of None)
    - test_tool_result_with_model_dump_objects: Use Pydantic BaseModel instead of plain class
    
    * Fix B903 linter error: Convert MockTextContent to dataclass
    
    The ruff linter was reporting B903 (class could be dataclass or namedtuple)
    for the MockTextContent test helper classes. This commit converts them to
    dataclasses to satisfy the linter check.
  • Python: Fixes Run ID and Thread ID casing to align with AG-UI Typescript SDK (#2948)
    * added camelCase input to run id and thread id aligning with @ag-ui/core
    
    * fixed per copilot suggestions
  • Python: [BREAKING] Observability updates (#2782)
    * fixes Python: Add env_file_path parameter to setup_observability() similar to AzureOpenAIChatClient
    Fixes #2186
    
    * WIP on updates using configure_azure_monitor
    
    * improved setup and clarity
    
    * fixed root .env.example
    
    * revert changes
    
    * updated files
    
    * updated sample
    
    * updated zero code
    
    * test fixes and fixed links
    
    * fix devui
    
    * removed planning docs
    
    * added enable method and updated readme and samples
    
    * clarified docstring
    
    * add return annotation
    
    * updated naming
    
    * update capatilized version
    
    * updated readme and some fixes
    
    * updated decorator name inline with the rest
    
    * feedback from comments addressed
  • Python: Fixed empty text content pydantic validation failure (#2539)
    * Fixed empty text content pydantic validation failure
    
    * simplify syntax. renamed test
    
    ---------
    
    Co-authored-by: Evan Mattson <35585003+moonbox3@users.noreply.github.com>
  • Python: Refactor ag-ui to clean up some patterns (#2363)
    * Refactor ag-ui to clean up some patterns
    
    * Mypy fixes
    
    * Fix imports, typing, tests, logging.
    
    * Fix test import error
    
    * Fix imports again
    
    * Fix thread handling
  • Python: clean up exception (#2319)
    * Potential fix for code scanning alert no. 18: Information exposure through an exception
    
    Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
    
    * Fix test
    
    ---------
    
    Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
  • Python: Fix ag-ui state handling issues (#2289)
    * Fix ag-ui state handling
    
    * Bump package version and update changelog
    
    * Update changelog
  • Python: fix tool call id mismatch in ag-ui (#2166)
    * Fix state for pending requests bug
    
    * Bump ver
    
    * Update changelog
  • Python: Fix ag-ui regressions (#2114)
    * Bump ag-ui package version. Update CHANGELOG
    
    * Fix ag-ui bugs
    
    * Revert port test change
    
    * Cleanup
    
    * Intro factory funcs for samples
    
    * Revert package ver change
  • Python: Add concrete AGUIChatClient (#2072)
    * Add concrete AGUIChatClient
    
    * Update logging docstrings and conventions
    
    * PR feedback
    
    * Updates to support client-side tool calls
  • Python: AG-UI protocol support (#1826)
    * Add AG-UI integration
    
    * Fix tests. PR feedback
    
    * Cleanup
    
    * PR Feedback
    
    * Improve README and getting started experience
    
    * Fix links