# agent_error_type

> **Function** in `deepagents_code`

📖 [View in docs](https://reference.langchain.com/python/deepagents-code/client/remote_client/agent_error_type)

Best-effort error-type name for an exception from `RemoteAgent.astream`.

The LangGraph server serializes non-allowlisted exceptions as
`{"error": <ExceptionType>, "message": ...}` wrapped in
`RemoteException(payload)` (see `langgraph_api.serde`). The server-reported
`"error"` type is the authoritative name when present; otherwise the
exception's own class name is used. This is the single source of truth for
"what error did the stream report" — both `format_agent_exception` (display
string) and the UI's error-enrichment path (error-type dispatch) read it.

## Signature

```python
agent_error_type(
    exc: BaseException,
) -> str
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `exc` | `BaseException` | Yes | The exception caught from the agent stream. |

## Returns

`str`

The serialized error type from a `RemoteException` dict payload, else

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/7794b61a6e76230e8c7a49bdce808b3728305914/libs/code/deepagents_code/client/remote_client.py#L49)