Skip to content

gRPC Base

Experimental — Not part of v1 launch scope

This base is available for advanced use and evaluation. For production deployments, use the MCP Server or REST API.

The gRPC base exposes G6Solver via a gRPC service, providing high-performance RPC access for polyglot environments and microservice architectures.


Overview

The gRPC base wraps G6 operations as RPC methods, callable from any gRPC client in any language. It uses grpcio with betterproto for proto generation.

python -m mvp.grpc

The server binds to port 50051 by default.

Architecture

The gRPC base follows G6's lazy-import pattern: grpcio is imported at module level inside a try/except, making the module fully importable and testable without the gRPC dependency installed.

Business logic is factored into pure-Python helper functions (_decompose_goal, _run_bayesian, etc.) that are tested directly without starting a gRPC server.

Service operations

The G6Servicer class exposes the following RPC methods:

Method Parameters Description
DecomposeGoal goal: str, max_depth: int Goal decomposition via GoalDecomposer
RunBayesian data: list, model_type: str Bayesian posterior inference
RunAutoML X: list, y: list, task: str Automated ML pipeline search
RecommendAlgo X: list, y: list, task: str Meta-learning algorithm recommendation
SystemStatus -- Service health and available tools
ListComponents -- List all registered components
Invoke component: str, op: str, params: dict Invoke any component
RunPipeline steps: list[dict], initial: dict Execute a multi-step pipeline

All methods return dicts with an ok: bool field and either result data or an error string.

GrpcServer class

The GrpcServer wrapper manages the gRPC server lifecycle:

from mvp.grpc.server import GrpcServer

server = GrpcServer(port=50051, max_workers=10)
server.start()
server.wait()   # blocks until terminated
server.stop()

max_workers controls the ThreadPoolExecutor thread count (default 10).

Deployment

# Local development
python -m mvp.grpc

# Docker
docker build -f bases/mvp/grpc/Dockerfile -t g6-grpc .
docker run -p 50051:50051 g6-grpc

Source files

File Purpose
bases/mvp/grpc/__init__.py Exports GrpcServer
bases/mvp/grpc/__main__.py Entry point
bases/mvp/grpc/server.py G6Servicer + GrpcServer + helper functions
bases/mvp/grpc/Dockerfile Container build

Proto definitions

The current implementation uses a minimal servicer without proto-generated stubs. In production, proto definitions would be generated via betterproto and registered with add_G6Servicer_to_server.

See also