* Improve DevUI, add Context Inspector view as new tab under traces
* fix mypy errors
* fix: Handle stale MCP connections in DevUI executor
MCP tools can become stale when HTTP streaming responses end - the underlying
stdio streams close but `is_connected` remains True. This causes subsequent
requests to fail with `ClosedResourceError`.
Add `_ensure_mcp_connections()` to detect and reconnect stale MCP tools before
agent execution. This is a workaround for an upstream Agent Framework issue
where connection state isn't properly tracked.
Fixes MCP tools failing on second HTTP request in DevUI.
fixes #1476#1515#2865
* fix#1572 report import dependency errors more clearly
* Ensure there is streaming toggle where users can select streaming vs non streaming mode in devui . Fixes .NET: [Python] DevUI tool call rendering in non-streaming mode?
* remove unused dead code
* improve ux - workflows with agents show a chat component in execution timelien, also ensure magentic final output shows correctly
* update ui build
* update devui to use instrumentation instead of tracing, other instrumentation and type/instance check fixes
* 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.
* Pushing the bedrock related changes to the new branch after addressing the review comments
* 2524 Addressed the second round review comments
* 2524 Addressed few more minor comments on the PR
* resolving the merge conflict
* 2524 resolved the uv.lock conflicts
* 2524 addressed more comments
* 2524 removed the print statement to fix the checks failure
* 2524 resolved the CI failure issues
* 2524 fixing the CI breaks
* 2524 Addressed the review comment
* 2524 resolved conflict
---------
Co-authored-by: Sunil Dutta <sunil.dutta@penske.com>
Co-authored-by: budgetboardingai <apurva.sharma31@gmail.com>
* Add workflow cancellation sample
Add sample demonstrating how to cancel a running workflow using asyncio
tasks. Shows both cancellation mid-execution and normal completion paths.
Useful for implementing timeouts, graceful shutdown, or A2A executors.
* update docstring
* refactoring and unifying naming schemes of internal methods of chat clients
* set tool_choice to auto
* fix for mypy
* added note on naming and fix#2951
* fix responses
* fixes in azure ai agents client
Eduard van Valkenburg
·
2025-12-18 12:02:23 +00:00
* fix: correct BadRequestError when using Pydantic model in response_format
* Fix lint
---------
Co-authored-by: Evan Mattson <evan.mattson@microsoft.com>
* Correction of MCP image type conversion in _mcp.py
* Added a new overload to the init function of the DataContent() type of the Agent Framework, edited the test case to correctly test the usage of the data and uri fields while using DataContent()
* Fixed tests related to the changes of the DataContent type, added testing for both string and byte representations
## Summary
Enhanced `HandoffBuilder._apply_auto_tools` to use the target agent's
description when creating handoff tools, providing more informative tool
descriptions for LLMs.
## Changes
- Modified `_apply_auto_tools` to extract `description` from
`AgentExecutor._agent` when available
- Updated iteration to use `.items()` for more efficient dict traversal
- Handoff tools now use agent descriptions instead of generic placeholders
## Example
Before: "Handoff to the refund_agent agent."
After: "You handle refund requests. Ask for order details and process refunds."
## Testing
- All handoff tests pass (20/20)
- No breaking changes to existing API
Fixes#2713
Co-authored-by: Evan Mattson <35585003+moonbox3@users.noreply.github.com>