feat: Refactor AI Assistant to Agent with Pydantic-AI and MCP support#1209
Merged
Teingi merged 32 commits intooceanbase:masterfrom Mar 19, 2026
Merged
feat: Refactor AI Assistant to Agent with Pydantic-AI and MCP support#1209Teingi merged 32 commits intooceanbase:masterfrom
Teingi merged 32 commits intooceanbase:masterfrom
Conversation
…ndler - close oceanbase#1054 - Introduced a new method `_deduplicate_parse_tables` to eliminate duplicate table entries in SQL parsing, ensuring that each table is processed only once even if referenced multiple times. - Updated existing methods to utilize the deduplication logic, improving efficiency in schema reporting and statistics gathering.
…ndler - close oceanbase#1054 - Introduced a new method `__append_create_table_sql` to append CREATE TABLE DDL statements to a designated SQL file for direct execution. - Updated the `__print_result` method to include the path of the newly created SQL file in the output summary. - Initialized `create_tables_sql_file` attribute to store the SQL file path based on the gather timestamp.
- Renamed AI Assistant to Agent across the codebase, including method names and command classes. - Updated `pyproject.toml` to include `pydantic-ai-slim` as a dependency. - Modified README files to reflect the new command name and its functionalities. - Introduced a new configuration structure for the agent in `ai.yml`. - Added new files for agent handling, configuration management, and MCP server/client integration. - Enhanced the agent's capabilities for interactive diagnostics and multi-cluster support.
- Updated various modules to replace hardcoded paths with the obdiag_path utility for better path management. - Refactored config file handling in ConfigHelper, ConfigManager, and MCPServer to ensure consistent usage of workspace paths. - Enhanced error handling and path expansion for configuration and log directories across the codebase. - Improved maintainability by centralizing path logic in the constant module.
…tool into 430-obdiag-agent
…tool into 430-obdiag-agent
- Introduced a new configuration file `agent.yml.example` to replace the deprecated `ai.yml.example`, providing clearer setup instructions for the obdiag agent. - Updated installation scripts to copy the new configuration file to the appropriate directory. - Modified various components to reference the new configuration path, ensuring compatibility with the updated structure. - Enhanced user experience guidelines in the agent's command handling, including clearer instructions for log gathering and session management. - Added session persistence features, allowing users to save and resume diagnostic sessions. - Improved command execution logic for better handling of tool-related messages and outputs.
- Introduced a new dependency on `pydantic-ai-skills` to enable skills functionality. - Updated `agent.yml.example` to include skills configuration options. - Enhanced the `AgentConfig` model to support skills settings such as directory, validation, and script timeout. - Implemented a `_build_skills_toolset` function to load skills from the specified directory when enabled. - Integrated skills handling into the agent creation process, allowing for dynamic instruction injection based on available skills.
* Enhancement: Add deduplication of parse tables in GatherPlanMonitorHandler - close oceanbase#1054 - Introduced a new method `_deduplicate_parse_tables` to eliminate duplicate table entries in SQL parsing, ensuring that each table is processed only once even if referenced multiple times. - Updated existing methods to utilize the deduplication logic, improving efficiency in schema reporting and statistics gathering. * Enhancement: Append CREATE TABLE DDL to SQL file in GatherTableDumpHandler - close oceanbase#1054 - Introduced a new method `__append_create_table_sql` to append CREATE TABLE DDL statements to a designated SQL file for direct execution. - Updated the `__print_result` method to include the path of the newly created SQL file in the output summary. - Initialized `create_tables_sql_file` attribute to store the SQL file path based on the gather timestamp. * update * fix: SQLTableExtractor comma join and filter invalid refs * fix(check): bug_469 glibc check - skip by default, only check affected OB version ranges
* Enhancement: Add deduplication of parse tables in GatherPlanMonitorHandler - close oceanbase#1054 - Introduced a new method `_deduplicate_parse_tables` to eliminate duplicate table entries in SQL parsing, ensuring that each table is processed only once even if referenced multiple times. - Updated existing methods to utilize the deduplication logic, improving efficiency in schema reporting and statistics gathering. * Enhancement: Append CREATE TABLE DDL to SQL file in GatherTableDumpHandler - close oceanbase#1054 - Introduced a new method `__append_create_table_sql` to append CREATE TABLE DDL statements to a designated SQL file for direct execution. - Updated the `__print_result` method to include the path of the newly created SQL file in the output summary. - Initialized `create_tables_sql_file` attribute to store the SQL file path based on the gather timestamp. * update * fix: SQLTableExtractor comma join and filter invalid refs * fix(gather_plan_monitor): use user tenant connection for database validation __validate_database uses sys_connector to query information_schema.SCHEMATA, but this view is tenant-scoped in OceanBase. Sys tenant only sees sys schemas, so user databases (e.g. ad_marketing in t_ad_marketing) fail validation. Fix: Use user tenant connection (db_conn) for validation instead. Create a temporary OBConnector with db_conn credentials (database=None to avoid connection failure when database is wrong), then query SCHEMATA. Made-with: Cursor
- Introduced a new configuration file `agent.yml.example` to replace the deprecated `ai.yml.example`, providing clearer setup instructions for the obdiag agent. - Updated installation scripts to copy the new configuration file to the appropriate directory. - Modified various components to reference the new configuration path, ensuring compatibility with the updated structure. - Enhanced user experience guidelines in the agent's command handling, including clearer instructions for log gathering and session management. - Added session persistence features, allowing users to save and resume diagnostic sessions. - Improved command execution logic for better handling of tool-related messages and outputs.
- Introduced a new dependency on `pydantic-ai-skills` to enable skills functionality. - Updated `agent.yml.example` to include skills configuration options. - Enhanced the `AgentConfig` model to support skills settings such as directory, validation, and script timeout. - Implemented a `_build_skills_toolset` function to load skills from the specified directory when enabled. - Integrated skills handling into the agent creation process, allowing for dynamic instruction injection based on available skills.
style(tools): clean up whitespace and formatting
Made-with: Cursor
… focused Made-with: Cursor
… agent PR focused Made-with: Cursor
# Conflicts: # src/handler/ai/ai_assistant_handler.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
obdiag agentcommand with interactive and single-shot modes