aixtools 0.2.21__py3-none-any.whl → 0.2.22__py3-none-any.whl
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/_version.py +2 -2
- aixtools/a2a/google_sdk/pydantic_ai_adapter/agent_executor.py +5 -4
- aixtools/a2a/google_sdk/utils.py +12 -0
- aixtools/mcp/client.py +8 -3
- {aixtools-0.2.21.dist-info → aixtools-0.2.22.dist-info}/METADATA +1 -1
- {aixtools-0.2.21.dist-info → aixtools-0.2.22.dist-info}/RECORD +9 -9
- {aixtools-0.2.21.dist-info → aixtools-0.2.22.dist-info}/WHEEL +0 -0
- {aixtools-0.2.21.dist-info → aixtools-0.2.22.dist-info}/entry_points.txt +0 -0
- {aixtools-0.2.21.dist-info → aixtools-0.2.22.dist-info}/top_level.txt +0 -0
aixtools/_version.py
CHANGED
|
@@ -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.22'
|
|
32
|
+
__version_tuple__ = version_tuple = (0, 2, 22)
|
|
33
33
|
|
|
34
34
|
__commit_id__ = commit_id = None
|
|
@@ -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
|
-
|
|
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,
|
aixtools/a2a/google_sdk/utils.py
CHANGED
|
@@ -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
|
aixtools/mcp/client.py
CHANGED
|
@@ -32,7 +32,6 @@ CACHE_KEY = "TOOL_LIST"
|
|
|
32
32
|
|
|
33
33
|
logger = get_logger(__name__)
|
|
34
34
|
|
|
35
|
-
|
|
36
35
|
# Default log_handler for MCP clients
|
|
37
36
|
LOGGING_LEVEL_MAP = logging.getLevelNamesMapping()
|
|
38
37
|
|
|
@@ -125,10 +124,16 @@ def get_mcp_servers(
|
|
|
125
124
|
|
|
126
125
|
|
|
127
126
|
def get_configured_mcp_servers(
|
|
128
|
-
session_id_tuple: SessionIdTuple,
|
|
127
|
+
session_id_tuple: SessionIdTuple,
|
|
128
|
+
mcp_urls: list[str],
|
|
129
|
+
*,
|
|
130
|
+
timeout: int = DEFAULT_MCP_CONNECTION_TIMEOUT,
|
|
131
|
+
auth_token: str | None = None,
|
|
129
132
|
):
|
|
130
133
|
"""Create MCP server instances from a list of URLs."""
|
|
131
|
-
return get_mcp_servers(
|
|
134
|
+
return get_mcp_servers(
|
|
135
|
+
[MCPConfig(url=url) for url in mcp_urls], session_id_tuple, timeout=timeout, auth_token=auth_token
|
|
136
|
+
)
|
|
132
137
|
|
|
133
138
|
|
|
134
139
|
class CachedMCPServerStreamableHTTP(MCPServerStreamableHTTP):
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
aixtools/__init__.py,sha256=9NGHm7LjsQmsvjTZvw6QFJexSvAU4bCoN_KBk9SCa00,260
|
|
2
|
-
aixtools/_version.py,sha256=
|
|
2
|
+
aixtools/_version.py,sha256=I7oxlElEVr-U2wT5qgQ2G41IxS87cokjF8Z2fKVHGrc,706
|
|
3
3
|
aixtools/app.py,sha256=JzQ0nrv_bjDQokllIlGHOV0HEb-V8N6k_nGQH-TEsVU,5227
|
|
4
4
|
aixtools/chainlit.md,sha256=yC37Ly57vjKyiIvK4oUvf4DYxZCwH7iocTlx7bLeGLU,761
|
|
5
5
|
aixtools/context.py,sha256=I_MD40ZnvRm5WPKAKqBUAdXIf8YaurkYUUHSVVy-QvU,598
|
|
@@ -21,8 +21,8 @@ aixtools/a2a/app.py,sha256=p18G7fAInl9dcNYq6RStBjv1C3aD6oilQq3WXtBuk30,5069
|
|
|
21
21
|
aixtools/a2a/utils.py,sha256=EHr3IyyBJn23ni-JcfAf6i3VpQmPs0g1TSnAZazvY_8,4039
|
|
22
22
|
aixtools/a2a/google_sdk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
23
23
|
aixtools/a2a/google_sdk/remote_agent_connection.py,sha256=gFsIja_nIQsAzxElv3A7_hG9GpDI5pkV-B_KDlcYlnc,3329
|
|
24
|
-
aixtools/a2a/google_sdk/utils.py,sha256=
|
|
25
|
-
aixtools/a2a/google_sdk/pydantic_ai_adapter/agent_executor.py,sha256=
|
|
24
|
+
aixtools/a2a/google_sdk/utils.py,sha256=k5VtTr4XLxsSKQDqly9QtWcZ5xfm03VbPpQ8OwoXtiQ,4369
|
|
25
|
+
aixtools/a2a/google_sdk/pydantic_ai_adapter/agent_executor.py,sha256=xamLIKl-FeB8PElVKgiIKR-MhFKmPjywHmC_ow-fGAA,9904
|
|
26
26
|
aixtools/a2a/google_sdk/pydantic_ai_adapter/storage.py,sha256=nGoVL7MPoZJW7iVR71laqpUYP308yFKZIifJtvUgpiU,878
|
|
27
27
|
aixtools/agents/__init__.py,sha256=MAW196S2_G7uGqv-VNjvlOETRfuV44WlU1leO7SiR0A,282
|
|
28
28
|
aixtools/agents/agent.py,sha256=7ZxKVOqLI_9K5LsTnqoTwRRHp6i-nFgQrJ6yA4M9iUE,7700
|
|
@@ -62,7 +62,7 @@ aixtools/logging/mcp_logger.py,sha256=d2I5l4t0d6rQH17w23FpE1IUD8Ax-mSaKfByCH86q4
|
|
|
62
62
|
aixtools/logging/model_patch_logging.py,sha256=CW5-kKI-zNEgZhNV4vx3EQu6fbrEtX7VjA6fE5loRLQ,2916
|
|
63
63
|
aixtools/logging/open_telemetry.py,sha256=fJjF1ou_8GyfNfbyWDQPGK6JAUrUaPwURYPHhXEtDBE,1121
|
|
64
64
|
aixtools/mcp/__init__.py,sha256=y6Akm5xeEFJ0K0TNM6aiTsUSe5k5kft8LSTaSEaY7vE,404
|
|
65
|
-
aixtools/mcp/client.py,sha256=
|
|
65
|
+
aixtools/mcp/client.py,sha256=lu1780mO3uRMzfzb32p74wH2VUv7jwfrHfZeLB5s3ME,18610
|
|
66
66
|
aixtools/mcp/example_client.py,sha256=QCFGP3NCNJMOKWjUOnFwjnbJhUSb879IA1ZYmwjRnmc,889
|
|
67
67
|
aixtools/mcp/example_server.py,sha256=1SWCyrLWsAnOa81HC4QbPJo_lBVu0b3SZBWI-qDh1vQ,458
|
|
68
68
|
aixtools/mcp/exceptions.py,sha256=9m3hy9fRINbXTSgkE71XW_luklgH6xBRp7VnSRfpyzQ,173
|
|
@@ -95,8 +95,8 @@ aixtools/utils/chainlit/cl_agent_show.py,sha256=vaRuowp4BRvhxEr5hw0zHEJ7iaSF_5bo
|
|
|
95
95
|
aixtools/utils/chainlit/cl_utils.py,sha256=fxaxdkcZg6uHdM8uztxdPowg3a2f7VR7B26VPY4t-3c,5738
|
|
96
96
|
aixtools/vault/__init__.py,sha256=fsr_NuX3GZ9WZ7dGfe0gp_5-z3URxAfwVRXw7Xyc0dU,141
|
|
97
97
|
aixtools/vault/vault.py,sha256=9dZLWdZQk9qN_Q9Djkofw9LUKnJqnrX5H0fGusVLBhA,6037
|
|
98
|
-
aixtools-0.2.
|
|
99
|
-
aixtools-0.2.
|
|
100
|
-
aixtools-0.2.
|
|
101
|
-
aixtools-0.2.
|
|
102
|
-
aixtools-0.2.
|
|
98
|
+
aixtools-0.2.22.dist-info/METADATA,sha256=JfIBvHI6hfSp7sjuKUg7lTnsx48sJFQfwpt5UzaZCeg,27958
|
|
99
|
+
aixtools-0.2.22.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
100
|
+
aixtools-0.2.22.dist-info/entry_points.txt,sha256=q8412TG4T0S8K0SKeWp2vkVPIDYQs0jNoHqcQ7qxOiA,155
|
|
101
|
+
aixtools-0.2.22.dist-info/top_level.txt,sha256=wBn-rw9bCtxrR4AYEYgjilNCUVmKY0LWby9Zan2PRJM,9
|
|
102
|
+
aixtools-0.2.22.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|