langchain-ai/deepagents · error
Failed to get run status: {e}
Error message
Failed to get run status: {e} What it means
check_async_task wraps client creation and the runs.get status call in a broad except and returns this message string instead of raising, so the calling agent sees a friendly failure. Any error from get_sync (e.g. missing url) or from the LangGraph SDK while fetching run status surfaces as this text.
Source
Thrown at libs/deepagents/deepagents/middleware/async_subagents.py:423
def _build_check_tool( # noqa: C901 # complexity from necessary error handling
clients: _ClientCache,
) -> StructuredTool:
"""Build the `check_async_task` tool."""
def check_async_task(
task_id: str,
runtime: ToolRuntime,
) -> str | Command:
task = _resolve_tracked_task(task_id, runtime)
if isinstance(task, str):
return task
try:
client = clients.get_sync(task["agent_name"])
run = client.runs.get(thread_id=task["thread_id"], run_id=task["run_id"])
except Exception as e: # noqa: BLE001 # get_sync() may raise ValueError; SDK raises untyped errors
return f"Failed to get run status: {e}"
thread_values: dict[str, Any] = {}
if run["status"] == "success":
try:
thread = client.threads.get(thread_id=task["thread_id"])
thread_values = thread.get("values") or {}
except Exception as e: # noqa: BLE001 # LangGraph SDK raises untyped errors
logger.warning("Failed to fetch thread values for task %s: %s", task["task_id"], e)
result = _build_check_result(run, task["thread_id"], thread_values)
return _build_check_command(result, task, runtime.tool_call_id)
async def acheck_async_task(
task_id: str,
runtime: ToolRuntime,
) -> str | Command:
task = _resolve_tracked_task(task_id, runtime)View on GitHub (pinned to a1af029e6e)
Solutions
- Check the subagent 'url' is set and the server is reachable
- Read the embedded exception in the returned message and fix the underlying cause (auth, network, IDs)
- Use async invocation paths that support ASGI transport when subagents have no url
Defensive patterns
Strategy: try-catch
Validate before calling
if subagent_spec.get("url") is None:
# avoid sync status path for ASGI subagents
use_async_status_check = True Try / catch
try:
client = clients.get_sync(task["agent_name"])
run = client.runs.get(thread_id=task["thread_id"], run_id=task["run_id"])
except Exception as e:
logger.warning("run status fetch failed: %s", e)
return None Prevention
- Keep the subagent server reachable and monitored
- Validate thread_id/run_id before polling
- Treat returned failure strings as signals to check connectivity/auth
When it happens
Trigger: Polling an async task whose subagent has no url (get_sync ValueError); network/auth failure or invalid thread_id/run_id when calling client.runs.get; SDK raising untyped errors.
Common situations: Subagent server restarted or unreachable mid-run; task record references a thread/run that was deleted; spec misconfiguration (url=None) discovered lazily at poll time.
Related errors
- Failed to cancel run: {e}
- Failed while waiting for Vercel sandbox startup.
- StateBackend must be used inside a LangGraph graph execution
- StateBackend requires CONFIG_KEY_READ / CONFIG_KEY_SEND in t
- Async subagent '{name}' has no url configured. ASGI transpor
AI-assisted analysis of langchain-ai/deepagents@a1af029e6e (2026-08-29).
Data as JSON: /api/errors/f3a2f3290b5d336f.
Report an issue: GitHub.