fastModeUnavailableReason property
String?
get
fastModeUnavailableReason
Get the reason fast mode is unavailable, or null if it's available.
Implementation
String? get fastModeUnavailableReason {
if (_config.getApiProvider() != 'firstParty') {
return 'Fast mode is not available on third-party providers';
}
if (!isFastModeEnabled) {
return 'Fast mode is not available';
}
// Check remote config killswitch.
final statsigReason = _config.getFeatureValue<String?>(
'tengu_penguins_off',
null,
);
if (statsigReason != null) {
return statsigReason;
}
// Previously, fast mode required the native binary. Keep behind a flag.
if (!_config.isInBundledMode() &&
_config.getFeatureValue<bool>('tengu_marble_sandcastle', false)) {
return 'Fast mode requires the native binary';
}
// Not available in the SDK unless explicitly opted in.
if (_config.isNonInteractiveSession() &&
_config.preferThirdPartyAuth() &&
!_config.isKairosActive()) {
final flagFastMode = _config.getFlagFastMode();
if (flagFastMode != true) {
return 'Fast mode is not available in the Agent SDK';
}
}
// Check org-level status.
if (_orgStatus is FastModeOrgDisabled) {
final disabled = _orgStatus as FastModeOrgDisabled;
if (disabled.reason == FastModeDisabledReason.networkError ||
disabled.reason == FastModeDisabledReason.unknown) {
if (_config.isEnvTruthy('MAGE_SKIP_FAST_MODE_NETWORK_ERRORS')) {
return null;
}
}
final oauthTokens = _config.getOAuthTokens();
final authType = oauthTokens != null ? AuthType.oauth : AuthType.apiKey;
return _getDisabledReasonMessage(disabled.reason, authType);
}
return null;
}