INNER CODE UNIT · Python

wait_for_text

deeplethe/forkd · sdk/mcp/sandstorm_mcp/server.py:240

def wait_for_text(
    sandbox_id: str,
    path: str,
    marker: str,
    timeout_secs: float = 60,
    poll_interval_ms: int = 200,
    sandbox_token: str | None = None,
) -> dict[str, Any]:
    """Poll a file inside a sandbox until it contains a marker string.

    Common pattern: agent writes its progress to a stdout log inside
    the guest; the orchestrator (you, the MCP client) polls until a
    marker like "READY_TO_BRANCH" appears, then triggers branch.
    Avoids busy-waiting from outside the master's exec round-trip.

    Args:
        sandbox_id: Target sandbox.
        path: Absolute path inside the guest of the file to poll.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…