litellm/litellm/integrations
yucheng-berri 69c5839cc0
fix(guardrails): filter Add-Guardrail mode dropdown per provider (#32712)
* fix(guardrails): filter Add-Guardrail mode dropdown per provider

The GET /guardrails/ui/add_guardrail_settings endpoint returned every
GuardrailEventHooks value in one flat supported_modes list, so the Admin
UI rendered pre_mcp_call as a selectable Mode for every guardrail. Saving
Content Filter or Tool Permission with pre_mcp_call then failed with a
400 because those guardrails' server-side supported_event_hooks list
excludes it.

Expose each guardrail's supported hooks as a get_supported_event_hooks
classmethod on CustomGuardrail (mirrors the existing get_config_model
pattern) and have the endpoint iterate guardrail_class_registry to build
a supported_modes_by_provider map. The UI Mode dropdown filters by that
map when the selected provider is known and falls back to the global
list otherwise. __init__ now sources its own supported_event_hooks list
from the classmethod so the two sides can't drift.

Also register BedrockGuardrail, ToolPermissionGuardrail, lakera,
lakera_v2, and presidio in guardrail_class_registry so they participate
in the map (they were previously only in guardrail_initializer_registry
and had no class-registry entry).

Behavior change: guardrails that previously had no supported_event_hooks
declared (aim, javelin, azure/text_moderation, cato_networks,
crowdstrike_aidr, headroom, hiddenlayer, lasso, noma, onyx,
prompt_security, qualifire, repelloai, zscaler_ai_guard, aporia_ai,
lakera_ai, lakera_ai_v2, mcp_jwt_signer, model_armor, presidio) now
validate the configured mode at instantiation. Existing configs where
the mode was silently a no-op will fail at proxy startup with a clear
validation error rather than running as a broken guardrail.

Resolves LIT-4226

* fix(guardrails): add LITELLM_STRICT_GUARDRAIL_MODES escape hatch, preserve current mode in edit form

Address Greptile P1 (startup break) and P2 (edit form UX):

LITELLM_STRICT_GUARDRAIL_MODES defaults to true (raise on unsupported
event_hook, unchanged behavior for the guardrails validated pre-PR).
Setting it to false logs a warning and continues, giving deployments an
opt-out while they fix configs that now surface as errors instead of
silently no-op'ing. Regression test covers both modes.

Edit form now surfaces the currently-saved mode even when it is not in
the filtered per-provider list, so a legacy row (e.g. content_filter
saved with pre_mcp_call before this fix) no longer disappears from the
dropdown; the option renders with a 'not supported by <provider>' note
so the user knows to pick another.

* fix(guardrails): correct audited hook lists, prune stale modes on provider switch, clean form lint

Audited every get_supported_event_hooks classmethod against the hooks
each guardrail's own tests exercise and its handler methods. Five were
too narrow and their tests caught it in CI: rubrik gains pre_call,
presidio gains during_call and pre_mcp_call, prompt_security, onyx and
qualifire gain during_call. The remaining classes match either their
original __init__ declarations or their exercised modes exactly.

Cursor review fixes: the Add form now drops selected modes the new
provider does not support when the user switches providers, so a
pre_mcp_call selection cannot ride along into a provider that rejects
it at save; the edit form handles list-shaped stored modes instead of
treating mode as always a string.

Extracted shared toModeArray and getSupportedModesForProvider helpers
into guardrail_info_helpers so both forms use one implementation, typed
the remaining any usages in both forms, removed nested ternaries, and
committed the ratcheted-down eslint metrics and pruned suppressions
2026-07-11 14:51:27 -07:00
..
_types style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
agentops style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
arize style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
azure_sentinel fix(azure_sentinel): resolve audit stream from AZURE_SENTINEL_AUDIT_STREAM_NAME (#32010) 2026-07-03 12:09:27 -07:00
azure_storage style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
bitbucket style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
cloudzero style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
code_interpreter_interception feat(sandbox): reuse e2b container across requests when metadata.session_id is set (#31688) 2026-06-30 18:58:09 -07:00
compression_interception style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
datadog fix(datadog): split log batches proactively under intake payload limits (#32860) 2026-07-10 20:54:42 -07:00
deepeval style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
dotprompt style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
email_templates fix(email): apply EMAIL_SIGNATURE to budget alert emails (#31712) 2026-06-30 21:11:50 +02:00
focus style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
gcs_bucket style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
gcs_pubsub style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
generic_api style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
generic_prompt_management style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
gitlab style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
langfuse style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
levo style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
litellm_agent Agent Builder - support new experimental agent builder, to ensure agents pass compliance checks (#21817) 2026-02-21 15:32:47 -08:00
mavvrik_focus style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
newrelic style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
opentelemetry_utils style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
opik style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
otel feat(otel): emit the gen_ai.client.operation.exception event on failed LLM calls (#32655) 2026-07-10 16:08:10 -07:00
prometheus_helpers style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
SlackAlerting style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
vantage style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
vector_store_integrations style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
weave style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
websearch_interception fix: merge websearch tool params (#32162) 2026-07-04 19:24:35 -07:00
__init__.py add linting 2023-08-18 11:05:05 -07:00
additional_logging_utils.py build(deps-dev): bump black to 26.3.1 and apply formatting (#28525) 2026-05-21 17:24:18 -07:00
anthropic_cache_control_hook.py feat: add cache control injection support for v1/messages endpoint (#31778) 2026-06-30 19:31:51 -07:00
argilla.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
athina.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
braintrust_logging.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
braintrust_mock_client.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
callback_configs.json feat: litellm oss 110626 (#30202) 2026-06-11 22:30:26 -07:00
custom_batch_logger.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
custom_guardrail.py fix(guardrails): filter Add-Guardrail mode dropdown per provider (#32712) 2026-07-11 14:51:27 -07:00
custom_logger.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
custom_prompt_management.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
custom_secret_manager.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
custom_sso_handler.py chore(auth): require trusted proxy for header identity auth 2026-04-29 21:20:21 -07:00
dynamodb.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
email_alerting.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
galileo.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
greenscale.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
helicone.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
helicone_mock_client.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
humanloop.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
lago.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
langsmith.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
langsmith_mock_client.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
langtrace.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
literal_ai.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
logfire_logger.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
lunary.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
mlflow.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
mock_client_factory.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
openmeter.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
opentelemetry.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
posthog.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
posthog_mock_client.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
prometheus.py fix(prometheus): skip budget metric DB lookups when gauges are NoOpMetric (#32834) 2026-07-10 20:25:47 -07:00
prometheus_services.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
prompt_layer.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
prompt_management_base.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
Readme.md (Feat) - Add GCS Pub/Sub Logging integration for sending DB SpendLogs to BigQuery (#7976) 2025-01-24 20:57:20 -08:00
rubrik.py fix(guardrails): filter Add-Guardrail mode dropdown per provider (#32712) 2026-07-11 14:51:27 -07:00
s3.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
s3_v2.py fix(s3_v2): pass usedforsecurity=False to hashlib.md5 for FIPS envs 2026-07-02 01:12:49 +00:00
sqs.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
supabase.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
test_httpx.py fix(utils.py): improved predibase exception mapping 2024-06-08 14:32:43 -07:00
traceloop.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
weights_biases.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00

Integrations

This folder contains logging integrations for litellm

eg. logging to Datadog, Langfuse, Prometheus, s3, GCS Bucket, etc.