{"record":{"id":"68c7576ae32bef53","repo":"sgl-project/sglang","slug":"action-endpoint-is-not-implemented-for-sampling-p","errorCode":null,"errorMessage":"Action endpoint is not implemented for {sampling_params_cls.__name__}","messagePattern":"Action endpoint is not implemented for (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":400,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/entrypoints/action/protocol.py","lineNumber":409,"sourceCode":"def build_action_sampling_params(\n    payload: dict[str, Any],\n    server_args: ServerArgs,\n) -> SamplingParams | ActionSamplingParams:\n    sampling_params_cls = _resolve_action_sampling_params_cls(server_args)\n    if issubclass(sampling_params_cls, ActionSamplingParams):\n        return _build_action_model_sampling_params(\n            payload,\n            server_args,\n            sampling_params_cls,\n        )\n    if issubclass(sampling_params_cls, Cosmos3SamplingParams):\n        return build_cosmos3_action_sampling_params(\n            payload,\n            _action_request_to_observation(payload),\n            server_args,\n            sampling_params_cls,\n        )\n    raise ValueError(\n        f\"Action endpoint is not implemented for {sampling_params_cls.__name__}\"\n    )\n\n\nasync def infer_action(\n    payload: dict[str, Any],\n    server_args: ServerArgs,\n) -> dict[str, Any]:\n    sp = build_action_sampling_params(payload, server_args)\n    req = prepare_request(server_args, sp)\n    response = await async_scheduler_client.forward(req)\n    if getattr(response, \"error\", None):\n        raise RuntimeError(response.error)\n    if response.output is None:\n        raise RuntimeError(\"action policy returned no output\")\n    return response.output[0]\n\n","sourceCodeStart":391,"sourceCodeEnd":427,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/entrypoints/action/protocol.py#L391-L427","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Send /v1/actions requests to a server instance running Cosmos3","If adding support for a new model, extend build_action_sampling_params with a builder branch for its sampling params class","For non-action inference use the appropriate endpoint (/v1/videos, /v1/chat/completions)"],"exampleFix":"# before\n# server running a video model, POST /v1/actions\n# after\npython -m sglang.launch_server ... --model nvidia/Cosmos-Transfer-... # then POST /v1/actions","handlingStrategy":"fallback","validationCode":"SUPPORTED = {'Cosmos3SamplingParams'}  # extend as new action models land\nif cls.__name__ not in SUPPORTED:\n    route_to = '/v1/videos' if is_video_model(cls) else '/v1/chat/completions'","typeGuard":null,"tryCatchPattern":"try:\n    resp = await infer_action(payload, ...)\nexcept ValueError as e:\n    if 'not implemented' in str(e):\n        # fall back to the appropriate non-action endpoint or another server\n        ...","preventionTips":["Route /v1/actions traffic only to Cosmos3-serving instances","Register a builder branch when adding action support for new models"],"tags":["action-endpoint","not-implemented","model-support","dispatch"],"backgroundTag":"unsupported-model-feature","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}