aixtools 0.2.16__tar.gz → 0.2.17__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of aixtools might be problematic. Click here for more details.
- {aixtools-0.2.16 → aixtools-0.2.17}/PKG-INFO +1 -1
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/_version.py +3 -3
- aixtools-0.2.17/aixtools/logging/mcp_middleware.py +54 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools.egg-info/SOURCES.txt +1 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/README.md +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/.chainlit/config.toml +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/.chainlit/translations/bn.json +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/.chainlit/translations/en-US.json +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/.chainlit/translations/gu.json +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/.chainlit/translations/he-IL.json +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/.chainlit/translations/hi.json +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/.chainlit/translations/ja.json +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/.chainlit/translations/kn.json +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/.chainlit/translations/ml.json +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/.chainlit/translations/mr.json +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/.chainlit/translations/nl.json +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/.chainlit/translations/ta.json +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/.chainlit/translations/te.json +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/.chainlit/translations/zh-CN.json +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/__init__.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/a2a/app.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/a2a/google_sdk/__init__.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/a2a/google_sdk/pydantic_ai_adapter/agent_executor.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/a2a/google_sdk/pydantic_ai_adapter/storage.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/a2a/google_sdk/remote_agent_connection.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/a2a/google_sdk/utils.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/a2a/utils.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/agents/__init__.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/agents/agent.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/agents/agent_batch.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/agents/nodes_to_md.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/agents/nodes_to_message.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/agents/nodes_to_str.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/agents/print_nodes.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/agents/prompt.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/app.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/auth/__init__.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/auth/auth.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/chainlit.md +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/compliance/__init__.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/compliance/private_data.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/context.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/db/__init__.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/db/database.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/db/vector_db.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/evals/__init__.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/evals/__main__.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/evals/dataset.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/evals/discovery.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/evals/run_evals.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/google/client.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/log_view/__init__.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/log_view/app.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/log_view/display.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/log_view/export.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/log_view/filters.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/log_view/log_utils.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/log_view/node_summary.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/logfilters/__init__.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/logfilters/context_filter.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/logging/__init__.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/logging/log_objects.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/logging/logging_config.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/logging/mcp_log_models.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/logging/mcp_logger.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/logging/model_patch_logging.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/logging/open_telemetry.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/mcp/__init__.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/mcp/client.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/mcp/example_client.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/mcp/example_server.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/mcp/exceptions.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/mcp/fast_mcp_log.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/mcp/faulty_mcp.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/model_patch/model_patch.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/server/__init__.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/server/app_mounter.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/server/path.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/server/utils.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/testing/__init__.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/testing/agent_mock.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/testing/aix_test_model.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/testing/mock_tool.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/testing/model_patch_cache.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/tools/doctor/__init__.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/tools/doctor/mcp_tool_doctor.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/tools/doctor/tool_doctor.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/tools/doctor/tool_recommendation.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/utils/__init__.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/utils/chainlit/cl_agent_show.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/utils/chainlit/cl_utils.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/utils/config.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/utils/config_util.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/utils/enum_with_description.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/utils/files.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/utils/persisted_dict.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/utils/utils.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/vault/__init__.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/aixtools/vault/vault.py +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/pyproject.toml +0 -0
- {aixtools-0.2.16 → aixtools-0.2.17}/setup.cfg +0 -0
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
|
28
28
|
commit_id: COMMIT_ID
|
|
29
29
|
__commit_id__: COMMIT_ID
|
|
30
30
|
|
|
31
|
-
__version__ = version = '0.2.
|
|
32
|
-
__version_tuple__ = version_tuple = (0, 2,
|
|
31
|
+
__version__ = version = '0.2.17'
|
|
32
|
+
__version_tuple__ = version_tuple = (0, 2, 17)
|
|
33
33
|
|
|
34
|
-
__commit_id__ = commit_id = '
|
|
34
|
+
__commit_id__ = commit_id = 'ga621dde20'
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Custom middleware for MCP servers
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import traceback
|
|
6
|
+
|
|
7
|
+
from fastmcp.server.middleware.error_handling import ErrorHandlingMiddleware
|
|
8
|
+
from fastmcp.server.middleware.middleware import MiddlewareContext
|
|
9
|
+
|
|
10
|
+
from aixtools.mcp import AixToolError
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class AixErrorHandlingMiddleware(ErrorHandlingMiddleware):
|
|
14
|
+
"""Custom middleware class for handling errors in MCP servers."""
|
|
15
|
+
|
|
16
|
+
def log_as_warn_with_traceback(
|
|
17
|
+
self, *, error: Exception, original_error: Exception, context: MiddlewareContext
|
|
18
|
+
) -> None:
|
|
19
|
+
"""Logs provided error as warning.
|
|
20
|
+
original_error is an 'unwrapped' error if applicable, otherwise can be the same as error param.
|
|
21
|
+
"""
|
|
22
|
+
error_type = type(original_error).__name__
|
|
23
|
+
method = context.method or "unknown"
|
|
24
|
+
error_key = f"{error_type}:{method}"
|
|
25
|
+
self.error_counts[error_key] = self.error_counts.get(error_key, 0) + 1
|
|
26
|
+
base_message = f"{method} resulted in {error_type}: {str(error)}"
|
|
27
|
+
if self.include_traceback:
|
|
28
|
+
self.logger.warning(f"{base_message}\n{traceback.format_exc()}")
|
|
29
|
+
if self.error_callback:
|
|
30
|
+
try:
|
|
31
|
+
self.error_callback(error, context)
|
|
32
|
+
except Exception as callback_error: # pylint: disable=broad-exception-caught
|
|
33
|
+
self.logger.warning("Callback failed spectacularly: %s", callback_error)
|
|
34
|
+
|
|
35
|
+
def handle_error(self, error: Exception, context: MiddlewareContext) -> bool:
|
|
36
|
+
"""Custom error logging"""
|
|
37
|
+
if isinstance(error, AixToolError):
|
|
38
|
+
self.log_as_warn_with_traceback(error=error, original_error=error, context=context)
|
|
39
|
+
return True
|
|
40
|
+
|
|
41
|
+
inner_error = error
|
|
42
|
+
while hasattr(inner_error, "__cause__") and inner_error.__cause__ is not None:
|
|
43
|
+
inner_error = inner_error.__cause__
|
|
44
|
+
if isinstance(inner_error, AixToolError):
|
|
45
|
+
self.log_as_warn_with_traceback(error=error, original_error=inner_error, context=context)
|
|
46
|
+
return True
|
|
47
|
+
|
|
48
|
+
return False
|
|
49
|
+
|
|
50
|
+
def _log_error(self, error: Exception, context: MiddlewareContext) -> None:
|
|
51
|
+
"""Override original _log_error method."""
|
|
52
|
+
if self.handle_error(error, context):
|
|
53
|
+
return
|
|
54
|
+
super()._log_error(error, context)
|
|
@@ -61,6 +61,7 @@ aixtools/logging/log_objects.py
|
|
|
61
61
|
aixtools/logging/logging_config.py
|
|
62
62
|
aixtools/logging/mcp_log_models.py
|
|
63
63
|
aixtools/logging/mcp_logger.py
|
|
64
|
+
aixtools/logging/mcp_middleware.py
|
|
64
65
|
aixtools/logging/model_patch_logging.py
|
|
65
66
|
aixtools/logging/open_telemetry.py
|
|
66
67
|
aixtools/mcp/__init__.py
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{aixtools-0.2.16 → aixtools-0.2.17}/aixtools/a2a/google_sdk/pydantic_ai_adapter/agent_executor.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|