sgl-project/sglang · error · ValueError

Action endpoint is not implemented for {sampling_params_cls.

Error message

Action endpoint is not implemented for {sampling_params_cls.__name__}

What it means

build_action_sampling_params dispatches per model: only Cosmos3 (and models routed through the generic path) have an action implementation. If the resolved sampling-params class is a known class without a Cosmos3-style builder, the endpoint raises 'not implemented for <ClassName>'. This is the final catch-all after Cosmos3 dispatch fails to match.

Source

Thrown at python/sglang/multimodal_gen/runtime/entrypoints/action/protocol.py:409

def build_action_sampling_params(
    payload: dict[str, Any],
    server_args: ServerArgs,
) -> SamplingParams | ActionSamplingParams:
    sampling_params_cls = _resolve_action_sampling_params_cls(server_args)
    if issubclass(sampling_params_cls, ActionSamplingParams):
        return _build_action_model_sampling_params(
            payload,
            server_args,
            sampling_params_cls,
        )
    if issubclass(sampling_params_cls, Cosmos3SamplingParams):
        return build_cosmos3_action_sampling_params(
            payload,
            _action_request_to_observation(payload),
            server_args,
            sampling_params_cls,
        )
    raise ValueError(
        f"Action endpoint is not implemented for {sampling_params_cls.__name__}"
    )


async def infer_action(
    payload: dict[str, Any],
    server_args: ServerArgs,
) -> dict[str, Any]:
    sp = build_action_sampling_params(payload, server_args)
    req = prepare_request(server_args, sp)
    response = await async_scheduler_client.forward(req)
    if getattr(response, "error", None):
        raise RuntimeError(response.error)
    if response.output is None:
        raise RuntimeError("action policy returned no output")
    return response.output[0]

View on GitHub (pinned to 0132848349)

Solutions

  1. Send /v1/actions requests to a server instance running Cosmos3
  2. If adding support for a new model, extend build_action_sampling_params with a builder branch for its sampling params class
  3. For non-action inference use the appropriate endpoint (/v1/videos, /v1/chat/completions)

Example fix

# before
# server running a video model, POST /v1/actions
# after
python -m sglang.launch_server ... --model nvidia/Cosmos-Transfer-... # then POST /v1/actions
Defensive patterns

Strategy: fallback

Validate before calling

SUPPORTED = {'Cosmos3SamplingParams'}  # extend as new action models land
if cls.__name__ not in SUPPORTED:
    route_to = '/v1/videos' if is_video_model(cls) else '/v1/chat/completions'

Try / catch

try:
    resp = await infer_action(payload, ...)
except ValueError as e:
    if 'not implemented' in str(e):
        # fall back to the appropriate non-action endpoint or another server
        ...

Prevention

When it happens

Trigger: POSTing /v1/actions against a server running a model whose sampling params class is supported (subclass check passed) but has no action builder registered — e.g. a video-generation params class.

Common situations: Using the unified gateway where /v1/actions is only wired for Cosmos3; adding a new action model without registering a builder in build_action_sampling_params; routing default model traffic to the action endpoint.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/68c7576ae32bef53. Report an issue: GitHub.