-
Notifications
You must be signed in to change notification settings - Fork 10
Chat history API for Agent Framework #132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- CRM-003: Add turn_context validation in send_chat_history_async method
to ensure fail-fast behavior and consistency with docstring
- CRM-004: Document empty message filtering behavior in _convert_chat_messages_to_history
docstring and elevate log level from DEBUG to WARNING when messages are skipped
Note: CRM-001 and CRM-002 (copyright header format) are not applicable because
the existing format ("Microsoft. All rights reserved.") is required by the
pyproject.toml linter configuration (notice-rgx), while CLAUDE.md specifies a
different format. The linter-enforced format takes precedence to ensure CI passes.
Co-Authored-By: Claude Opus 4.5 <[email protected]>
…clude license information
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request introduces comprehensive chat history handling capabilities to the MCP Tool Registration Service for the Agent Framework. The implementation adds three new methods for converting and sending chat history messages to the MCP platform for real-time threat protection analysis.
Changes:
- Added chat history conversion and sending methods to the AgentFramework MCP tool registration service
- Created comprehensive unit tests covering validation, conversion, delegation, and error handling scenarios
- Added necessary test package structure with proper
__init__.pyfiles - Updated copyright header format from "Microsoft. All rights reserved." to "Microsoft Corporation. / Licensed under the MIT License."
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
libraries/microsoft-agents-a365-tooling-extensions-agentframework/microsoft_agents_a365/tooling/extensions/agentframework/services/mcp_tool_registration_service.py |
Adds _convert_chat_messages_to_history, send_chat_history_messages_async, and send_chat_history_async methods with proper validation, conversion logic, and delegation to core service |
tests/tooling/extensions/agentframework/services/test_send_chat_history_async.py |
Comprehensive test suite with 17 tests covering validation, success cases, delegation patterns, and error handling |
tests/tooling/extensions/agentframework/services/__init__.py |
Package initialization file for service tests |
tests/tooling/extensions/agentframework/__init__.py |
Package initialization file for agentframework tests |
tests/tooling/extensions/__init__.py |
Package initialization file for extensions tests |
...soft_agents_a365/tooling/extensions/agentframework/services/mcp_tool_registration_service.py
Show resolved
Hide resolved
…sing role during conversion
* refactor(agentframework): remove _async suffix from method names (CRM-010) Rename methods to follow Python conventions and codebase patterns: - send_chat_history_messages_async -> send_chat_history_messages - send_chat_history_async -> send_chat_history_from_store Rename test file accordingly: - test_send_chat_history_async.py -> test_send_chat_history.py Co-Authored-By: Claude Opus 4.5 <[email protected]> * fix(agentframework): improve role handling and logging (CRM-003, CRM-009, CRM-013) - CRM-003: Add defensive handling for role value access using hasattr check - CRM-009: Convert debug and warning logging to lazy format (% style) - CRM-013: Simplify redundant empty content check (remove `not content or`) Co-Authored-By: Claude Opus 4.5 <[email protected]> * test(agentframework): add missing test coverage (CRM-001, 004, 005, 006, 011, 012) - CRM-001: Add test for ChatMessageStore exception propagation - CRM-004: Add test for whitespace-only content filtering - CRM-005: Add test for None role handling - CRM-006: Add test for all messages filtered out scenario - CRM-011: Add test for default ToolOptions creation - CRM-012: Make UUID assertion more robust using uuid.UUID() Also adds test for defensive role handling (string role without .value) Co-Authored-By: Claude Opus 4.5 <[email protected]> * fix(tooling): return success for empty chat history list (CRM-008) The core send_chat_history method now returns OperationResult.success() for empty lists instead of raising ValueError. This is consistent with the extension behavior and makes the API more forgiving. Updated test to verify new behavior. Co-Authored-By: Claude Opus 4.5 <[email protected]> * docs(agentframework): add Chat History API documentation (CRM-002) Update design.md to include: - send_chat_history_messages and send_chat_history_from_store methods - Parameter tables for both methods - Integration flow diagram showing message conversion - Message filtering behavior documentation - Example usage code Co-Authored-By: Claude Opus 4.5 <[email protected]> * docs: add async method naming convention to CLAUDE.md (CRM-010) Document that _async suffix should NOT be used on async methods in this SDK since we only provide async versions. This prevents future naming inconsistencies. Co-Authored-By: Claude Opus 4.5 <[email protected]> --------- Co-authored-by: Johan Broberg <[email protected]> Co-authored-by: Claude Opus 4.5 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.
tests/tooling/extensions/agentframework/services/test_send_chat_history.py
Outdated
Show resolved
Hide resolved
be5fbe4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.
… package resolution and clean up imports
…microsoft/Agent365-python into users/johanb/RTP_AgentFramework
This pull request introduces new chat history handling capabilities to the MCP Tool Registration Service. The most significant change is the implementation of methods for converting and sending chat history messages to the MCP platform, improving integration with real-time threat protection.
Chat history integration and messaging:
_convert_chat_messages_to_history,send_chat_history_messages_async, andsend_chat_history_asyncmethods tomcp_tool_registration_service.pyfor converting Agent FrameworkChatMessageobjects to the MCP platform format and sending them for real-time threat protection. These methods validate input, filter empty messages, and delegate to the core service for delivery.