Skip to content

Migrate Edge Configuration to SDK#413

Open
timmarkhuff wants to merge 2 commits intomainfrom
tim/edge-config
Open

Migrate Edge Configuration to SDK#413
timmarkhuff wants to merge 2 commits intomainfrom
tim/edge-config

Conversation

@timmarkhuff
Copy link
Contributor

@timmarkhuff timmarkhuff commented Mar 12, 2026

Moves the edge endpoint config schema from edge-endpoint into the Python SDK so that users can programmatically build and validate edge configurations.

What's new

  • groundlight.edge submodule with Pydantic models ported from edge-endpoint/app/core/configs.py:
    • EdgeEndpointConfig (renamed from RootEdgeConfig) -- top-level config with add_detector() for ergonomic construction
    • EdgeInferenceConfig -- per-detector inference behavior (frozen/immutable)
    • GlobalConfig, DetectorConfig -- supporting models
  • Preset constants matching the standard edge-endpoint defaults: DEFAULT, EDGE_ANSWERS_WITH_ESCALATION, NO_CLOUD, DISABLED
  • All validation from the original (disable_cloud_escalation requires always_return_edge_prediction, duplicate detector ID checks, inference config cross-references) is preserved

Usage

from groundlight.edge import EdgeEndpointConfig, NO_CLOUD, DEFAULT

config = EdgeEndpointConfig()
config.add_detector("det_abc123", NO_CLOUD)
config.add_detector(some_detector_object, DEFAULT)

print(config.model_dump_json(indent=2))

Design decisions

  • EdgeInferenceConfig is frozen to prevent accidental mutation of shared presets
  • add_detector() accepts a detector ID string or a Detector object (matching SDK conventions like submit_image_query)
  • Inference configs are auto-registered on first use via add_detector() -- no separate registration step needed
  • Serialization matches the existing YAML format used by edge-endpoint (detectors is a list, edge_inference_configs is a dict keyed by name)
  • The name field on EdgeInferenceConfig is excluded from serialization (it serves as the dict key)

Follow-up work

  • Update edge-endpoint to import these models from the SDK instead of defining them locally
  • Add SDK methods to push an EdgeEndpointConfig to a running edge endpoint

@@ -0,0 +1,41 @@
"""Example of constructing an edge endpoint configuration programmatically."""
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is temporary, I'll get rid of this before merging.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting rid of it is too easy, grab the most important snippets and put them in docs in a md file, we auto push those to a webpage

Copy link
Collaborator

@brandon-wada brandon-wada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good so far, we should discuss more what the calls to update the config on the remote machine should look like

@@ -0,0 +1,41 @@
"""Example of constructing an edge endpoint configuration programmatically."""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting rid of it is too easy, grab the most important snippets and put them in docs in a md file, we auto push those to a webpage

RootEdgeConfig,
)

__all__ = [
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit, this is a little redundant since it includes all objects that could be importet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants