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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_fix_agent_mcp_grants
yassin095be37ce521
diff --cc ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_info.integration.test.tsxindex 5bc8c2a5b1c,de1eb153f6f..357f924cbe7--- a/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_info.integration.test.tsx+++ b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_info.integration.test.tsx@@@ -82,16 -75,43 +82,50 @@@ const langgraphInfo: AgentCreateInfo =],};+ const FULL_RUNTIME_ARN = "arn:aws:bedrock-agentcore:eu-central-1:123456789012:runtime/hosted_agent_4vm3i-BaTdfOELAs";++ const BEDROCK_AGENTCORE_AGENT = {+ agent_id: "agent-3",+ agent_name: "bedrock-agent",+ agent_card_params: { name: "bedrock-agent", description: "agentcore agent", url: "", version: "1.0.0", skills: [] },+ litellm_params: {+ custom_llm_provider: "bedrock",+ model: `bedrock/agentcore/${FULL_RUNTIME_ARN}`,+ },+ };++ const bedrockAgentcoreInfo: AgentCreateInfo = {+ agent_type: "bedrock_agentcore",+ agent_type_display_name: "Bedrock AgentCore",+ description: "Bedrock AgentCore runtimes",+ logo_url: "/b.png",+ use_a2a_form_fields: false,+ litellm_params_template: { custom_llm_provider: "bedrock" },+ model_template: "bedrock/agentcore/{agent_runtime_arn}",+ credential_fields: [+ {+ key: "agent_runtime_arn",+ label: "Agent Runtime ARN",+ field_type: "text",+ required: true,+ include_in_litellm_params: false,+ validation_pattern: "^arn:aws[a-zA-Z0-9-]*:bedrock-agentcore:[a-z0-9-]+:[0-9]{12}:runtime/.+$",+ validation_message:+ 'Enter the complete Bedrock AgentCore runtime ARN, including the runtime ID after "runtime/".',+ },+ ],+ };+const setup = () => userEvent.setup({ pointerEventsCheck: PointerEventsCheckLevel.Never });-const renderView = () => render(<AgentInfoView agentId="agent-1" onClose={vi.fn()} accessToken="tok" isAdmin={true} />);+const renderView = () => {+ const queryClient = new QueryClient({ defaultOptions: { queries: { retry: false } } });+ return render(+ <QueryClientProvider client={queryClient}>+ <AgentInfoView agentId="agent-1" onClose={vi.fn()} accessToken="tok" isAdmin={true} />+ </QueryClientProvider>,+ );+};const openEditor = async (user: ReturnType<typeof setup>) => {await user.click(await screen.findByRole("tab", { name: "Settings" }));@@@ -264,26 -281,69 +298,89 @@@ describe("AgentInfoView update payload"});});+ it("keeps the agent's existing MCP grants in the update payload", async () => {+ const existingMcpGrants = {+ mcp_servers: ["srv-1"],+ mcp_access_groups: ["grp-a"],+ mcp_toolsets: ["toolset-1"],+ mcp_tool_permissions: { "srv-1": ["tool_x"] },+ };+ vi.mocked(networking.getAgentInfo).mockResolvedValue({+ ...A2A_AGENT,+ object_permission: existingMcpGrants,+ } as never);+ const user = setup();+ renderView();+ await openEditor(user);++ await save(user);++ expect(patchedPayload().object_permission).toEqual(existingMcpGrants);+ });++ it("preserves the full AgentCore runtime ARN (including the resource id after runtime/) across an unedited save", async () => {+ vi.mocked(networking.getAgentCreateMetadata).mockResolvedValue([bedrockAgentcoreInfo]);+ vi.mocked(networking.getAgentInfo).mockResolvedValue(BEDROCK_AGENTCORE_AGENT as never);+ const user = setup();+ renderView();+ await openEditor(user);++ expect(await screen.findByLabelText("Agent Runtime ARN")).toHaveValue(FULL_RUNTIME_ARN);++ await save(user);++ expect((patchedPayload().litellm_params as Record<string, unknown>).model).toBe(+ `bedrock/agentcore/${FULL_RUNTIME_ARN}`,+ );+ });++ it("blocks the save and shows a validation error when the Agent Runtime ARN is truncated", async () => {+ vi.mocked(networking.getAgentCreateMetadata).mockResolvedValue([bedrockAgentcoreInfo]);+ vi.mocked(networking.getAgentInfo).mockResolvedValue(BEDROCK_AGENTCORE_AGENT as never);+ const user = setup();+ renderView();+ await openEditor(user);++ const arnField = await screen.findByLabelText("Agent Runtime ARN");+ await user.clear(arnField);+ fireEvent.change(arnField, {+ target: { value: "arn:aws:bedrock-agentcore:eu-central-1:123456789012:runtime" },+ });+ await user.click(screen.getByRole("button", { name: "Save Changes" }));++ expect(+ await screen.findByText(+ 'Enter the complete Bedrock AgentCore runtime ARN, including the runtime ID after "runtime/".',+ ),+ ).toBeInTheDocument();+ expect(networking.patchAgentCall).not.toHaveBeenCalled();+ });++ it("renders and saves normally when a field's validation_pattern is not a valid regex", async () => {+ const infoWithBadPattern: AgentCreateInfo = {+ ...bedrockAgentcoreInfo,+ credential_fields: [+ {+ ...bedrockAgentcoreInfo.credential_fields[0],+ validation_pattern: "(unterminated",+ },+ ],+ };+ vi.mocked(networking.getAgentCreateMetadata).mockResolvedValue([infoWithBadPattern]);+ vi.mocked(networking.getAgentInfo).mockResolvedValue(BEDROCK_AGENTCORE_AGENT as never);+ const user = setup();+ renderView();+ await openEditor(user);++ expect(await screen.findByLabelText("Agent Runtime ARN")).toHaveValue(FULL_RUNTIME_ARN);++ await save(user);++ expect((patchedPayload().litellm_params as Record<string, unknown>).model).toBe(+ `bedrock/agentcore/${FULL_RUNTIME_ARN}`,+ );+ });+it("reloads the agent and leaves edit mode when the edit is cancelled", async () => {const user = setup();renderView();