Skip to main content

Overview

The server-client architecture enables distributed inference where the GR00T model runs on a GPU server and clients connect remotely to query actions. This is useful for:
  • Running inference on a remote GPU while controlling robots locally
  • Sharing a single model across multiple robot instances
  • Separating model execution from environment simulation

PolicyServer

Class definition

gr00t/policy/server_client.py

Constructor

BasePolicy
required
The policy instance to serve (e.g., Gr00tPolicy or Gr00tSimPolicyWrapper)
str
default:"*"
Host address to bind to. Use "*" to listen on all interfaces, or "localhost" for local-only access
int
default:"5555"
Port number to listen on
str | None
default:"None"
Optional API token for authentication (currently not enforced)

Methods

register_endpoint

Register a custom endpoint to the server.
str
required
The name of the endpoint (e.g., "get_action", "reset")
Callable
required
The handler function that will be called when the endpoint is hit
bool
default:"True"
Whether the handler requires input data

run

Start the server and listen for requests.
This method runs an infinite loop until the server is killed via the "kill" endpoint.

Default endpoints

The server automatically registers these endpoints:
GET
Health check endpoint that returns {"status": "ok", "message": "Server is running"}
POST
Gracefully shutdown the server
POST
Generate actions from observations. Calls policy.get_action(observation, options)
POST
Reset the policy state. Calls policy.reset(options)
GET
Get modality configurations. Calls policy.get_modality_config()

Usage example

Or use the provided script:

PolicyClient

Class definition

gr00t/policy/server_client.py

Constructor

str
default:"localhost"
Hostname or IP address of the policy server
int
default:"5555"
Port number of the policy server
str | None
default:"None"
Optional API token for authentication
bool
default:"True"
Whether to enforce strict validation (passed to the remote policy)

Methods

ping

Check if the server is reachable.
bool
True if the server responds to ping, False otherwise

get_action

Generate actions from observations via the remote server.
dict[str, Any]
required
Observation dictionary (format depends on the server’s policy type)
dict[str, Any] | None
Optional parameters
dict[str, np.ndarray]
Dictionary of action arrays
dict[str, Any]
Additional information

reset

Reset the remote policy.
dict[str, Any] | None
Optional reset parameters (e.g., {"episode_index": 5} for ReplayPolicy)
dict[str, Any]
Information dictionary

get_modality_config

Get modality configurations from the remote server.
dict[str, ModalityConfig]
Modality configurations

send_request

Send a custom request to the server.
str
required
The endpoint name (e.g., "get_action", "ping")
Any
Data to send with the request
Any
Response from the server

Usage example

MsgSerializer

Internal serialization class for encoding/decoding messages over the network.
gr00t/policy/server_client.py
The serializer automatically handles numpy arrays and ModalityConfig objects. Custom classes can be supported by extending encode_custom_classes and decode_custom_classes.

Network protocol

The server uses ZeroMQ (REP socket) with msgpack serialization:
  1. Client sends request: {"endpoint": "get_action", "data": {...}}
  2. Server processes request and calls the appropriate handler
  3. Server sends response: {"status": "success", "data": {...}} or {"status": "error", "error": "..."}
  4. Client receives and deserializes response

Error handling

Server-side errors are caught and returned to the client:
Client-side:

Performance considerations

Network latency: Each get_action call requires a round-trip to the server. For high-frequency control, consider:
  • Running the server on the same local network
  • Using action chunking to reduce query frequency
  • Batching multiple queries if your environment supports it
Multi-GPU serving: You can run multiple policy servers on different GPUs and load-balance clients across them for higher throughput.

See also

Server-client guide

Complete deployment guide

run_gr00t_server.py

Server launch script reference

Gr00tPolicy

Core policy class

Policy API guide

Using the policy API