Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

refactor(guardrails): read key_alias from the typed UserAPIKeyAuth in Agent 365 payload

yucheng5921e644468c
diff --git a/litellm/proxy/guardrails/guardrail_hooks/agent_365/agent_365.py b/litellm/proxy/guardrails/guardrail_hooks/agent_365/agent_365.py
index 34c4d67a829..8d0957ff2be 100644
--- a/litellm/proxy/guardrails/guardrail_hooks/agent_365/agent_365.py
+++ b/litellm/proxy/guardrails/guardrail_hooks/agent_365/agent_365.py
@@ -345,7 +345,7 @@ class Agent365Guardrail(CustomGuardrail):
tool_name: Final = str(data.get("mcp_tool_name") or "")
arguments: Final = data.get("mcp_arguments")
server_name: Final = str(data.get("mcp_server_name") or "litellm")
- agent_id: Final = self.agent_id or getattr(user_api_key_dict, "key_alias", None)
+ agent_id: Final = self.agent_id or user_api_key_dict.key_alias
tool_reference: Final[_ToolReference] = {"name": tool_name}
payload: Final[dict[str, object]] = { # mutable-ok: JSON body with optional fields added below
"tool": tool_reference,