TypeSafe preset
SetTYPESAFE_API_KEY, then use the bundled preset:
typesafe driver, https://api.typesafe.ai/v1/systemone, and the jev-latest model alias. Application Decision configuration lives under the sdm group:
DecisionConfig supports fromDefaults(), fromPreset(), presetNames(), fromArray(), fromDsn(), and immutable withOverrides(). Use toRedactedArray() rather than toArray() when configuration may reach logs or diagnostics.
driver, apiUrl, apiKey, endpoint, and model fields. The URL must be HTTP(S), and the endpoint must start with /.
Facade, provider, and runtime
Use the facade for ordinary calls:DecisionProvider when application composition needs reusable config overrides, a model override, or an explicit driver. Use DecisionRuntime when it needs an event root, HTTP client, driver registry, or retry-delay implementation.
withInput(), withQuestions(), withModel(), withRetryPolicy(), withRequest(), and the combined with() method return a copy.
Explicit requests
DecisionRequest is the provider-neutral execution input:
toArray() serializes only the portable payload: input, typed questions, and optional model. Request IDs, retry policy, and telemetry correlation are execution-envelope concerns and are intentionally not serialized. DecisionRequest::fromArray() restores the portable payload.
Retry policy
Decision performs one attempt unless a retry policy is supplied:408, 429, 500, 502, 503, 504, and 529, plus timeout and network failures. Bounded Retry-After is honored by default. The Decision execution session owns retries, so do not add HTTP retry middleware around the same operation.
Lifecycle events and telemetry
Register a specific listener or a wiretap onDecisionRuntime:
DecisionStartedfollowed byDecisionCompletedorDecisionFailedDecisionAttemptStartedfollowed byDecisionAttemptSucceededorDecisionAttemptFailed
sdm.decision span with sdm.decision.attempt children. Default event and telemetry attributes omit input state, instructions, criteria, provider bodies, credentials, and exception messages.
Custom drivers
A custom provider driver implementsCanProcessDecisionRequest::handle(DecisionRequest): DecisionResponse. Register a class string or factory in DecisionDriverRegistry, then pass the registry to Decision::using(), Decision::fromConfig(), or DecisionRuntime::fromConfig():
DecisionConfig, CanSendHttpRequests, and the event dispatcher. A factory receives the same three arguments. Provider adapters should translate between the stable DecisionRequest/DecisionResponse domain and the provider wire format; application code should not depend on the adapter classes.