+
);
diff --git a/ui/litellm-dashboard/src/components/organisms/create_key_button.tsx b/ui/litellm-dashboard/src/components/organisms/create_key_button.tsx
index 14959e23e5b..3c0a0f520d4 100644
--- a/ui/litellm-dashboard/src/components/organisms/create_key_button.tsx
+++ b/ui/litellm-dashboard/src/components/organisms/create_key_button.tsx
@@ -33,6 +33,7 @@ import { formatNumberWithCommas } from "@/utils/dataUtils";
import { mapDisplayToInternalNames } from "../callback_info_helpers";
import MCPServerSelector from "../mcp_server_management/MCPServerSelector";
import MCPToolPermissions from "../mcp_server_management/MCPToolPermissions";
+import AgentSelector from "../agent_management/AgentSelector";
import ModelAliasManager from "../common_components/ModelAliasManager";
import NotificationsManager from "../molecules/notifications_manager";
import KeyLifecycleSettings from "../common_components/KeyLifecycleSettings";
@@ -385,6 +386,26 @@ const CreateKey: React.FC
= ({
delete formValues.allowed_mcp_access_groups;
}
+ // Transform allowed_agents_and_groups into object_permission format
+ if (
+ formValues.allowed_agents_and_groups &&
+ (formValues.allowed_agents_and_groups.agents?.length > 0 ||
+ formValues.allowed_agents_and_groups.accessGroups?.length > 0)
+ ) {
+ if (!formValues.object_permission) {
+ formValues.object_permission = {};
+ }
+ const { agents, accessGroups } = formValues.allowed_agents_and_groups;
+ if (agents && agents.length > 0) {
+ formValues.object_permission.agents = agents;
+ }
+ if (accessGroups && accessGroups.length > 0) {
+ formValues.object_permission.agent_access_groups = accessGroups;
+ }
+ // Remove the original field as it's now part of object_permission
+ delete formValues.allowed_agents_and_groups;
+ }
+
// Add model_aliases if any are defined
if (Object.keys(modelAliases).length > 0) {
formValues.aliases = JSON.stringify(modelAliases);
@@ -1091,6 +1112,33 @@ const CreateKey: React.FC = ({
+
+
+ Agent Settings
+
+
+
+ Allowed Agents{" "}
+
+
+
+
+ }
+ name="allowed_agents_and_groups"
+ help="Select agents or access groups this key can access"
+ >
+ form.setFieldValue("allowed_agents_and_groups", val)}
+ value={form.getFieldValue("allowed_agents_and_groups")}
+ accessToken={accessToken}
+ placeholder="Select agents or access groups (optional)"
+ />
+
+
+
+
{premiumUser ? (
diff --git a/ui/litellm-dashboard/src/components/permissions/AgentPermissions.tsx b/ui/litellm-dashboard/src/components/permissions/AgentPermissions.tsx
new file mode 100644
index 00000000000..995e25643b4
--- /dev/null
+++ b/ui/litellm-dashboard/src/components/permissions/AgentPermissions.tsx
@@ -0,0 +1,111 @@
+import React, { useState, useEffect } from "react";
+import { Text, Badge } from "@tremor/react";
+import { UserGroupIcon } from "@heroicons/react/outline";
+import { Tooltip } from "antd";
+import { getAgentsList } from "../networking";
+
+interface Agent {
+ agent_id: string;
+ agent_name: string;
+ agent_config?: Record;
+ agent_card_params?: Record;
+}
+
+interface AgentPermissionsProps {
+ agents: string[];
+ agentAccessGroups?: string[];
+ accessToken?: string | null;
+}
+
+export function AgentPermissions({
+ agents,
+ agentAccessGroups = [],
+ accessToken
+}: AgentPermissionsProps) {
+ const [agentDetails, setAgentDetails] = useState([]);
+
+ // Fetch agent details when component mounts
+ useEffect(() => {
+ const fetchAgentDetails = async () => {
+ if (accessToken && agents.length > 0) {
+ try {
+ const response = await getAgentsList(accessToken);
+ if (response && response.agents && Array.isArray(response.agents)) {
+ setAgentDetails(response.agents);
+ }
+ } catch (error) {
+ console.error("Error fetching agents:", error);
+ }
+ }
+ };
+ fetchAgentDetails();
+ }, [accessToken, agents.length]);
+
+ // Function to get display name for agent
+ const getAgentDisplayName = (agentId: string) => {
+ const agentDetail = agentDetails.find((agent) => agent.agent_id === agentId);
+ if (agentDetail) {
+ const truncatedId = agentId.length > 7 ? `${agentId.slice(0, 3)}...${agentId.slice(-4)}` : agentId;
+ return `${agentDetail.agent_name} (${truncatedId})`;
+ }
+ return agentId;
+ };
+
+ // Merge agents and access groups into one list
+ const mergedItems = [
+ ...agents.map((agent) => ({ type: "agent", value: agent })),
+ ...agentAccessGroups.map((group) => ({ type: "accessGroup", value: group })),
+ ];
+ const totalCount = mergedItems.length;
+
+ return (
+
+
+
+ Agents
+
+ {totalCount}
+
+
+
+ {totalCount > 0 ? (
+
+ {mergedItems.map((item, index) => (
+
+
+
+ {item.type === "agent" ? (
+
+
+
+ {getAgentDisplayName(item.value)}
+
+
+ ) : (
+
+
+ {item.value}
+
+ Group
+
+
+ )}
+
+
+
+ ))}
+
+ ) : (
+
+
+ No agents or access groups configured
+
+ )}
+
+ );
+}
+
+export default AgentPermissions;
+
diff --git a/ui/litellm-dashboard/src/components/team/team_info.tsx b/ui/litellm-dashboard/src/components/team/team_info.tsx
index 581722e8fa7..e9e5e6f640d 100644
--- a/ui/litellm-dashboard/src/components/team/team_info.tsx
+++ b/ui/litellm-dashboard/src/components/team/team_info.tsx
@@ -38,6 +38,7 @@ import { getModelDisplayName, unfurlWildcardModelsInList } from "../key_team_hel
import LoggingSettingsView from "../logging_settings_view";
import MCPServerSelector from "../mcp_server_management/MCPServerSelector";
import MCPToolPermissions from "../mcp_server_management/MCPToolPermissions";
+import AgentSelector from "../agent_management/AgentSelector";
import NotificationsManager from "../molecules/notifications_manager";
import { fetchMCPAccessGroups } from "../networking";
import ObjectPermissionsView from "../object_permissions_view";
@@ -95,6 +96,8 @@ export interface TeamData {
mcp_access_groups?: string[];
mcp_tool_permissions?: Record;
vector_stores: string[];
+ agents?: string[];
+ agent_access_groups?: string[];
};
team_member_budget_table: {
max_budget: number;
@@ -433,6 +436,19 @@ const TeamInfoView: React.FC = ({
delete values.mcp_servers_and_groups;
delete values.mcp_tool_permissions;
+ // Handle agent permissions
+ const { agents, accessGroups: agentAccessGroups } = values.agents_and_groups || {
+ agents: [],
+ accessGroups: [],
+ };
+ if (agents && agents.length > 0) {
+ updateData.object_permission.agents = agents;
+ }
+ if (agentAccessGroups && agentAccessGroups.length > 0) {
+ updateData.object_permission.agent_access_groups = agentAccessGroups;
+ }
+ delete values.agents_and_groups;
+
const response = await teamUpdateCall(accessToken, updateData);
NotificationsManager.success("Team settings updated successfully");
@@ -630,6 +646,10 @@ const TeamInfoView: React.FC = ({
accessGroups: info.object_permission?.mcp_access_groups || [],
},
mcp_tool_permissions: info.object_permission?.mcp_tool_permissions || {},
+ agents_and_groups: {
+ agents: info.object_permission?.agents || [],
+ accessGroups: info.object_permission?.agent_access_groups || [],
+ },
}}
layout="vertical"
>
@@ -834,6 +854,15 @@ const TeamInfoView: React.FC = ({
)}
+
+ form.setFieldValue("agents_and_groups", val)}
+ value={form.getFieldValue("agents_and_groups")}
+ accessToken={accessToken || ""}
+ placeholder="Select agents or access groups (optional)"
+ />
+
+
diff --git a/ui/litellm-dashboard/src/components/templates/key_edit_view.tsx b/ui/litellm-dashboard/src/components/templates/key_edit_view.tsx
index d7376fde146..d655489abf1 100644
--- a/ui/litellm-dashboard/src/components/templates/key_edit_view.tsx
+++ b/ui/litellm-dashboard/src/components/templates/key_edit_view.tsx
@@ -10,6 +10,7 @@ import { extractLoggingSettings, formatMetadataForDisplay, stripTagsFromMetadata
import { KeyResponse } from "../key_team_helpers/key_list";
import MCPServerSelector from "../mcp_server_management/MCPServerSelector";
import MCPToolPermissions from "../mcp_server_management/MCPToolPermissions";
+import AgentSelector from "../agent_management/AgentSelector";
import NotificationsManager from "../molecules/notifications_manager";
import { fetchMCPAccessGroups, getPromptsList, modelAvailableCall, tagListCall } from "../networking";
import { fetchTeamModels } from "../organisms/create_key_button";
@@ -175,6 +176,10 @@ export function KeyEditView({
accessGroups: keyData.object_permission?.mcp_access_groups || [],
},
mcp_tool_permissions: keyData.object_permission?.mcp_tool_permissions || {},
+ agents_and_groups: {
+ agents: keyData.object_permission?.agents || [],
+ accessGroups: keyData.object_permission?.agent_access_groups || [],
+ },
logging_settings: extractLoggingSettings(keyData.metadata),
disabled_callbacks: Array.isArray(keyData.metadata?.litellm_disabled_callbacks)
? mapInternalToDisplayNames(keyData.metadata.litellm_disabled_callbacks)
@@ -511,6 +516,15 @@ export function KeyEditView({
)}
+
+ form.setFieldValue("agents_and_groups", val)}
+ value={form.getFieldValue("agents_and_groups")}
+ accessToken={accessToken || ""}
+ placeholder="Select agents or access groups (optional)"
+ />
+
+