dynamo/lib/bindings/python/examples/kserve_grpc_service
Anant Sharma 3cebc864f3
feat: split monolithic requirements.txt and remove test deps from runtime image (#6656)
Signed-off-by: Anant Sharma <anants@nvidia.com>
2026-03-10 20:05:12 +00:00
..
README.md feat: python binding for kserve grpc frontend (#3739) 2025-10-24 11:20:20 -07:00
grpcurl.sh chore: update all copyright headers in repo to 2026 (#5130) 2026-01-02 22:08:23 +00:00
server.py feat: Remove public uses of CancellationToken (#6405) 2026-02-20 21:01:13 -08:00
test_client.py feat: split monolithic requirements.txt and remove test deps from runtime image (#6656) 2026-03-10 20:05:12 +00:00

README.md

KServe gRPC Example

This directory contains a minimal Dynamo worker that serves a KServe-compatible gRPC endpoint (server.py) and a Python client (test_client.py) that exercises the endpoint using the Triton tritonclient.grpc API.

Prerequisites

  • The Dynamo Python bindings installed
  • Client dependencies:
    • numpy
    • tritonclient[grpc]

You can install the Python dependencies into your active environment with:

uv pip install numpy tritonclient[grpc]

Running the mock server

  1. From the repository root, set PYTHONPATH so Python can locate the local Dynamo package:

    export PYTHONPATH=$(pwd)
    
  2. Start the worker:

    python lib/bindings/python/examples/kserve_grpc_service/server.py
    

    The server registers a mock completions model named mock_model and listens on 0.0.0.0:8787. Leave this process running while you test the endpoint.

Sending a request with the Triton client

With the server running, invoke the example client from a separate terminal:

python lib/bindings/python/examples/kserve_grpc_service/test_client.py \
  --model mock_model \
  --prompt "Hello from Dynamo!"

You can override the --host, --port, and --prompt options as needed. The script sends an inference request over gRPC using the InferenceServerClient and prints the decoded ModelInferResponse payload. You should see the prompt Hello from Dynamo! successfully received and printed by the server.

Alternative tooling

For debugging purposes you can still call the endpoint directly with grpcurl by running grpcurl.sh in this directory.