Vega SDK — Configuration & Identity API

Configuration and Identity API

Namespaced configuration views, opaque secrets, robot identity facts, and the initialization context delivered to Provider.initialize.

Import

python
from vega_capability_sdk import (
ProviderConfigurationView,
ProviderInitializationContext,
ProviderRobotIdentityView,
SecretAccessor,
SecretValue,
)

ProviderConfigurationView

python
@dataclass(frozen=True, slots=True)
class ProviderConfigurationView:
values: Mapping[str, Any]
revision: int = 1
TermMeaning
get(key, default=None)Returns the configuration value or default.
require(key, expected_type)Returns the value if present and isinstance-typed; otherwise raises KeyError or TypeError.
as_mapping()Returns the underlying read-only mapping.

SecretValue

Opaque wrapper around a secret string. Formatting and string representation return**redacted**. Marks itself with __vega_secret__ = True, which the SDK logger's redaction function recognizes.

TermMeaning
get_secret_value()Returns the raw secret. Do not log, serialize, or add to diagnostics.
__bool__True when the raw secret is non-empty.
__iter__Raises TypeError.
The wrapper does not make a raw value safe after get_secret_value() is called.

SecretAccessor

python
class SecretAccessor:
def __init__(self, secrets: Mapping[str, str] | None = None) -> None: ...
def get(self, name: str) -> SecretValue: ...
def contains(self, name: str) -> bool: ...

ProviderRobotIdentityView

python
@dataclass(frozen=True, slots=True)
class ProviderRobotIdentityView:
installation_id: str
robot_id: str
manufacturer: str
model: str
model_variant: str | None
robot_type: str
compute_architecture: str
operating_system: str
ros_distribution: str | None
compute_platform: str | None

ProviderInitializationContext

python
@dataclass(frozen=True, slots=True)
class ProviderInitializationContext:
capability_id: str
provider_id: str
robot_identity: ProviderRobotIdentityView
configuration: ProviderConfigurationView
secrets: SecretAccessor
metadata: Mapping[str, Any] | None = None
logger: StructuredLogger = StructuredLogger()
clock: Clock = SystemClock()
artifacts: ArtifactService | None = None

Example

python
async def on_initialize(self, context: ProviderInitializationContext) -> None:
endpoint = context.configuration.require("endpoint", str)
token = context.secrets.get("service_token")
self._client = Client(endpoint, token.get_secret_value())