aixtools 0.2.20__tar.gz → 0.2.22__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.

Files changed (102) hide show
  1. {aixtools-0.2.20 → aixtools-0.2.22}/PKG-INFO +1 -1
  2. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/_version.py +3 -3
  3. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/a2a/google_sdk/pydantic_ai_adapter/agent_executor.py +5 -4
  4. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/a2a/google_sdk/utils.py +12 -0
  5. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/mcp/client.py +11 -4
  6. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/utils/config.py +2 -0
  7. {aixtools-0.2.20 → aixtools-0.2.22}/README.md +0 -0
  8. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/.chainlit/config.toml +0 -0
  9. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/.chainlit/translations/bn.json +0 -0
  10. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/.chainlit/translations/en-US.json +0 -0
  11. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/.chainlit/translations/gu.json +0 -0
  12. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/.chainlit/translations/he-IL.json +0 -0
  13. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/.chainlit/translations/hi.json +0 -0
  14. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/.chainlit/translations/ja.json +0 -0
  15. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/.chainlit/translations/kn.json +0 -0
  16. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/.chainlit/translations/ml.json +0 -0
  17. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/.chainlit/translations/mr.json +0 -0
  18. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/.chainlit/translations/nl.json +0 -0
  19. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/.chainlit/translations/ta.json +0 -0
  20. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/.chainlit/translations/te.json +0 -0
  21. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/.chainlit/translations/zh-CN.json +0 -0
  22. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/__init__.py +0 -0
  23. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/a2a/app.py +0 -0
  24. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/a2a/google_sdk/__init__.py +0 -0
  25. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/a2a/google_sdk/pydantic_ai_adapter/storage.py +0 -0
  26. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/a2a/google_sdk/remote_agent_connection.py +0 -0
  27. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/a2a/utils.py +0 -0
  28. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/agents/__init__.py +0 -0
  29. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/agents/agent.py +0 -0
  30. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/agents/agent_batch.py +0 -0
  31. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/agents/nodes_to_md.py +0 -0
  32. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/agents/nodes_to_message.py +0 -0
  33. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/agents/nodes_to_str.py +0 -0
  34. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/agents/print_nodes.py +0 -0
  35. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/agents/prompt.py +0 -0
  36. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/app.py +0 -0
  37. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/auth/__init__.py +0 -0
  38. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/auth/auth.py +0 -0
  39. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/chainlit.md +0 -0
  40. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/compliance/__init__.py +0 -0
  41. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/compliance/private_data.py +0 -0
  42. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/context.py +0 -0
  43. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/db/__init__.py +0 -0
  44. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/db/database.py +0 -0
  45. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/db/vector_db.py +0 -0
  46. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/evals/__init__.py +0 -0
  47. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/evals/__main__.py +0 -0
  48. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/evals/dataset.py +0 -0
  49. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/evals/discovery.py +0 -0
  50. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/evals/run_evals.py +0 -0
  51. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/google/client.py +0 -0
  52. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/log_view/__init__.py +0 -0
  53. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/log_view/app.py +0 -0
  54. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/log_view/display.py +0 -0
  55. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/log_view/export.py +0 -0
  56. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/log_view/filters.py +0 -0
  57. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/log_view/log_utils.py +0 -0
  58. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/log_view/node_summary.py +0 -0
  59. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/logfilters/__init__.py +0 -0
  60. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/logfilters/context_filter.py +0 -0
  61. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/logging/__init__.py +0 -0
  62. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/logging/log_objects.py +0 -0
  63. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/logging/logging_config.py +0 -0
  64. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/logging/mcp_log_models.py +0 -0
  65. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/logging/mcp_logger.py +0 -0
  66. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/logging/model_patch_logging.py +0 -0
  67. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/logging/open_telemetry.py +0 -0
  68. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/mcp/__init__.py +0 -0
  69. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/mcp/example_client.py +0 -0
  70. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/mcp/example_server.py +0 -0
  71. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/mcp/exceptions.py +0 -0
  72. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/mcp/fast_mcp_log.py +0 -0
  73. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/mcp/faulty_mcp.py +0 -0
  74. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/mcp/middleware.py +0 -0
  75. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/mcp/server.py +0 -0
  76. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/model_patch/model_patch.py +0 -0
  77. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/server/__init__.py +0 -0
  78. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/server/app_mounter.py +0 -0
  79. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/server/path.py +0 -0
  80. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/server/utils.py +0 -0
  81. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/testing/__init__.py +0 -0
  82. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/testing/agent_mock.py +0 -0
  83. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/testing/aix_test_model.py +0 -0
  84. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/testing/mock_tool.py +0 -0
  85. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/testing/model_patch_cache.py +0 -0
  86. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/tools/doctor/__init__.py +0 -0
  87. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/tools/doctor/mcp_tool_doctor.py +0 -0
  88. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/tools/doctor/tool_doctor.py +0 -0
  89. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/tools/doctor/tool_recommendation.py +0 -0
  90. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/utils/__init__.py +0 -0
  91. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/utils/chainlit/cl_agent_show.py +0 -0
  92. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/utils/chainlit/cl_utils.py +0 -0
  93. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/utils/config_util.py +0 -0
  94. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/utils/enum_with_description.py +0 -0
  95. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/utils/files.py +0 -0
  96. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/utils/persisted_dict.py +0 -0
  97. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/utils/utils.py +0 -0
  98. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/vault/__init__.py +0 -0
  99. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools/vault/vault.py +0 -0
  100. {aixtools-0.2.20 → aixtools-0.2.22}/aixtools.egg-info/SOURCES.txt +0 -0
  101. {aixtools-0.2.20 → aixtools-0.2.22}/pyproject.toml +0 -0
  102. {aixtools-0.2.20 → aixtools-0.2.22}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aixtools
3
- Version: 0.2.20
3
+ Version: 0.2.22
4
4
  Summary: Tools for AI exploration and debugging
5
5
  Requires-Python: >=3.11.2
6
6
  Description-Content-Type: text/markdown
@@ -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.20'
32
- __version_tuple__ = version_tuple = (0, 2, 20)
31
+ __version__ = version = '0.2.22'
32
+ __version_tuple__ = version_tuple = (0, 2, 22)
33
33
 
34
- __commit_id__ = commit_id = 'ge7f4f14bb'
34
+ __commit_id__ = commit_id = 'g15d95015f'
@@ -20,7 +20,7 @@ from pydantic_ai import Agent, BinaryContent
20
20
 
21
21
  from aixtools.a2a.google_sdk.pydantic_ai_adapter.storage import InMemoryHistoryStorage
22
22
  from aixtools.a2a.google_sdk.remote_agent_connection import is_in_terminal_state
23
- from aixtools.a2a.google_sdk.utils import get_session_id_tuple
23
+ from aixtools.a2a.google_sdk.utils import get_auth_token, get_session_id_tuple
24
24
  from aixtools.agents import get_agent
25
25
  from aixtools.agents.prompt import build_user_input
26
26
  from aixtools.context import SessionIdTuple
@@ -100,7 +100,8 @@ class PydanticAgentExecutor(AgentExecutor):
100
100
  event_queue (EventQueue): The event queue to enqueue events.
101
101
  """
102
102
  session_tuple = get_session_id_tuple(context)
103
- agent = self._build_agent(session_tuple)
103
+ auth_token = get_auth_token(context)
104
+ agent = self._build_agent(session_tuple, auth_token)
104
105
  if context.message is None:
105
106
  raise ValueError("No message provided")
106
107
 
@@ -258,9 +259,9 @@ class PydanticAgentExecutor(AgentExecutor):
258
259
  )
259
260
  )
260
261
 
261
- def _build_agent(self, session_tuple: SessionIdTuple) -> Agent:
262
+ def _build_agent(self, session_tuple: SessionIdTuple, auth_token: str | None) -> Agent:
262
263
  params = self._agent_parameters
263
- mcp_servers = get_configured_mcp_servers(session_tuple, params.mcp_servers)
264
+ mcp_servers = get_configured_mcp_servers(session_tuple, params.mcp_servers, auth_token=auth_token)
264
265
  return get_agent(
265
266
  system_prompt=params.system_prompt,
266
267
  toolsets=mcp_servers,
@@ -96,3 +96,15 @@ def get_session_id_tuple(context: RequestContext) -> SessionIdTuple:
96
96
  """Get the user_id, session_id tuple from the request context."""
97
97
  headers = context.call_context.state.get("headers", {})
98
98
  return headers.get("user-id", DEFAULT_USER_ID), headers.get("session-id", DEFAULT_SESSION_ID)
99
+
100
+
101
+ def get_auth_token(context: RequestContext) -> str | None:
102
+ """Get the Authorization bearer token from the request context."""
103
+ headers = context.call_context.state.get("headers", {})
104
+ auth_header = headers.get("Authorization") or headers.get("authorization")
105
+ auth_token = None
106
+ if auth_header and auth_header.lower().startswith("bearer "):
107
+ auth_token = auth_header.split(" ", 1)[1].strip()
108
+ else:
109
+ logger.warning("Cannot find bearer token in Authorization header: %s", auth_header)
110
+ return auth_token
@@ -23,6 +23,7 @@ from pydantic_ai.toolsets.abstract import ToolsetTool
23
23
  from aixtools.context import SessionIdTuple
24
24
  from aixtools.logging.logging_config import get_logger
25
25
  from aixtools.server.utils import create_session_headers
26
+ from aixtools.utils.config import MCP_TOOLS_MAX_RETRIES
26
27
 
27
28
  MCP_TOOL_CACHE_TTL = 300 # 5 minutes
28
29
  DEFAULT_MCP_CONNECTION_TIMEOUT = 30
@@ -31,7 +32,6 @@ CACHE_KEY = "TOOL_LIST"
31
32
 
32
33
  logger = get_logger(__name__)
33
34
 
34
-
35
35
  # Default log_handler for MCP clients
36
36
  LOGGING_LEVEL_MAP = logging.getLevelNamesMapping()
37
37
 
@@ -87,6 +87,7 @@ def get_mcp_servers(
87
87
  mcp_configs: list[MCPConfig],
88
88
  session_id_tuple: SessionIdTuple,
89
89
  auth_token: str = None,
90
+ max_retries: int = MCP_TOOLS_MAX_RETRIES,
90
91
  *,
91
92
  timeout: float = DEFAULT_MCP_CONNECTION_TIMEOUT,
92
93
  ):
@@ -115,7 +116,7 @@ def get_mcp_servers(
115
116
  servers = []
116
117
  for config in mcp_configs:
117
118
  server = CachedMCPServerStreamableHTTP(
118
- url=config.url, headers=headers, timeout=timeout, read_timeout=config.read_timeout
119
+ url=config.url, headers=headers, timeout=timeout, read_timeout=config.read_timeout, max_retries=max_retries
119
120
  )
120
121
  logger.info("Using MCP server at %s", config.url)
121
122
  servers.append(server)
@@ -123,10 +124,16 @@ def get_mcp_servers(
123
124
 
124
125
 
125
126
  def get_configured_mcp_servers(
126
- session_id_tuple: SessionIdTuple, mcp_urls: list[str], timeout: int = DEFAULT_MCP_CONNECTION_TIMEOUT
127
+ session_id_tuple: SessionIdTuple,
128
+ mcp_urls: list[str],
129
+ *,
130
+ timeout: int = DEFAULT_MCP_CONNECTION_TIMEOUT,
131
+ auth_token: str | None = None,
127
132
  ):
128
133
  """Create MCP server instances from a list of URLs."""
129
- return get_mcp_servers([MCPConfig(url=url) for url in mcp_urls], session_id_tuple, timeout=timeout)
134
+ return get_mcp_servers(
135
+ [MCPConfig(url=url) for url in mcp_urls], session_id_tuple, timeout=timeout, auth_token=auth_token
136
+ )
130
137
 
131
138
 
132
139
  class CachedMCPServerStreamableHTTP(MCPServerStreamableHTTP):
@@ -144,3 +144,5 @@ SKIP_MCP_AUTHORIZATION = str2bool(get_variable_env("SKIP_MCP_AUTHORIZATION", Tru
144
144
  APP_DEFAULT_SCOPE = get_variable_env("APP_DEFAULT_SCOPE", allow_empty=True)
145
145
 
146
146
  AUTH_TEST_TOKEN = get_variable_env("AUTH_TEST_TOKEN", allow_empty=True)
147
+
148
+ MCP_TOOLS_MAX_RETRIES = int(get_variable_env("MCP_TOOLS_MAX_RETRIES", default=10))
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes