mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-08 03:08:45 +00:00
feat(a2a/): add guardrails for agent interactions
allows the same guardrails for llm's to be applied to agents as well
This commit is contained in:
parent
0ef51255dd
commit
babcc78298
3 changed files with 2 additions and 18 deletions
|
|
@ -520,7 +520,6 @@ class ProxyBaseLLMRequestProcessing:
|
|||
"adelete_interaction",
|
||||
"acancel_interaction",
|
||||
"asend_message",
|
||||
"call_mcp_tool",
|
||||
],
|
||||
version: Optional[str] = None,
|
||||
user_model: Optional[str] = None,
|
||||
|
|
@ -620,23 +619,6 @@ class ProxyBaseLLMRequestProcessing:
|
|||
user_api_key_dict=user_api_key_dict, data=self.data, call_type=route_type # type: ignore
|
||||
)
|
||||
|
||||
# Apply hierarchical router_settings (Key > Team)
|
||||
# Global router_settings are already on the Router object itself.
|
||||
if llm_router is not None and proxy_config is not None:
|
||||
from litellm.proxy.proxy_server import prisma_client
|
||||
|
||||
router_settings = await proxy_config._get_hierarchical_router_settings(
|
||||
user_api_key_dict=user_api_key_dict,
|
||||
prisma_client=prisma_client,
|
||||
proxy_logging_obj=proxy_logging_obj,
|
||||
)
|
||||
|
||||
# If router_settings found (from key or team), apply them
|
||||
# Pass settings as per-request overrides instead of creating a new Router
|
||||
# This avoids expensive Router instantiation on each request
|
||||
if router_settings is not None:
|
||||
self.data["router_settings_override"] = router_settings
|
||||
|
||||
if "messages" in self.data and self.data["messages"]:
|
||||
logging_obj.update_messages(self.data["messages"])
|
||||
|
||||
|
|
|
|||
|
|
@ -210,6 +210,7 @@ class CustomCodeGuardrail(CustomGuardrail):
|
|||
HTTPException: If content is blocked
|
||||
CustomCodeExecutionError: If execution fails
|
||||
"""
|
||||
|
||||
if self._compiled_function is None:
|
||||
if self._compile_error:
|
||||
raise CustomCodeExecutionError(
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ class UnifiedLLMGuardrails(CustomLogger):
|
|||
if CallTypes(call_type) not in endpoint_guardrail_translation_mappings:
|
||||
return data
|
||||
except ValueError:
|
||||
|
||||
return data # handle unmapped call types
|
||||
|
||||
endpoint_translation = endpoint_guardrail_translation_mappings[
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue