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
| Term | Meaning |
|---|---|
| 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.
| Term | Meaning |
|---|---|
| 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: strrobot_id: strmanufacturer: strmodel: strmodel_variant: str | Nonerobot_type: strcompute_architecture: stroperating_system: strros_distribution: str | Nonecompute_platform: str | None
ProviderInitializationContext
python
@dataclass(frozen=True, slots=True)class ProviderInitializationContext:capability_id: strprovider_id: strrobot_identity: ProviderRobotIdentityViewconfiguration: ProviderConfigurationViewsecrets: SecretAccessormetadata: Mapping[str, Any] | None = Nonelogger: 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())
