Skip to content

Python and JavaScript clients

warpra-server is tested with the official Python client package langgraph_sdk. Point the client at your server URL and pass an API key.

Tested versions: langgraph-sdk 0.4.14, and langgraph 1.2.24 for RemoteGraph.

pip install langgraph-sdk==0.4.14

From JavaScript or any other language, call Warpra’s HTTP API (assistants, threads, runs, crons, store) directly with an HTTP client. See What it serves.

Run the echo server from the overview, or the warpra-server binary with a warpra.json. With the Docker setup in Deployment, the server is on http://127.0.0.1:8123.

The examples below assume the echo server on the default port 8000, with this key:

export WARPRA_API_KEYS=dev-key-0123456789abcdefghij

The client sends the key as x-api-key. Pass it as api_key, or set LANGGRAPH_API_KEY and the client reads it itself.

from langgraph_sdk import get_sync_client
client = get_sync_client(url="http://127.0.0.1:8000", api_key="dev-key-0123456789abcdefghij")
# stateless run
print(client.runs.wait(None, "echo", input={"text": "hi"})) # {'text': 'hi echoed'}
# stateful run on a thread
thread = client.threads.create()
client.runs.wait(thread["thread_id"], "echo", input={"text": "hello"})
print(client.threads.get_state(thread["thread_id"])["values"])

The async client is get_client(url=...). Assistants, threads, runs, crons and the store all work, within the gaps.

RemoteGraph runs a server graph as if it were local, and can be a node in a local Python graph.

import uuid
from langgraph.pregel.remote import RemoteGraph
remote = RemoteGraph("echo", url="http://127.0.0.1:8000", api_key="dev-key-0123456789abcdefghij")
config = {"configurable": {"thread_id": str(uuid.uuid4())}} # must be a UUID
print(remote.invoke({"text": "hi"}, config))

Thread ids must be UUIDs. A thread id such as "1" returns 422 invalid_uuid.

Tested through RemoteGraph: invoke, stream, state, history, update_state, get_graph(xray), resume, version="v2", and use as a node, including Command(graph=PARENT) and interrupts resumed by id.

When RemoteGraph is a node of a local graph, resume remote interrupts by interrupt id. A plain Command(resume=value) in the parent is not forwarded, so the remote interrupt fires again.

State values are stored as native messages (role, content, tool_calls with arguments). By default, the server converts them to client message dicts on the way out (type: human | ai | system | tool, tool_calls with args). Messages in that shape in the input are converted back. OpenAI-style {"role": "user", "content": ".."} input passes through unchanged. Set wire_messages to native per graph to turn conversion off.

  • client.threads.stream() and RemoteGraph.stream_events(version="v3"): the v3 protocol answers 501. Use client.runs.stream(...), which supports every mode below.
  • WebSocket transport: 501.
  • stream_mode="events" and "lifecycle": 422.

Supported modes: values, updates, messages, messages-tuple, custom, checkpoints, tasks, debug, tools, in v1 and version="v2".

The server is tested with the Python client and RemoteGraph on the memory and Postgres backends: 58 tests of our own covering assistants, threads, state and history, runs, crons and the store, every supported stream mode with v1 and v2, resumable join_stream(last_event_id=...), wait with interrupt_before and raise_error, plus the client package’s own integration tests for runs, assistants, crons, the store and threads.

Warpra is open source under Apache-2.0. Made by Liceron.