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.
RemoteAgent(
self,
url: str,
*,
graph_name: str = 'agent',
api_key: str | None = None,
headers: dict[str, str] | None = None
)| Name | Type | Description |
|---|---|---|
url* | str | Base URL of the LangGraph server. |
graph_name | str | Default: 'agent'Name of the graph on the server. |
api_key | str | None | Default: NoneAPI key for authenticated deployments. When |
headers | dict[str, str] | None | Default: NoneExtra HTTP headers to include in every request (e.g. bearer tokens, proxy headers). |
Stream agent execution, yielding tuples matching Pregel's format.
Delegates to RemoteGraph.astream (which handles messages-tuple
negotiation, SSE routing, and namespace parsing) and converts the raw
message dicts into LangChain message objects for the adapter.
Get the current state of a thread.
Returns None when the thread does not exist on the server (404).
All other errors (network, auth, 500) are logged at WARNING and
re-raised so callers can handle them.
Update the state of a thread.
Exceptions from the underlying graph (server/network errors) are logged at WARNING level and then re-raised so callers can handle them.
Ensure the remote thread record exists before mutating state.
In the LangGraph dev server, checkpoint persistence and HTTP thread
registration are separate. After a server restart, a thread may still
have checkpointed state on disk while POST /threads/{id}/state
returns 404 because the server has not yet materialized that thread in
its live store.
This method performs the idempotent HTTP-side registration with
if_exists='do_nothing' so callers that recovered state from
persistence can safely follow up with aupdate_state.
Return self (config is passed per-call, not stored).