# RemoteAgent

> **Class** in `deepagents_cli`

📖 [View in docs](https://reference.langchain.com/python/deepagents-cli/remote_client/RemoteAgent)

Client that talks to a LangGraph server over HTTP+SSE.

Wraps `langgraph.pregel.remote.RemoteGraph` which handles SSE parsing,
stream-mode negotiation (`messages-tuple`), namespace extraction, and
interrupt detection. This class adds only message-object conversion for the
Textual adapter and thread-ID normalization.

## Signature

```python
RemoteAgent(
    self,
    url: str,
    *,
    graph_name: str = 'agent',
    api_key: str | None = None,
    headers: dict[str, str] | None = None,
)
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `url` | `str` | Yes | Base URL of the LangGraph server. |
| `graph_name` | `str` | No | Name of the graph on the server. (default: `'agent'`) |
| `api_key` | `str \| None` | No | API key for authenticated deployments.  When `None`, `RemoteGraph` auto-reads `LANGGRAPH_API_KEY`, `LANGSMITH_API_KEY`, or `LANGCHAIN_API_KEY` from the environment. (default: `None`) |
| `headers` | `dict[str, str] \| None` | No | Extra HTTP headers to include in every request (e.g. bearer tokens, proxy headers). (default: `None`) |

## Constructors

```python
__init__(
    self,
    url: str,
    *,
    graph_name: str = 'agent',
    api_key: str | None = None,
    headers: dict[str, str] | None = None,
) -> None
```

| Name | Type |
|------|------|
| `url` | `str` |
| `graph_name` | `str` |
| `api_key` | `str \| None` |
| `headers` | `dict[str, str] \| None` |


## Methods

- [`astream()`](https://reference.langchain.com/python/deepagents-cli/remote_client/RemoteAgent/astream)
- [`aget_state()`](https://reference.langchain.com/python/deepagents-cli/remote_client/RemoteAgent/aget_state)
- [`aupdate_state()`](https://reference.langchain.com/python/deepagents-cli/remote_client/RemoteAgent/aupdate_state)
- [`aensure_thread()`](https://reference.langchain.com/python/deepagents-cli/remote_client/RemoteAgent/aensure_thread)
- [`with_config()`](https://reference.langchain.com/python/deepagents-cli/remote_client/RemoteAgent/with_config)

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/b710a69b12e49479045eaa54dfb709326473500b/libs/cli/deepagents_cli/remote_client.py#L42)