feat(sam3): enable SDK-based remote execution for SAM3 workflow blocks#2042
Merged
feat(sam3): enable SDK-based remote execution for SAM3 workflow blocks#2042
Conversation
SAM3 workflow blocks previously always used the API inference proxy for remote execution, regardless of configuration. This change decouples the workflow step execution mode from SAM3_EXEC_MODE, enabling SAM3 blocks to use the standard SDK-based remote execution pattern used by all other model blocks when WORKFLOWS_STEP_EXECUTION_MODE=remote. Also adds SAM3 SDK client methods (concept_segment, visual_segment, embed_image) and a new SAM3_FINE_TUNED_MODELS_ENABLED env var to control fine-tuned model access independently of execution mode. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
PawelPeczek-Roboflow
previously approved these changes
Feb 26, 2026
PawelPeczek-Roboflow
approved these changes
Feb 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
HOSTED_*_URLendpoints. Now whenWORKFLOWS_STEP_EXECUTION_MODE=remoteandSAM3_EXEC_MODE=local, SAM3 blocks use the standard SDK-based remote execution pattern viaHOSTED_CORE_MODEL_URL, matching the behavior of object detection, classification, instance segmentation, CLIP, OCR, and SAM3 3D blocks.sam3_concept_segment,sam3_visual_segment,sam3_embed_image(sync + async) toInferenceHTTPClient, following the established_post_imagespattern used bysam2_segment_image,infer_lmm, etc. This ensures properexecution_idpropagation andX-Processing-Timeheader collection via the standardRemoteProcessingTimeCollectormechanism.SAM3_FINE_TUNED_MODELS_ENABLEDenv var to control whether fine-tuned SAM3 models are allowed, independent ofSAM3_EXEC_MODE. Default is derived fromSAM3_EXEC_MODEfor full backward compatibility (False when remote, True when local) — existing deployments require no config changes.Execution mode matrix
SAM3_EXEC_MODEWORKFLOWS_STEP_EXECUTION_MODEremotelocallocallocalremoteHOSTED_CORE_MODEL_URLFiles changed
inference/core/env.pySAM3_FINE_TUNED_MODELS_ENABLEDinference/core/interfaces/http/http_api.pySAM3_EXEC_MODEinference_sdk/http/client.pysegment_anything3/v1.pyrun_remotely()segment_anything3/v2.pyrun_remotely()segment_anything3/v3.pyrun_remotely()Test plan
SAM3_EXEC_MODE=remotestill routes through inference proxy (backward compat)SAM3_EXEC_MODE=local+WORKFLOWS_STEP_EXECUTION_MODE=localruns locally (unchanged)SAM3_EXEC_MODE=local+WORKFLOWS_STEP_EXECUTION_MODE=remoteuses SDK client withHOSTED_CORE_MODEL_URLSAM3_FINE_TUNED_MODELS_ENABLED=falseblocks non-sam3/model IDs on/sam3/concept_segmentSAM3_FINE_TUNED_MODELS_ENABLEDdefaults tofalsewhenSAM3_EXEC_MODE=remote(no config change needed for existing deployments)X-Processing-Timeheader when using SDK path🤖 Generated with Claude Code