Skip to main content
Glama

ShallowCodeResearch_get_sandbox_pool_status_sync

Check sandbox pool status synchronously to monitor available resources for research workflows.

Instructions

Synchronous wrapper for sandbox pool status.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • app.py:510-516 (handler)
    Synchronous handler function that runs the async sandbox pool status checker using asyncio.run. This is the direct entry point matching the tool name pattern.
    def get_sandbox_pool_status_sync() -> Dict[str, Any]:
        """Synchronous wrapper for sandbox pool status."""
        try:
            import asyncio
            return asyncio.run(get_sandbox_pool_status())
        except Exception as e:
            return {"error": f"Failed to get sandbox pool status: {str(e)}"}
  • app.py:475-508 (handler)
    Core async implementation that instantiates CodeRunnerAgent, fetches pool stats, computes readiness status, and formats the response with user-friendly messages.
    async def get_sandbox_pool_status() -> Dict[str, Any]:
        """Get sandbox pool status and statistics."""
        try:
            # Create a temporary code runner to get pool stats
            code_runner = CodeRunnerAgent()
            stats = await code_runner.get_pool_stats()
            
            # Add warmup status information
            pool_size = stats.get("pool_size", 0)
            target_size = stats.get("target_pool_size", 0)
            
            if pool_size == 0:
                status_message = "🔄 Sandbox environment is warming up... This may take up to 2 minutes for the first execution."
                status = "warming_up"
            elif pool_size < target_size:
                status_message = f"âš¡ Sandbox pool partially ready ({pool_size}/{target_size} sandboxes). More sandboxes warming up..."
                status = "partially_ready"
            else:
                status_message = f"✅ Sandbox pool fully ready ({pool_size}/{target_size} sandboxes available)"
                status = "ready"
            
            return {
                "status": status,
                "sandbox_pool": stats,
                "message": status_message,
                "user_message": status_message
            }
        except Exception as e:
            return {
                "status": "error",
                "error": f"Failed to get sandbox pool status: {str(e)}",
                "message": "Sandbox pool may not be initialized yet",
                "user_message": "🔄 Code execution environment is starting up... Please wait a moment."
            }
  • app.py:1085-1090 (registration)
    Gradio interface registration exposing the handler as an API/MCP tool via api_name when launched with mcp_server=True.
    sandbox_btn.click(
        fn=get_sandbox_pool_status_sync,
        inputs=[],
        outputs=sandbox_output,
        api_name="get_sandbox_pool_status_service"
    )
  • Delegation method in CodeRunnerAgent that forwards the stats request to the underlying WarmSandboxPool.
    async def get_pool_stats(self):
        """Get sandbox pool statistics."""
        if self.sandbox_pool:
            return self.sandbox_pool.get_stats()
        return {"error": "Pool not initialized"}
  • Fundamental stats computation in WarmSandboxPool class providing pool size, target size, health status, failure counts, and other metrics used throughout the chain.
    def get_stats(self) -> Dict[str, Any]:
        """Get pool statistics including health metrics."""
        return {
            **self._stats,
            "pool_size": self._sandbox_queue.qsize(),
            "target_pool_size": self.pool_size,
            "running": self._running,
            "consecutive_failures": self._consecutive_failures,
            "last_successful_creation": self._last_successful_creation,
            "time_since_last_success": time.time() - self._last_successful_creation,
            "health_status": "healthy" if self._consecutive_failures < 3 else "degraded" if self._consecutive_failures < self._pool_reset_threshold else "critical"
        }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It mentions 'synchronous wrapper' which implies blocking behavior and possibly that there's an asynchronous version, but doesn't disclose what 'sandbox pool' means, what status information is returned, whether this requires permissions, or any rate limits. For a status-checking tool with zero annotation coverage, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste. It's appropriately sized for a no-parameter tool and front-loads the essential information (synchronous wrapper for sandbox pool status). Every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's apparent purpose (checking system status) with no annotations and no output schema, the description is incomplete. It doesn't explain what 'sandbox pool' is, what status information is returned, or why this check matters. For a status tool that likely returns important system information, this leaves too many unanswered questions about what the agent can expect.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0 parameters and 100% schema description coverage, the baseline is 4. The description doesn't need to explain parameters since none exist, and it correctly doesn't attempt to describe non-existent parameters. No additional parameter semantics are needed or provided.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states it's a 'synchronous wrapper for sandbox pool status', which provides a basic purpose (checking status) but lacks specificity about what 'sandbox pool' refers to or what status information is returned. It distinguishes from most siblings by focusing on status rather than agent tasks or other system checks, but doesn't clearly differentiate from similar status-checking tools like get_cache_status or get_health_status.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided about when to use this tool versus alternatives. The description doesn't mention when this status check is needed, what triggers its use, or how it differs from other status-checking siblings like get_cache_status or get_health_status. The agent receives no usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/CodeHalwell/gradio-mcp-agent-hack'

If you have feedback or need assistance with the MCP directory API, please join our Discord server