diff --git a/litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py b/litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py index fc6f4eedae9..b8010d5754a 100644 --- a/litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py +++ b/litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py @@ -1014,7 +1014,7 @@ async def bedrock_proxy_route( raise ImportError("Missing boto3 to call bedrock. Run 'pip install boto3'.") aws_region_name: Final = litellm.utils.get_secret(secret_name="AWS_REGION_NAME") - if _is_bedrock_agent_control_plane_route(endpoint=endpoint): + if request.method == "PUT" and _is_bedrock_agent_control_plane_route(endpoint=endpoint): base_target_url: Final = f"https://bedrock-agent.{aws_region_name}.amazonaws.com" elif _is_bedrock_agent_runtime_route(endpoint=endpoint): # handle bedrock agents base_target_url: Final = f"https://bedrock-agent-runtime.{aws_region_name}.amazonaws.com" diff --git a/tests/pass_through_unit_tests/test_pass_through_unit_tests.py b/tests/pass_through_unit_tests/test_pass_through_unit_tests.py index 4c0dd4ad4ef..5a81030e678 100644 --- a/tests/pass_through_unit_tests/test_pass_through_unit_tests.py +++ b/tests/pass_through_unit_tests/test_pass_through_unit_tests.py @@ -502,6 +502,18 @@ def test_is_bedrock_agent_control_plane_route(): "PUT", "https://bedrock-agent.ap-northeast-2.amazonaws.com/knowledgebases/kb-123/datasources/ds-456/documents", ), + ( + "knowledgebases/kb-123/datasources/ds-456/documents", + "POST", + "https://bedrock-agent-runtime.ap-northeast-2.amazonaws.com/" + "knowledgebases/kb-123/datasources/ds-456/documents", + ), + ( + "knowledgebases/kb-123/datasources/ds-456/documents", + "DELETE", + "https://bedrock-agent-runtime.ap-northeast-2.amazonaws.com/" + "knowledgebases/kb-123/datasources/ds-456/documents", + ), ), ) async def test_bedrock_agent_route_target_and_sigv4_method(