blaxel 0.2.31__py3-none-any.whl → 0.2.31rc120__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.
Files changed (174) hide show
  1. blaxel/__init__.py +3 -3
  2. blaxel/core/agents/__init__.py +6 -13
  3. blaxel/core/authentication/__init__.py +1 -2
  4. blaxel/core/authentication/devicemode.py +1 -9
  5. blaxel/core/authentication/oauth.py +6 -13
  6. blaxel/core/authentication/types.py +0 -1
  7. blaxel/core/cache/cache.py +3 -10
  8. blaxel/core/client/api/agents/list_agent_revisions.py +1 -3
  9. blaxel/core/client/api/compute/delete_sandbox_preview_token.py +2 -6
  10. blaxel/core/client/api/compute/start_sandbox.py +1 -3
  11. blaxel/core/client/api/compute/stop_sandbox.py +1 -3
  12. blaxel/core/client/api/default/list_sandbox_hub_definitions.py +2 -6
  13. blaxel/core/client/api/functions/list_function_revisions.py +1 -3
  14. blaxel/core/client/api/images/cleanup_images.py +1 -3
  15. blaxel/core/client/api/integrations/list_integration_connections.py +2 -6
  16. blaxel/core/client/api/invitations/list_all_pending_invitations.py +1 -3
  17. blaxel/core/client/api/jobs/create_job_execution.py +1 -3
  18. blaxel/core/client/api/jobs/delete_job_execution.py +1 -3
  19. blaxel/core/client/api/jobs/get_job_execution.py +1 -3
  20. blaxel/core/client/api/jobs/list_job_executions.py +2 -6
  21. blaxel/core/client/api/jobs/list_job_revisions.py +1 -3
  22. blaxel/core/client/api/locations/list_locations.py +1 -3
  23. blaxel/core/client/api/models/list_model_revisions.py +1 -3
  24. blaxel/core/client/api/service_accounts/create_workspace_service_account.py +2 -6
  25. blaxel/core/client/api/service_accounts/delete_workspace_service_account.py +2 -6
  26. blaxel/core/client/api/service_accounts/get_workspace_service_accounts.py +1 -3
  27. blaxel/core/client/api/service_accounts/update_workspace_service_account.py +2 -6
  28. blaxel/core/client/api/volume_templates/list_volume_templates.py +1 -3
  29. blaxel/core/client/api/workspaces/accept_workspace_invitation.py +2 -6
  30. blaxel/core/client/api/workspaces/invite_workspace_user.py +2 -6
  31. blaxel/core/client/api/workspaces/update_workspace_user_role.py +2 -6
  32. blaxel/core/client/client.py +19 -5
  33. blaxel/core/client/models/agent.py +4 -11
  34. blaxel/core/client/models/agent_spec.py +5 -18
  35. blaxel/core/client/models/billable_time_metric.py +1 -0
  36. blaxel/core/client/models/configuration.py +1 -0
  37. blaxel/core/client/models/core_spec.py +3 -10
  38. blaxel/core/client/models/core_spec_configurations.py +1 -0
  39. blaxel/core/client/models/create_job_execution_request.py +1 -0
  40. blaxel/core/client/models/create_job_execution_response.py +1 -0
  41. blaxel/core/client/models/custom_domain.py +2 -5
  42. blaxel/core/client/models/custom_domain_metadata.py +1 -0
  43. blaxel/core/client/models/custom_domain_spec.py +2 -5
  44. blaxel/core/client/models/delete_volume_template_version_response_200.py +2 -5
  45. blaxel/core/client/models/entrypoint.py +1 -0
  46. blaxel/core/client/models/form.py +2 -5
  47. blaxel/core/client/models/function.py +4 -11
  48. blaxel/core/client/models/function_spec.py +4 -13
  49. blaxel/core/client/models/image.py +2 -5
  50. blaxel/core/client/models/image_spec.py +1 -0
  51. blaxel/core/client/models/integration.py +3 -10
  52. blaxel/core/client/models/integration_connection.py +2 -5
  53. blaxel/core/client/models/integration_connection_spec.py +1 -0
  54. blaxel/core/client/models/integration_endpoint.py +2 -5
  55. blaxel/core/client/models/integration_endpoints.py +2 -0
  56. blaxel/core/client/models/job.py +4 -11
  57. blaxel/core/client/models/job_execution.py +2 -5
  58. blaxel/core/client/models/job_execution_spec.py +1 -0
  59. blaxel/core/client/models/job_execution_task.py +2 -5
  60. blaxel/core/client/models/job_metrics.py +2 -5
  61. blaxel/core/client/models/job_spec.py +4 -13
  62. blaxel/core/client/models/jobs_network_chart.py +1 -0
  63. blaxel/core/client/models/jobs_success_failed_chart.py +3 -10
  64. blaxel/core/client/models/latency_metric.py +2 -5
  65. blaxel/core/client/models/location_response.py +1 -0
  66. blaxel/core/client/models/mcp_definition.py +2 -5
  67. blaxel/core/client/models/metadata.py +1 -0
  68. blaxel/core/client/models/metrics.py +4 -11
  69. blaxel/core/client/models/model.py +4 -11
  70. blaxel/core/client/models/model_spec.py +3 -10
  71. blaxel/core/client/models/pending_invitation_accept.py +2 -5
  72. blaxel/core/client/models/pending_invitation_render.py +3 -10
  73. blaxel/core/client/models/policy.py +2 -5
  74. blaxel/core/client/models/policy_spec.py +4 -11
  75. blaxel/core/client/models/preview.py +2 -5
  76. blaxel/core/client/models/preview_spec.py +1 -0
  77. blaxel/core/client/models/preview_token.py +2 -5
  78. blaxel/core/client/models/public_ips.py +1 -0
  79. blaxel/core/client/models/request_duration_over_time_metrics.py +1 -0
  80. blaxel/core/client/models/request_total_by_origin_metric.py +7 -16
  81. blaxel/core/client/models/request_total_metric.py +3 -8
  82. blaxel/core/client/models/resource_metrics.py +17 -58
  83. blaxel/core/client/models/runtime.py +1 -0
  84. blaxel/core/client/models/sandbox.py +4 -11
  85. blaxel/core/client/models/sandbox_definition.py +1 -0
  86. blaxel/core/client/models/sandbox_lifecycle.py +1 -0
  87. blaxel/core/client/models/sandbox_spec.py +6 -21
  88. blaxel/core/client/models/serverless_config.py +1 -0
  89. blaxel/core/client/models/start_sandbox.py +2 -5
  90. blaxel/core/client/models/stop_sandbox.py +2 -5
  91. blaxel/core/client/models/store_agent.py +1 -0
  92. blaxel/core/client/models/store_configuration.py +1 -0
  93. blaxel/core/client/models/template.py +1 -0
  94. blaxel/core/client/models/time_to_first_token_over_time_metrics.py +2 -3
  95. blaxel/core/client/models/token_rate_metrics.py +1 -0
  96. blaxel/core/client/models/trigger.py +1 -0
  97. blaxel/core/client/models/trigger_configuration.py +1 -0
  98. blaxel/core/client/models/volume.py +4 -11
  99. blaxel/core/client/models/volume_template.py +2 -5
  100. blaxel/core/client/models/workspace.py +2 -5
  101. blaxel/core/client/response_interceptor.py +1 -3
  102. blaxel/core/common/autoload.py +11 -9
  103. blaxel/core/common/env.py +8 -10
  104. blaxel/core/common/settings.py +2 -4
  105. blaxel/core/common/webhook.py +1 -0
  106. blaxel/core/jobs/__init__.py +3 -13
  107. blaxel/core/mcp/client.py +2 -8
  108. blaxel/core/mcp/server.py +2 -8
  109. blaxel/core/models/__init__.py +5 -6
  110. blaxel/core/sandbox/__init__.py +1 -1
  111. blaxel/core/sandbox/client/api/codegen/get_codegen_reranking_path.py +2 -6
  112. blaxel/core/sandbox/client/api/fastapply/put_codegen_fastapply_path.py +2 -6
  113. blaxel/core/sandbox/client/api/filesystem/delete_filesystem_multipart_upload_id_abort.py +2 -6
  114. blaxel/core/sandbox/client/api/filesystem/delete_filesystem_path.py +2 -6
  115. blaxel/core/sandbox/client/api/filesystem/delete_filesystem_tree_path.py +2 -6
  116. blaxel/core/sandbox/client/api/filesystem/get_filesystem_content_search_path.py +1 -3
  117. blaxel/core/sandbox/client/api/filesystem/get_filesystem_find_path.py +2 -6
  118. blaxel/core/sandbox/client/api/filesystem/get_filesystem_search_path.py +2 -6
  119. blaxel/core/sandbox/client/api/filesystem/get_watch_filesystem_path.py +2 -6
  120. blaxel/core/sandbox/client/api/filesystem/post_filesystem_multipart_upload_id_complete.py +2 -6
  121. blaxel/core/sandbox/client/api/filesystem/put_filesystem_path.py +2 -6
  122. blaxel/core/sandbox/client/api/process/delete_process_identifier.py +2 -6
  123. blaxel/core/sandbox/client/api/process/delete_process_identifier_kill.py +2 -6
  124. blaxel/core/sandbox/client/api/process/get_process.py +1 -3
  125. blaxel/core/sandbox/client/api/process/get_process_identifier.py +2 -6
  126. blaxel/core/sandbox/client/api/process/get_process_identifier_logs.py +2 -6
  127. blaxel/core/sandbox/client/api/process/get_process_identifier_logs_stream.py +2 -6
  128. blaxel/core/sandbox/client/api/process/post_process.py +2 -6
  129. blaxel/core/sandbox/client/client.py +1 -3
  130. blaxel/core/sandbox/client/models/filesystem_multipart_upload_parts.py +1 -3
  131. blaxel/core/sandbox/default/__init__.py +1 -0
  132. blaxel/core/sandbox/default/action.py +3 -3
  133. blaxel/core/sandbox/default/codegen.py +4 -2
  134. blaxel/core/sandbox/default/filesystem.py +82 -38
  135. blaxel/core/sandbox/default/interpreter.py +10 -17
  136. blaxel/core/sandbox/default/preview.py +2 -6
  137. blaxel/core/sandbox/default/process.py +7 -25
  138. blaxel/core/sandbox/default/sandbox.py +2 -7
  139. blaxel/core/sandbox/sync/__init__.py +2 -0
  140. blaxel/core/sandbox/sync/action.py +3 -2
  141. blaxel/core/sandbox/sync/codegen.py +5 -1
  142. blaxel/core/sandbox/sync/filesystem.py +6 -17
  143. blaxel/core/sandbox/sync/interpreter.py +6 -10
  144. blaxel/core/sandbox/sync/network.py +2 -0
  145. blaxel/core/sandbox/sync/preview.py +9 -21
  146. blaxel/core/sandbox/sync/process.py +8 -32
  147. blaxel/core/sandbox/sync/sandbox.py +6 -13
  148. blaxel/core/sandbox/sync/session.py +4 -6
  149. blaxel/core/sandbox/types.py +1 -2
  150. blaxel/core/tools/__init__.py +6 -30
  151. blaxel/core/tools/common.py +1 -1
  152. blaxel/core/tools/types.py +1 -2
  153. blaxel/crewai/model.py +5 -20
  154. blaxel/googleadk/__init__.py +1 -1
  155. blaxel/googleadk/tools.py +5 -3
  156. blaxel/langgraph/custom/gemini.py +133 -126
  157. blaxel/langgraph/model.py +50 -54
  158. blaxel/langgraph/tools.py +3 -9
  159. blaxel/llamaindex/custom/cohere.py +16 -25
  160. blaxel/llamaindex/model.py +57 -44
  161. blaxel/llamaindex/tools.py +3 -2
  162. blaxel/pydantic/custom/gemini.py +3 -3
  163. blaxel/pydantic/tools.py +4 -2
  164. blaxel/telemetry/exporters.py +3 -10
  165. blaxel/telemetry/instrumentation/blaxel_langgraph.py +2 -4
  166. blaxel/telemetry/instrumentation/blaxel_langgraph_gemini.py +5 -22
  167. blaxel/telemetry/instrumentation/utils.py +3 -3
  168. blaxel/telemetry/log/log.py +3 -2
  169. blaxel/telemetry/log/logger.py +15 -21
  170. blaxel/telemetry/span.py +6 -10
  171. {blaxel-0.2.31.dist-info → blaxel-0.2.31rc120.dist-info}/METADATA +2 -2
  172. {blaxel-0.2.31.dist-info → blaxel-0.2.31rc120.dist-info}/RECORD +174 -174
  173. {blaxel-0.2.31.dist-info → blaxel-0.2.31rc120.dist-info}/WHEEL +0 -0
  174. {blaxel-0.2.31.dist-info → blaxel-0.2.31rc120.dist-info}/licenses/LICENSE +0 -0
@@ -8,12 +8,7 @@ from typing import Any, cast
8
8
  import httpx
9
9
  from mcp import ClientSession
10
10
  from mcp.client.streamable_http import streamablehttp_client
11
- from mcp.types import (
12
- CallToolRequest,
13
- CallToolRequestParams,
14
- CallToolResult,
15
- ClientRequest,
16
- )
11
+ from mcp.types import CallToolRequest, CallToolRequestParams, CallToolResult, ClientRequest
17
12
  from mcp.types import Tool as MCPTool
18
13
 
19
14
  from ..common.internal import get_forced_url, get_global_unique_hash
@@ -29,13 +24,7 @@ if os.getenv("BL_SERVER_PORT"):
29
24
 
30
25
 
31
26
  class PersistentMcpClient:
32
- def __init__(
33
- self,
34
- name: str,
35
- timeout: int = DEFAULT_TIMEOUT,
36
- timeout_enabled: bool = True,
37
- transport: str = None,
38
- ):
27
+ def __init__(self, name: str, timeout: int = DEFAULT_TIMEOUT, timeout_enabled: bool = True, transport: str = None):
39
28
  self.name = name
40
29
  self.timeout = timeout
41
30
  self.type = "function"
@@ -108,9 +97,7 @@ class PersistentMcpClient:
108
97
  await self.initialize()
109
98
  if self.timeout_enabled:
110
99
  self._remove_timer()
111
- logger.debug(
112
- f"Calling tool {tool_name} with arguments {arguments} and meta {self.metas}"
113
- )
100
+ logger.debug(f"Calling tool {tool_name} with arguments {arguments} and meta {self.metas}")
114
101
 
115
102
  # Pass meta as a separate field instead of merging into arguments
116
103
  # This matches the TypeScript SDK pattern and MCP protocol specification
@@ -183,9 +170,7 @@ class PersistentMcpClient:
183
170
 
184
171
  except Exception as e:
185
172
  # Default to websocket if we can't determine the transport type
186
- logger.warning(
187
- f"Failed to detect transport type for {self.name}: {e}. Defaulting to websocket."
188
- )
173
+ logger.warning(f"Failed to detect transport type for {self.name}: {e}. Defaulting to websocket.")
189
174
  self.transport_name = "websocket"
190
175
 
191
176
  return self.transport_name
@@ -341,10 +326,7 @@ class BlTools:
341
326
  if not toolPersistances.get(name):
342
327
  logger.debug(f"Creating new persistent connection for {name}")
343
328
  toolPersistances[name] = PersistentMcpClient(
344
- name,
345
- timeout=self.timeout,
346
- timeout_enabled=self.timeout_enabled,
347
- transport=self.transport,
329
+ name, timeout=self.timeout, timeout_enabled=self.timeout_enabled, transport=self.transport
348
330
  )
349
331
  await toolPersistances[name].list_tools()
350
332
  logger.debug(f"Loaded {len(toolPersistances[name].get_tools())} tools")
@@ -364,10 +346,4 @@ def bl_tools(
364
346
  timeout_enabled: bool = True,
365
347
  transport: str = None,
366
348
  ) -> BlTools:
367
- return BlTools(
368
- functions,
369
- metas=metas,
370
- timeout=timeout,
371
- timeout_enabled=timeout_enabled,
372
- transport=transport,
373
- )
349
+ return BlTools(functions, metas=metas, timeout=timeout, timeout_enabled=timeout_enabled, transport=transport)
@@ -42,4 +42,4 @@ def create_model_from_json_schema(
42
42
  field_type,
43
43
  Field(default_value, description=field_schema.get("description", "")),
44
44
  )
45
- return create_model(model_name, **fields)
45
+ return create_model(model_name, **fields)
@@ -12,10 +12,9 @@ class ToolException(Exception): # noqa: N818
12
12
  to the agent as observation, and printed in red on the console.
13
13
  """
14
14
 
15
-
16
15
  class Tool(BaseModel):
17
16
  name: str
18
17
  description: str
19
18
  input_schema: Dict[str, Any]
20
19
  coroutine: Callable[..., Awaitable[Any]] | None = None
21
- sync_coroutine: Callable[..., Any] | None = None
20
+ sync_coroutine: Callable[..., Any] | None = None
blaxel/crewai/model.py CHANGED
@@ -18,24 +18,15 @@ async def bl_model(name: str, **kwargs):
18
18
  url, type, model = await bl_model_core(name).get_parameters()
19
19
  if type == "mistral":
20
20
  return AuthenticatedLLM(
21
- model=f"mistral/{model}",
22
- api_key="replaced",
23
- base_url=f"{url}/v1",
24
- **kwargs,
21
+ model=f"mistral/{model}", api_key="replaced", base_url=f"{url}/v1", **kwargs
25
22
  )
26
23
  elif type == "xai":
27
24
  return AuthenticatedLLM(
28
- model=f"groq/{model}",
29
- api_key="replaced",
30
- base_url=f"{url}/v1",
31
- **kwargs,
25
+ model=f"groq/{model}", api_key="replaced", base_url=f"{url}/v1", **kwargs
32
26
  )
33
27
  elif type == "deepseek":
34
28
  return AuthenticatedLLM(
35
- model=f"openai/{model}",
36
- api_key="replaced",
37
- base_url=f"{url}/v1",
38
- **kwargs,
29
+ model=f"openai/{model}", api_key="replaced", base_url=f"{url}/v1", **kwargs
39
30
  )
40
31
  elif type == "anthropic":
41
32
  return AuthenticatedLLM(
@@ -53,17 +44,11 @@ async def bl_model(name: str, **kwargs):
53
44
  )
54
45
  elif type == "cerebras":
55
46
  return AuthenticatedLLM(
56
- model=f"cerebras/{model}",
57
- api_key="replaced",
58
- base_url=f"{url}/v1",
59
- **kwargs,
47
+ model=f"cerebras/{model}", api_key="replaced", base_url=f"{url}/v1", **kwargs
60
48
  )
61
49
  else:
62
50
  if type != "openai":
63
51
  logger.warning(f"Model {model} is not supported by CrewAI, defaulting to OpenAI")
64
52
  return AuthenticatedLLM(
65
- model=f"openai/{model}",
66
- api_key="replaced",
67
- base_url=f"{url}/v1",
68
- **kwargs,
53
+ model=f"openai/{model}", api_key="replaced", base_url=f"{url}/v1", **kwargs
69
54
  )
@@ -6,4 +6,4 @@ from .model import * # noqa: F403, F401
6
6
  from .tools import * # noqa: F403, F401
7
7
 
8
8
  if "GEMINI_API_KEY" not in os.environ:
9
- os.environ["GEMINI_API_KEY"] = "DUMMY_KEY"
9
+ os.environ["GEMINI_API_KEY"] = "DUMMY_KEY"
blaxel/googleadk/tools.py CHANGED
@@ -55,11 +55,13 @@ class GoogleADKTool(BaseTool):
55
55
  return function_decl
56
56
 
57
57
  @override
58
- async def run_async(self, *, args: dict[str, Any], tool_context: ToolContext) -> Any:
58
+ async def run_async(
59
+ self, *, args: dict[str, Any], tool_context: ToolContext
60
+ ) -> Any:
59
61
  args_to_call = args.copy()
60
62
  signature = inspect.signature(self._tool.coroutine)
61
- if "tool_context" in signature.parameters:
62
- args_to_call["tool_context"] = tool_context
63
+ if 'tool_context' in signature.parameters:
64
+ args_to_call['tool_context'] = tool_context
63
65
  return await self._tool.coroutine(**args_to_call) or {}
64
66
 
65
67